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' })
|
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')
|
const hasPopulateProject = populate.includes('project')
|
||||||
|
|
||||||
return c.json(
|
return c.json(
|
||||||
|
|
|
@ -50,7 +50,7 @@ export function registerV1GetPublicProjectByIdentifier(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
assert(
|
assert(
|
||||||
project && project.private && project.lastPublishedDeploymentId,
|
project && !project.private && project.lastPublishedDeploymentId,
|
||||||
404,
|
404,
|
||||||
`Public project not found "${projectIdentifier}"`
|
`Public project not found "${projectIdentifier}"`
|
||||||
)
|
)
|
||||||
|
|
|
@ -49,7 +49,7 @@ export function registerV1GetPublicProject(app: OpenAPIHono<DefaultHonoEnv>) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
assert(
|
assert(
|
||||||
project && project.private && project.lastPublishedDeploymentId,
|
project && !project.private && project.lastPublishedDeploymentId,
|
||||||
404,
|
404,
|
||||||
`Public project not found "${projectId}"`
|
`Public project not found "${projectId}"`
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import useInfiniteScroll from 'react-infinite-scroll-hook'
|
||||||
|
|
||||||
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
||||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||||
import { toastError } from '@/lib/notifications'
|
|
||||||
|
|
||||||
export function AppIndex() {
|
export function AppIndex() {
|
||||||
const ctx = useAuthenticatedAgentic()
|
const ctx = useAuthenticatedAgentic()
|
||||||
|
@ -35,10 +34,6 @@ export function AppIndex() {
|
||||||
nextOffset:
|
nextOffset:
|
||||||
projects.length >= limit ? pageParam + projects.length : undefined
|
projects.length >= limit ? pageParam + projects.length : undefined
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.catch((err: any) => {
|
|
||||||
void toastError('Failed to fetch projects')
|
|
||||||
throw err
|
|
||||||
}),
|
}),
|
||||||
getNextPageParam: (lastGroup) => lastGroup?.nextOffset,
|
getNextPageParam: (lastGroup) => lastGroup?.nextOffset,
|
||||||
enabled: !!ctx,
|
enabled: !!ctx,
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { useQuery } from '@tanstack/react-query'
|
||||||
|
|
||||||
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
||||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||||
import { toastError } from '@/lib/notifications'
|
|
||||||
|
|
||||||
export function AppConsumerIndex({ consumerId }: { consumerId: string }) {
|
export function AppConsumerIndex({ consumerId }: { consumerId: string }) {
|
||||||
const ctx = useAuthenticatedAgentic()
|
const ctx = useAuthenticatedAgentic()
|
||||||
|
@ -15,17 +14,10 @@ export function AppConsumerIndex({ consumerId }: { consumerId: string }) {
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ['consumer', consumerId],
|
queryKey: ['consumer', consumerId],
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
ctx!.api
|
ctx!.api.getConsumer({
|
||||||
.getConsumer({
|
consumerId,
|
||||||
consumerId,
|
populate: ['project']
|
||||||
populate: ['project']
|
}),
|
||||||
})
|
|
||||||
.catch((err: any) => {
|
|
||||||
void toastError(
|
|
||||||
`Failed to fetch customer subscription "${consumerId}"`
|
|
||||||
)
|
|
||||||
throw err
|
|
||||||
}),
|
|
||||||
enabled: !!ctx
|
enabled: !!ctx
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import useInfiniteScroll from 'react-infinite-scroll-hook'
|
||||||
|
|
||||||
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
||||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||||
import { toastError } from '@/lib/notifications'
|
|
||||||
|
|
||||||
export function AppConsumersIndex() {
|
export function AppConsumersIndex() {
|
||||||
const ctx = useAuthenticatedAgentic()
|
const ctx = useAuthenticatedAgentic()
|
||||||
|
@ -37,10 +36,6 @@ export function AppConsumersIndex() {
|
||||||
? pageParam + consumers.length
|
? pageParam + consumers.length
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.catch((err: any) => {
|
|
||||||
void toastError('Failed to fetch customer subscriptions')
|
|
||||||
throw err
|
|
||||||
}),
|
}),
|
||||||
getNextPageParam: (lastGroup) => lastGroup?.nextOffset,
|
getNextPageParam: (lastGroup) => lastGroup?.nextOffset,
|
||||||
enabled: !!ctx,
|
enabled: !!ctx,
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { useQuery } from '@tanstack/react-query'
|
||||||
|
|
||||||
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
import { useAuthenticatedAgentic } from '@/components/agentic-provider'
|
||||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||||
import { toastError } from '@/lib/notifications'
|
|
||||||
|
|
||||||
export function AppProjectIndex({
|
export function AppProjectIndex({
|
||||||
projectIdentifier
|
projectIdentifier
|
||||||
|
@ -19,15 +18,10 @@ export function AppProjectIndex({
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ['project', projectIdentifier],
|
queryKey: ['project', projectIdentifier],
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
ctx!.api
|
ctx!.api.getProjectByIdentifier({
|
||||||
.getProjectByIdentifier({
|
projectIdentifier,
|
||||||
projectIdentifier,
|
populate: ['lastPublishedDeployment']
|
||||||
populate: ['lastPublishedDeployment']
|
}),
|
||||||
})
|
|
||||||
.catch((err: any) => {
|
|
||||||
void toastError(`Failed to fetch project "${projectIdentifier}"`)
|
|
||||||
throw err
|
|
||||||
}),
|
|
||||||
enabled: !!ctx
|
enabled: !!ctx
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import useInfiniteScroll from 'react-infinite-scroll-hook'
|
||||||
|
|
||||||
import { useAgentic } from '@/components/agentic-provider'
|
import { useAgentic } from '@/components/agentic-provider'
|
||||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||||
import { toastError } from '@/lib/notifications'
|
|
||||||
|
|
||||||
export function MarketplaceIndex() {
|
export function MarketplaceIndex() {
|
||||||
const ctx = useAgentic()
|
const ctx = useAgentic()
|
||||||
|
@ -35,10 +34,6 @@ export function MarketplaceIndex() {
|
||||||
nextOffset:
|
nextOffset:
|
||||||
projects.length >= limit ? pageParam + projects.length : undefined
|
projects.length >= limit ? pageParam + projects.length : undefined
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.catch((err: any) => {
|
|
||||||
void toastError('Failed to fetch public projects')
|
|
||||||
throw err
|
|
||||||
}),
|
}),
|
||||||
getNextPageParam: (lastGroup) => lastGroup?.nextOffset,
|
getNextPageParam: (lastGroup) => lastGroup?.nextOffset,
|
||||||
enabled: !!ctx,
|
enabled: !!ctx,
|
||||||
|
@ -62,14 +57,14 @@ export function MarketplaceIndex() {
|
||||||
className='text-center text-balance leading-snug md:leading-none
|
className='text-center text-balance leading-snug md:leading-none
|
||||||
text-4xl font-extrabold'
|
text-4xl font-extrabold'
|
||||||
>
|
>
|
||||||
Dashboard
|
Marketplace
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
{!ctx || isLoading ? (
|
{!ctx || isLoading ? (
|
||||||
<LoadingIndicator />
|
<LoadingIndicator />
|
||||||
) : (
|
) : (
|
||||||
<div className='mt-8'>
|
<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 ? (
|
{isError ? (
|
||||||
<p>Error fetching projects</p>
|
<p>Error fetching projects</p>
|
||||||
|
@ -83,7 +78,7 @@ export function MarketplaceIndex() {
|
||||||
<Link
|
<Link
|
||||||
key={project.id}
|
key={project.id}
|
||||||
className='p-4 border rounded-lg hover:border-gray-400 transition-colors'
|
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>
|
<h3 className='font-medium'>{project.name}</h3>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { useQuery } from '@tanstack/react-query'
|
||||||
|
|
||||||
import { useAgentic } from '@/components/agentic-provider'
|
import { useAgentic } from '@/components/agentic-provider'
|
||||||
import { LoadingIndicator } from '@/components/loading-indicator'
|
import { LoadingIndicator } from '@/components/loading-indicator'
|
||||||
import { toastError } from '@/lib/notifications'
|
|
||||||
|
|
||||||
export function MarketplaceProjectIndex({
|
export function MarketplaceProjectIndex({
|
||||||
projectIdentifier
|
projectIdentifier
|
||||||
|
@ -19,17 +18,10 @@ export function MarketplaceProjectIndex({
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ['project', projectIdentifier],
|
queryKey: ['project', projectIdentifier],
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
ctx!.api
|
ctx!.api.getPublicProjectByIdentifier({
|
||||||
.getPublicProjectByIdentifier({
|
projectIdentifier,
|
||||||
projectIdentifier,
|
populate: ['lastPublishedDeployment']
|
||||||
populate: ['lastPublishedDeployment']
|
}),
|
||||||
})
|
|
||||||
.catch((err: any) => {
|
|
||||||
void toastError(
|
|
||||||
`Failed to fetch public project "${projectIdentifier}"`
|
|
||||||
)
|
|
||||||
throw err
|
|
||||||
}),
|
|
||||||
enabled: !!ctx
|
enabled: !!ctx
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue