kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
96eaf1df2c
commit
8d6914f0fe
|
@ -61,6 +61,9 @@ export function registerV1AdminGetDeploymentByIdentifier(
|
|||
)
|
||||
await acl(c, deployment, { label: 'Deployment' })
|
||||
|
||||
// TODO: ensure that the deployment's project is either public OR the
|
||||
// consumer has access to it?
|
||||
|
||||
const hasPopulateProject = populate.includes('project')
|
||||
|
||||
return c.json(
|
||||
|
|
|
@ -50,7 +50,7 @@ export function registerV1GetPublicProjectByIdentifier(
|
|||
}
|
||||
})
|
||||
assert(
|
||||
project && project.private && project.lastPublishedDeploymentId,
|
||||
project && !project.private && project.lastPublishedDeploymentId,
|
||||
404,
|
||||
`Public project not found "${projectIdentifier}"`
|
||||
)
|
||||
|
|
|
@ -49,7 +49,7 @@ export function registerV1GetPublicProject(app: OpenAPIHono<DefaultHonoEnv>) {
|
|||
}
|
||||
})
|
||||
assert(
|
||||
project && project.private && project.lastPublishedDeploymentId,
|
||||
project && !project.private && project.lastPublishedDeploymentId,
|
||||
404,
|
||||
`Public project not found "${projectId}"`
|
||||
)
|
||||
|
|
|
@ -6,7 +6,6 @@ import useInfiniteScroll from 'react-infinite-scroll-hook'
|
|||
|
||||
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||
import { toastError } from '@/lib/notifications'
|
||||
|
||||
export function AppIndex() {
|
||||
const ctx = useAuthenticatedAgentic()
|
||||
|
@ -35,10 +34,6 @@ export function AppIndex() {
|
|||
nextOffset:
|
||||
projects.length >= limit ? pageParam + projects.length : undefined
|
||||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
void toastError('Failed to fetch projects')
|
||||
throw err
|
||||
}),
|
||||
getNextPageParam: (lastGroup) => lastGroup?.nextOffset,
|
||||
enabled: !!ctx,
|
||||
|
|
|
@ -4,7 +4,6 @@ import { useQuery } from '@tanstack/react-query'
|
|||
|
||||
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||
import { toastError } from '@/lib/notifications'
|
||||
|
||||
export function AppConsumerIndex({ consumerId }: { consumerId: string }) {
|
||||
const ctx = useAuthenticatedAgentic()
|
||||
|
@ -15,17 +14,10 @@ export function AppConsumerIndex({ consumerId }: { consumerId: string }) {
|
|||
} = useQuery({
|
||||
queryKey: ['consumer', consumerId],
|
||||
queryFn: () =>
|
||||
ctx!.api
|
||||
.getConsumer({
|
||||
consumerId,
|
||||
populate: ['project']
|
||||
})
|
||||
.catch((err: any) => {
|
||||
void toastError(
|
||||
`Failed to fetch customer subscription "${consumerId}"`
|
||||
)
|
||||
throw err
|
||||
}),
|
||||
ctx!.api.getConsumer({
|
||||
consumerId,
|
||||
populate: ['project']
|
||||
}),
|
||||
enabled: !!ctx
|
||||
})
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import useInfiniteScroll from 'react-infinite-scroll-hook'
|
|||
|
||||
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||
import { toastError } from '@/lib/notifications'
|
||||
|
||||
export function AppConsumersIndex() {
|
||||
const ctx = useAuthenticatedAgentic()
|
||||
|
@ -37,10 +36,6 @@ export function AppConsumersIndex() {
|
|||
? pageParam + consumers.length
|
||||
: undefined
|
||||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
void toastError('Failed to fetch customer subscriptions')
|
||||
throw err
|
||||
}),
|
||||
getNextPageParam: (lastGroup) => lastGroup?.nextOffset,
|
||||
enabled: !!ctx,
|
||||
|
|
|
@ -4,7 +4,6 @@ import { useQuery } from '@tanstack/react-query'
|
|||
|
||||
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||
import { toastError } from '@/lib/notifications'
|
||||
|
||||
export function AppProjectIndex({
|
||||
projectIdentifier
|
||||
|
@ -19,15 +18,10 @@ export function AppProjectIndex({
|
|||
} = useQuery({
|
||||
queryKey: ['project', projectIdentifier],
|
||||
queryFn: () =>
|
||||
ctx!.api
|
||||
.getProjectByIdentifier({
|
||||
projectIdentifier,
|
||||
populate: ['lastPublishedDeployment']
|
||||
})
|
||||
.catch((err: any) => {
|
||||
void toastError(`Failed to fetch project "${projectIdentifier}"`)
|
||||
throw err
|
||||
}),
|
||||
ctx!.api.getProjectByIdentifier({
|
||||
projectIdentifier,
|
||||
populate: ['lastPublishedDeployment']
|
||||
}),
|
||||
enabled: !!ctx
|
||||
})
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import useInfiniteScroll from 'react-infinite-scroll-hook'
|
|||
|
||||
import { useAgentic } from '@/components/agentic-provider'
|
||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||
import { toastError } from '@/lib/notifications'
|
||||
|
||||
export function MarketplaceIndex() {
|
||||
const ctx = useAgentic()
|
||||
|
@ -35,10 +34,6 @@ export function MarketplaceIndex() {
|
|||
nextOffset:
|
||||
projects.length >= limit ? pageParam + projects.length : undefined
|
||||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
void toastError('Failed to fetch public projects')
|
||||
throw err
|
||||
}),
|
||||
getNextPageParam: (lastGroup) => lastGroup?.nextOffset,
|
||||
enabled: !!ctx,
|
||||
|
@ -62,14 +57,14 @@ export function MarketplaceIndex() {
|
|||
className='text-center text-balance leading-snug md:leading-none
|
||||
text-4xl font-extrabold'
|
||||
>
|
||||
Dashboard
|
||||
Marketplace
|
||||
</h1>
|
||||
|
||||
{!ctx || isLoading ? (
|
||||
<LoadingIndicator />
|
||||
) : (
|
||||
<div className='mt-8'>
|
||||
<h2 className='text-xl font-semibold mb-4'>Your Projects</h2>
|
||||
<h2 className='text-xl font-semibold mb-4'>Public Projects</h2>
|
||||
|
||||
{isError ? (
|
||||
<p>Error fetching projects</p>
|
||||
|
@ -83,7 +78,7 @@ export function MarketplaceIndex() {
|
|||
<Link
|
||||
key={project.id}
|
||||
className='p-4 border rounded-lg hover:border-gray-400 transition-colors'
|
||||
href={`/app/projects/${project.identifier}`}
|
||||
href={`/marketplace/projects/${project.identifier}`}
|
||||
>
|
||||
<h3 className='font-medium'>{project.name}</h3>
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import { useQuery } from '@tanstack/react-query'
|
|||
|
||||
import { useAgentic } from '@/components/agentic-provider'
|
||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||
import { toastError } from '@/lib/notifications'
|
||||
|
||||
export function MarketplaceProjectIndex({
|
||||
projectIdentifier
|
||||
|
@ -19,17 +18,10 @@ export function MarketplaceProjectIndex({
|
|||
} = useQuery({
|
||||
queryKey: ['project', projectIdentifier],
|
||||
queryFn: () =>
|
||||
ctx!.api
|
||||
.getPublicProjectByIdentifier({
|
||||
projectIdentifier,
|
||||
populate: ['lastPublishedDeployment']
|
||||
})
|
||||
.catch((err: any) => {
|
||||
void toastError(
|
||||
`Failed to fetch public project "${projectIdentifier}"`
|
||||
)
|
||||
throw err
|
||||
}),
|
||||
ctx!.api.getPublicProjectByIdentifier({
|
||||
projectIdentifier,
|
||||
populate: ['lastPublishedDeployment']
|
||||
}),
|
||||
enabled: !!ctx
|
||||
})
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue