@superinterface/server 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_btwyo7 +1 -1
- package/.next/fallback-build-manifest.json +2 -2
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/api/api-keys/[apiKeyId]/route.js +1 -1
- package/.next/server/app/api/api-keys/[apiKeyId]/route.js.nft.json +1 -1
- package/.next/server/app/api/api-keys/route.js +1 -1
- package/.next/server/app/api/api-keys/route.js.nft.json +1 -1
- package/.next/server/app/api/assistants/[assistantId]/functions/[functionId]/route.js +1 -1
- package/.next/server/app/api/assistants/[assistantId]/functions/[functionId]/route.js.nft.json +1 -1
- package/.next/server/app/api/assistants/[assistantId]/functions/route.js +1 -1
- package/.next/server/app/api/assistants/[assistantId]/functions/route.js.nft.json +1 -1
- package/.next/server/app/api/assistants/[assistantId]/initial-messages/route.js +1 -1
- package/.next/server/app/api/assistants/[assistantId]/initial-messages/route.js.nft.json +1 -1
- package/.next/server/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js +1 -1
- package/.next/server/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js.nft.json +1 -1
- package/.next/server/app/api/assistants/[assistantId]/mcp-servers/route.js +1 -1
- package/.next/server/app/api/assistants/[assistantId]/mcp-servers/route.js.nft.json +1 -1
- package/.next/server/app/api/assistants/[assistantId]/route.js +1 -1
- package/.next/server/app/api/assistants/[assistantId]/route.js.nft.json +1 -1
- package/.next/server/app/api/assistants/route.js +1 -1
- package/.next/server/app/api/assistants/route.js.nft.json +1 -1
- package/.next/server/app/api/files/[fileId]/contents/route.js +1 -1
- package/.next/server/app/api/files/[fileId]/contents/route.js.nft.json +1 -1
- package/.next/server/app/api/files/route.js +1 -1
- package/.next/server/app/api/files/route.js.nft.json +1 -1
- package/.next/server/app/api/messages/route.js +1 -1
- package/.next/server/app/api/messages/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/[modelProviderId]/assistants/route.js +1 -1
- package/.next/server/app/api/providers/[modelProviderId]/assistants/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/[modelProviderId]/models/route.js +1 -1
- package/.next/server/app/api/providers/[modelProviderId]/models/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/[modelProviderId]/route.js +1 -1
- package/.next/server/app/api/providers/[modelProviderId]/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/route.js +1 -1
- package/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/[taskId]/route.js +1 -1
- package/.next/server/app/api/tasks/[taskId]/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/callback/route.js +1 -1
- package/.next/server/app/api/tasks/callback/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js +1 -1
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/threads/runs/submit-client-tool-outputs/route.js +1 -1
- package/.next/server/app/api/threads/runs/submit-client-tool-outputs/route.js.nft.json +1 -1
- package/.next/server/app/api/workspaces/[workspaceId]/route.js +1 -1
- package/.next/server/app/api/workspaces/[workspaceId]/route.js.nft.json +1 -1
- package/.next/server/app/api/workspaces/route.js +1 -1
- package/.next/server/app/api/workspaces/route.js.nft.json +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__29635e8e._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__29635e8e._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__315f084a._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__315f084a._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__40ab45eb._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__40ab45eb._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__464a4377._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__464a4377._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__47b17fad._.js +38 -0
- package/.next/server/chunks/[root-of-the-server]__47b17fad._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__5abf1160._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__5abf1160._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__5d09614a._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__5d09614a._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__62d958e7._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__62d958e7._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__676affb1._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__676affb1._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__83461316._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__83461316._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__9a611d42._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__9a611d42._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__a878c913._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__a878c913._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__c1629392._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__c1629392._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__f6f61507._.js +38 -0
- package/.next/server/chunks/[root-of-the-server]__f6f61507._.js.map +1 -0
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js.map +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js.map +1 -1
- package/.next/server/functions-config-manifest.json +1 -8
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/trace +1 -1
- package/dist/app/api/api-keys/[apiKeyId]/buildRoute.d.ts +52 -0
- package/dist/app/api/api-keys/[apiKeyId]/buildRoute.d.ts.map +1 -0
- package/dist/app/api/api-keys/[apiKeyId]/buildRoute.js +121 -0
- package/dist/app/api/api-keys/[apiKeyId]/route.d.ts +10 -21
- package/dist/app/api/api-keys/[apiKeyId]/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/[apiKeyId]/route.js +6 -125
- package/dist/app/api/api-keys/buildRoute.d.ts +32 -0
- package/dist/app/api/api-keys/buildRoute.d.ts.map +1 -0
- package/dist/app/api/api-keys/buildRoute.js +104 -0
- package/dist/app/api/api-keys/builders.d.ts +31 -0
- package/dist/app/api/api-keys/builders.d.ts.map +1 -0
- package/dist/app/api/api-keys/builders.js +109 -0
- package/dist/app/api/api-keys/route.d.ts +5 -13
- package/dist/app/api/api-keys/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/route.js +8 -108
- package/dist/app/api/assistants/[assistantId]/buildRoute.d.ts +120 -0
- package/dist/app/api/assistants/[assistantId]/buildRoute.d.ts.map +1 -0
- package/dist/app/api/assistants/[assistantId]/buildRoute.js +226 -0
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/buildRoute.d.ts +167 -0
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/buildRoute.d.ts.map +1 -0
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/buildRoute.js +184 -0
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts +10 -21
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +6 -191
- package/dist/app/api/assistants/[assistantId]/functions/buildRoute.d.ts +114 -0
- package/dist/app/api/assistants/[assistantId]/functions/buildRoute.d.ts.map +1 -0
- package/dist/app/api/assistants/[assistantId]/functions/buildRoute.js +117 -0
- package/dist/app/api/assistants/[assistantId]/functions/route.d.ts +7 -15
- package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/route.js +5 -122
- package/dist/app/api/assistants/[assistantId]/initial-messages/buildRoute.d.ts +40 -0
- package/dist/app/api/assistants/[assistantId]/initial-messages/buildRoute.d.ts.map +1 -0
- package/dist/app/api/assistants/[assistantId]/initial-messages/buildRoute.js +85 -0
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts +7 -15
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +5 -90
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/buildRoute.d.ts +89 -0
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/buildRoute.d.ts.map +1 -0
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/buildRoute.js +167 -0
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts +10 -21
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js +6 -174
- package/dist/app/api/assistants/[assistantId]/mcp-servers/buildRoute.d.ts +62 -0
- package/dist/app/api/assistants/[assistantId]/mcp-servers/buildRoute.d.ts.map +1 -0
- package/dist/app/api/assistants/[assistantId]/mcp-servers/buildRoute.js +115 -0
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts +7 -15
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +5 -120
- package/dist/app/api/assistants/[assistantId]/route.d.ts +11 -22
- package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/route.js +6 -233
- package/dist/app/api/assistants/buildRoute.d.ts +121 -0
- package/dist/app/api/assistants/buildRoute.d.ts.map +1 -0
- package/dist/app/api/assistants/buildRoute.js +144 -0
- package/dist/app/api/assistants/route.d.ts +7 -13
- package/dist/app/api/assistants/route.d.ts.map +1 -1
- package/dist/app/api/assistants/route.js +6 -148
- package/dist/app/api/files/[fileId]/contents/buildRoute.d.ts +18 -0
- package/dist/app/api/files/[fileId]/contents/buildRoute.d.ts.map +1 -0
- package/dist/app/api/files/[fileId]/contents/buildRoute.js +81 -0
- package/dist/app/api/files/[fileId]/contents/route.d.ts +3 -13
- package/dist/app/api/files/[fileId]/contents/route.d.ts.map +1 -1
- package/dist/app/api/files/[fileId]/contents/route.js +4 -84
- package/dist/app/api/files/buildRoute.d.ts +14 -0
- package/dist/app/api/files/buildRoute.d.ts.map +1 -0
- package/dist/app/api/files/buildRoute.js +88 -0
- package/dist/app/api/files/route.d.ts +4 -10
- package/dist/app/api/files/route.d.ts.map +1 -1
- package/dist/app/api/files/route.js +4 -91
- package/dist/app/api/messages/buildRoute.d.ts +34 -0
- package/dist/app/api/messages/buildRoute.d.ts.map +1 -0
- package/dist/app/api/messages/buildRoute.js +607 -0
- package/dist/app/api/messages/lib/initialMessagesResponse.d.ts.map +1 -1
- package/dist/app/api/messages/lib/initialMessagesResponse.js +1 -1
- package/dist/app/api/messages/route.d.ts +10 -22
- package/dist/app/api/messages/route.d.ts.map +1 -1
- package/dist/app/api/messages/route.js +6 -612
- package/dist/app/api/providers/[modelProviderId]/assistants/buildRoute.d.ts +24 -0
- package/dist/app/api/providers/[modelProviderId]/assistants/buildRoute.d.ts.map +1 -0
- package/dist/app/api/providers/[modelProviderId]/assistants/buildRoute.js +43 -0
- package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts +4 -9
- package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/assistants/route.js +4 -46
- package/dist/app/api/providers/[modelProviderId]/buildRoute.d.ts +61 -0
- package/dist/app/api/providers/[modelProviderId]/buildRoute.d.ts.map +1 -0
- package/dist/app/api/providers/[modelProviderId]/buildRoute.js +134 -0
- package/dist/app/api/providers/[modelProviderId]/models/buildRoute.d.ts +19 -0
- package/dist/app/api/providers/[modelProviderId]/models/buildRoute.d.ts.map +1 -0
- package/dist/app/api/providers/[modelProviderId]/models/buildRoute.js +43 -0
- package/dist/app/api/providers/[modelProviderId]/models/route.d.ts +4 -9
- package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/models/route.js +4 -46
- package/dist/app/api/providers/[modelProviderId]/route.d.ts +10 -21
- package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/route.js +6 -141
- package/dist/app/api/providers/buildRoute.d.ts +38 -0
- package/dist/app/api/providers/buildRoute.d.ts.map +1 -0
- package/dist/app/api/providers/buildRoute.js +75 -0
- package/dist/app/api/providers/route.d.ts +5 -13
- package/dist/app/api/providers/route.d.ts.map +1 -1
- package/dist/app/api/providers/route.js +5 -80
- package/dist/app/api/tasks/[taskId]/buildRoute.d.ts +19 -0
- package/dist/app/api/tasks/[taskId]/buildRoute.d.ts.map +1 -0
- package/dist/app/api/tasks/[taskId]/buildRoute.js +125 -0
- package/dist/app/api/tasks/[taskId]/route.d.ts +7 -57
- package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
- package/dist/app/api/tasks/[taskId]/route.js +6 -144
- package/dist/app/api/tasks/buildRoute.d.ts +36 -0
- package/dist/app/api/tasks/buildRoute.d.ts.map +1 -0
- package/dist/app/api/tasks/buildRoute.js +85 -0
- package/dist/app/api/tasks/callback/buildRoute.d.ts +6 -0
- package/dist/app/api/tasks/callback/buildRoute.d.ts.map +1 -0
- package/dist/app/api/tasks/callback/buildRoute.js +244 -0
- package/dist/app/api/tasks/callback/route.d.ts +2 -1
- package/dist/app/api/tasks/callback/route.d.ts.map +1 -1
- package/dist/app/api/tasks/callback/route.js +4 -244
- package/dist/app/api/tasks/route.d.ts +5 -13
- package/dist/app/api/tasks/route.d.ts.map +1 -1
- package/dist/app/api/tasks/route.js +5 -90
- package/dist/app/api/threads/runs/submit-client-tool-outputs/buildRoute.d.ts +10 -0
- package/dist/app/api/threads/runs/submit-client-tool-outputs/buildRoute.d.ts.map +1 -0
- package/dist/app/api/threads/runs/submit-client-tool-outputs/buildRoute.js +36 -0
- package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts +2 -7
- package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts.map +1 -1
- package/dist/app/api/threads/runs/submit-client-tool-outputs/route.js +3 -37
- package/dist/app/api/workspaces/[workspaceId]/buildRoute.d.ts +16 -0
- package/dist/app/api/workspaces/[workspaceId]/buildRoute.d.ts.map +1 -0
- package/dist/app/api/workspaces/[workspaceId]/buildRoute.js +89 -0
- package/dist/app/api/workspaces/[workspaceId]/route.d.ts +5 -31
- package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/[workspaceId]/route.js +5 -89
- package/dist/app/api/workspaces/buildRoute.d.ts +42 -0
- package/dist/app/api/workspaces/buildRoute.d.ts.map +1 -0
- package/dist/app/api/workspaces/buildRoute.js +78 -0
- package/dist/app/api/workspaces/route.d.ts +7 -27
- package/dist/app/api/workspaces/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/route.js +6 -82
- package/dist/lib/functions/functionSchema.d.ts +56 -56
- package/dist/lib/functions/handleFunction/getFunction.d.ts +4 -4
- package/dist/lib/mcpServers/mcpServerSchema.d.ts +20 -20
- package/dist/lib/prisma/index.d.ts +1 -9
- package/dist/lib/prisma/index.d.ts.map +1 -1
- package/dist/lib/prisma/index.js +10 -78
- package/package.json +4 -12
- package/.next/server/chunks/[root-of-the-server]__228bff78._.js +0 -38
- package/.next/server/chunks/[root-of-the-server]__228bff78._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__3307123c._.js +0 -38
- package/.next/server/chunks/[root-of-the-server]__3307123c._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js +0 -38
- package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js +0 -38
- package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__e7819e95._.js +0 -38
- package/.next/server/chunks/[root-of-the-server]__e7819e95._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js +0 -38
- package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__ff90af03._.js +0 -38
- package/.next/server/chunks/[root-of-the-server]__ff90af03._.js.map +0 -1
- /package/.next/static/{jt8inwg6nWaLQZ4qpiSJ- → iaWEclnh6aHcuw0CBnWpA}/_buildManifest.js +0 -0
- /package/.next/static/{jt8inwg6nWaLQZ4qpiSJ- → iaWEclnh6aHcuw0CBnWpA}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{jt8inwg6nWaLQZ4qpiSJ- → iaWEclnh6aHcuw0CBnWpA}/_ssgManifest.js +0 -0
|
@@ -1,109 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { cacheHeaders } from '../../../lib/cache/cacheHeaders';
|
|
6
|
-
import { resolvePrisma } from '../../../lib/prisma';
|
|
7
|
-
import { serializeApiKey } from '../../../lib/apiKeys/serializeApiKey';
|
|
8
|
-
import { getApiKey } from '../../../lib/apiKeys/getApiKey';
|
|
9
|
-
import { getOrganizationApiKey } from '../../../lib/organizationApiKeys/getOrganizationApiKey';
|
|
10
|
-
export const buildGET = ({ prisma: providedPrisma } = {}) => async () => {
|
|
11
|
-
const prisma = resolvePrisma(providedPrisma);
|
|
12
|
-
const headersList = await headers();
|
|
13
|
-
const authorization = headersList.get('authorization');
|
|
14
|
-
if (!authorization) {
|
|
15
|
-
return NextResponse.json({ error: 'No authorization header found' }, { status: 400 });
|
|
16
|
-
}
|
|
17
|
-
const privateApiKey = await getApiKey({
|
|
18
|
-
type: ApiKeyType.PRIVATE,
|
|
19
|
-
authorization,
|
|
20
|
-
prisma,
|
|
21
|
-
});
|
|
22
|
-
if (!privateApiKey) {
|
|
23
|
-
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
24
|
-
}
|
|
25
|
-
const apiKeys = await prisma.apiKey.findMany({
|
|
26
|
-
where: {
|
|
27
|
-
type: ApiKeyType.PUBLIC,
|
|
28
|
-
workspaceId: privateApiKey.workspaceId,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
return NextResponse.json({
|
|
32
|
-
apiKeys: apiKeys.map((apiKey) => serializeApiKey({ apiKey })),
|
|
33
|
-
}, { headers: cacheHeaders });
|
|
34
|
-
};
|
|
35
|
-
export const GET = ((...args) => buildGET()(...args));
|
|
36
|
-
export const buildPOST = ({ prisma: providedPrisma } = {}) => async (request) => {
|
|
37
|
-
const prisma = resolvePrisma(providedPrisma);
|
|
38
|
-
const headersList = await headers();
|
|
39
|
-
const authorization = headersList.get('authorization');
|
|
40
|
-
if (!authorization) {
|
|
41
|
-
return NextResponse.json({ error: 'No authorization header found' }, { status: 400 });
|
|
42
|
-
}
|
|
43
|
-
const body = await request.json().catch(() => null);
|
|
44
|
-
const organizationApiKey = await getOrganizationApiKey({
|
|
45
|
-
authorization,
|
|
46
|
-
prisma,
|
|
47
|
-
});
|
|
48
|
-
if (organizationApiKey) {
|
|
49
|
-
const createSchemaOrganizationApiKey = z.object({
|
|
50
|
-
name: z.string().min(1).optional(),
|
|
51
|
-
type: z.nativeEnum(ApiKeyType),
|
|
52
|
-
workspaceId: z.string().min(1).optional(),
|
|
53
|
-
});
|
|
54
|
-
const parsedOrganizationApiKey = createSchemaOrganizationApiKey.safeParse(body);
|
|
55
|
-
if (!parsedOrganizationApiKey.success) {
|
|
56
|
-
return NextResponse.json({ error: 'Invalid body' }, { status: 400 });
|
|
57
|
-
}
|
|
58
|
-
const workspace = await prisma.workspace.findUnique({
|
|
59
|
-
where: {
|
|
60
|
-
id: parsedOrganizationApiKey.data.workspaceId,
|
|
61
|
-
organizationId: organizationApiKey.organizationId,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
if (!workspace) {
|
|
65
|
-
return NextResponse.json({ error: 'Invalid workspace' }, { status: 400 });
|
|
66
|
-
}
|
|
67
|
-
const apiKey = await prisma.apiKey.create({
|
|
68
|
-
data: {
|
|
69
|
-
type: parsedOrganizationApiKey.data.type,
|
|
70
|
-
name: parsedOrganizationApiKey.data.name,
|
|
71
|
-
workspaceId: workspace.id,
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
return NextResponse.json({
|
|
75
|
-
apiKey: serializeApiKey({ apiKey }),
|
|
76
|
-
}, { headers: cacheHeaders });
|
|
77
|
-
}
|
|
78
|
-
const privateApiKey = await getApiKey({
|
|
79
|
-
type: ApiKeyType.PRIVATE,
|
|
80
|
-
authorization,
|
|
81
|
-
prisma,
|
|
82
|
-
});
|
|
83
|
-
if (!privateApiKey) {
|
|
84
|
-
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
85
|
-
}
|
|
86
|
-
const createSchema = z.object({
|
|
87
|
-
name: z.string().min(1).optional(),
|
|
88
|
-
});
|
|
89
|
-
const parsed = createSchema.safeParse(body);
|
|
90
|
-
if (!parsed.success) {
|
|
91
|
-
return NextResponse.json({ error: 'Invalid body' }, { status: 400 });
|
|
92
|
-
}
|
|
93
|
-
const { name } = parsed.data;
|
|
94
|
-
const workspaceId = privateApiKey.workspaceId;
|
|
95
|
-
const apiKey = await prisma.apiKey.create({
|
|
96
|
-
data: {
|
|
97
|
-
type: ApiKeyType.PUBLIC,
|
|
98
|
-
name,
|
|
99
|
-
workspaceId,
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
return NextResponse.json({
|
|
103
|
-
apiKey: serializeApiKey({ apiKey }),
|
|
104
|
-
}, { headers: cacheHeaders });
|
|
105
|
-
};
|
|
106
|
-
export const POST = ((...args) => buildPOST()(...args));
|
|
107
|
-
export const OPTIONS = () => NextResponse.json({}, {
|
|
108
|
-
headers: cacheHeaders,
|
|
1
|
+
import { prisma } from '../../../lib/prisma';
|
|
2
|
+
import { buildGET, buildPOST, buildOPTIONS } from './buildRoute';
|
|
3
|
+
export const GET = buildGET({
|
|
4
|
+
prisma,
|
|
109
5
|
});
|
|
6
|
+
export const POST = buildPOST({
|
|
7
|
+
prisma,
|
|
8
|
+
});
|
|
9
|
+
export const OPTIONS = buildOPTIONS();
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { type NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { type PrismaClient } from '@prisma/client';
|
|
3
|
+
type RouteProps = {
|
|
4
|
+
params: Promise<{
|
|
5
|
+
assistantId: string;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
export declare const buildGET: ({ prisma }: {
|
|
9
|
+
prisma: PrismaClient;
|
|
10
|
+
}) => (request: NextRequest, props: RouteProps) => Promise<NextResponse<{
|
|
11
|
+
error: string;
|
|
12
|
+
}> | NextResponse<{
|
|
13
|
+
assistant: {
|
|
14
|
+
id: string;
|
|
15
|
+
storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
|
|
16
|
+
storageProviderAssistantId: string | null;
|
|
17
|
+
modelProviderId: string;
|
|
18
|
+
model: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
instructions: string;
|
|
22
|
+
codeInterpreterEnabled: boolean;
|
|
23
|
+
fileSearchEnabled: boolean;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
updatedAt: string;
|
|
26
|
+
avatar: {
|
|
27
|
+
type: import("@prisma/client").$Enums.AvatarType;
|
|
28
|
+
imageAvatar: {
|
|
29
|
+
url: string;
|
|
30
|
+
} | null;
|
|
31
|
+
iconAvatar: {
|
|
32
|
+
name: import("@prisma/client").$Enums.IconAvatarName;
|
|
33
|
+
} | null;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}> | NextResponse<{
|
|
37
|
+
assistant: {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
theme: {
|
|
42
|
+
accentColor: "gray" | "gold" | "bronze" | "brown" | "yellow" | "amber" | "orange" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "lime" | "mint" | "sky";
|
|
43
|
+
grayColor: "auto" | "gray" | "mauve" | "slate" | "sage" | "olive" | "sand";
|
|
44
|
+
appearance: "inherit" | "light" | "dark";
|
|
45
|
+
radius: "small" | "none" | "medium" | "large" | "full";
|
|
46
|
+
scaling: "90%" | "95%" | "100%" | "105%" | "110%";
|
|
47
|
+
panelBackground: "solid";
|
|
48
|
+
};
|
|
49
|
+
avatar: {
|
|
50
|
+
type: import("@prisma/client").$Enums.AvatarType;
|
|
51
|
+
imageAvatar: {
|
|
52
|
+
url: string;
|
|
53
|
+
} | null;
|
|
54
|
+
iconAvatar: {
|
|
55
|
+
name: import("@prisma/client").$Enums.IconAvatarName;
|
|
56
|
+
} | null;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
}>>;
|
|
60
|
+
export declare const buildPATCH: ({ prisma }: {
|
|
61
|
+
prisma: PrismaClient;
|
|
62
|
+
}) => (request: NextRequest, props: RouteProps) => Promise<NextResponse<{
|
|
63
|
+
error: string;
|
|
64
|
+
}> | NextResponse<{
|
|
65
|
+
assistant: {
|
|
66
|
+
id: string;
|
|
67
|
+
storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
|
|
68
|
+
storageProviderAssistantId: string | null;
|
|
69
|
+
modelProviderId: string;
|
|
70
|
+
model: string;
|
|
71
|
+
name: string;
|
|
72
|
+
description: string;
|
|
73
|
+
instructions: string;
|
|
74
|
+
codeInterpreterEnabled: boolean;
|
|
75
|
+
fileSearchEnabled: boolean;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
avatar: {
|
|
79
|
+
type: import("@prisma/client").$Enums.AvatarType;
|
|
80
|
+
imageAvatar: {
|
|
81
|
+
url: string;
|
|
82
|
+
} | null;
|
|
83
|
+
iconAvatar: {
|
|
84
|
+
name: import("@prisma/client").$Enums.IconAvatarName;
|
|
85
|
+
} | null;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}>>;
|
|
89
|
+
export declare const buildDELETE: ({ prisma }: {
|
|
90
|
+
prisma: PrismaClient;
|
|
91
|
+
}) => (_request: NextRequest, props: RouteProps) => Promise<NextResponse<{
|
|
92
|
+
error: string;
|
|
93
|
+
}> | NextResponse<{
|
|
94
|
+
assistant: {
|
|
95
|
+
id: string;
|
|
96
|
+
storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
|
|
97
|
+
storageProviderAssistantId: string | null;
|
|
98
|
+
modelProviderId: string;
|
|
99
|
+
model: string;
|
|
100
|
+
name: string;
|
|
101
|
+
description: string;
|
|
102
|
+
instructions: string;
|
|
103
|
+
codeInterpreterEnabled: boolean;
|
|
104
|
+
fileSearchEnabled: boolean;
|
|
105
|
+
createdAt: string;
|
|
106
|
+
updatedAt: string;
|
|
107
|
+
avatar: {
|
|
108
|
+
type: import("@prisma/client").$Enums.AvatarType;
|
|
109
|
+
imageAvatar: {
|
|
110
|
+
url: string;
|
|
111
|
+
} | null;
|
|
112
|
+
iconAvatar: {
|
|
113
|
+
name: import("@prisma/client").$Enums.IconAvatarName;
|
|
114
|
+
} | null;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}>>;
|
|
118
|
+
export declare const buildOPTIONS: () => () => NextResponse<{}>;
|
|
119
|
+
export {};
|
|
120
|
+
//# sourceMappingURL=buildRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildRoute.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/assistants/[assistantId]/buildRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AASvB,KAAK,UAAU,GAAG;IAChB,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH,CAAA;AAED,eAAO,MAAM,QAAQ,GAClB,YAAY;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,MAC9B,SAAS,WAAW,EAAE,OAAO,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2F7C,CAAA;AAEH,eAAO,MAAM,UAAU,GACpB,YAAY;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,MAC9B,SAAS,WAAW,EAAE,OAAO,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;GAqJ7C,CAAA;AAEH,eAAO,MAAM,WAAW,GACrB,YAAY;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,MAC9B,UAAU,WAAW,EAAE,OAAO,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;GAuD9C,CAAA;AAEH,eAAO,MAAM,YAAY,8BAMtB,CAAA"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
import { StorageProviderType, ApiKeyType, ToolType, } from '@prisma/client';
|
|
3
|
+
import { cacheHeaders } from '../../../../lib/cache/cacheHeaders';
|
|
4
|
+
import { workspaceAccessWhere as getWorkspaceAccessWhere } from '../../../../lib/apiKeys/workspaceAccessWhere';
|
|
5
|
+
import { serializeAssistant } from '../../../../lib/assistants/serializeAssistant';
|
|
6
|
+
import { serializeApiAssistant } from '../../../../lib/assistants/serializeApiAssistant';
|
|
7
|
+
import { headers } from 'next/headers';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { getApiKey } from '../../../../lib/apiKeys/getApiKey';
|
|
10
|
+
export const buildGET = ({ prisma }) => async (request, props) => {
|
|
11
|
+
const params = await props.params;
|
|
12
|
+
const { assistantId } = params;
|
|
13
|
+
const headersList = await headers();
|
|
14
|
+
const authorization = headersList.get('authorization');
|
|
15
|
+
if (authorization) {
|
|
16
|
+
const privateApiKey = await getApiKey({
|
|
17
|
+
authorization,
|
|
18
|
+
type: ApiKeyType.PRIVATE,
|
|
19
|
+
prisma,
|
|
20
|
+
});
|
|
21
|
+
if (!privateApiKey) {
|
|
22
|
+
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
23
|
+
}
|
|
24
|
+
const assistant = await prisma.assistant.findUnique({
|
|
25
|
+
where: {
|
|
26
|
+
id: assistantId,
|
|
27
|
+
workspaceId: privateApiKey.workspaceId,
|
|
28
|
+
},
|
|
29
|
+
include: {
|
|
30
|
+
tools: true,
|
|
31
|
+
avatar: {
|
|
32
|
+
include: {
|
|
33
|
+
imageAvatar: true,
|
|
34
|
+
iconAvatar: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
if (!assistant) {
|
|
40
|
+
return NextResponse.json({ error: 'No assistant found' }, { status: 400 });
|
|
41
|
+
}
|
|
42
|
+
return NextResponse.json({
|
|
43
|
+
assistant: serializeApiAssistant({ assistant }),
|
|
44
|
+
}, { headers: cacheHeaders });
|
|
45
|
+
}
|
|
46
|
+
const workspaceAccessWhere = await getWorkspaceAccessWhere({
|
|
47
|
+
publicApiKey: request.nextUrl.searchParams.get('publicApiKey'),
|
|
48
|
+
prisma,
|
|
49
|
+
});
|
|
50
|
+
if (!workspaceAccessWhere) {
|
|
51
|
+
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
52
|
+
}
|
|
53
|
+
if (!assistantId) {
|
|
54
|
+
return NextResponse.json({ error: 'No assistant id found' }, { status: 400 });
|
|
55
|
+
}
|
|
56
|
+
const assistant = await prisma.assistant.findFirst({
|
|
57
|
+
where: {
|
|
58
|
+
id: assistantId,
|
|
59
|
+
workspace: workspaceAccessWhere,
|
|
60
|
+
},
|
|
61
|
+
include: {
|
|
62
|
+
avatar: {
|
|
63
|
+
include: {
|
|
64
|
+
imageAvatar: true,
|
|
65
|
+
iconAvatar: true,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
if (!assistant) {
|
|
71
|
+
return NextResponse.json({ error: 'No assistant found' }, { status: 400 });
|
|
72
|
+
}
|
|
73
|
+
return NextResponse.json({
|
|
74
|
+
assistant: serializeAssistant({ assistant }),
|
|
75
|
+
}, { headers: cacheHeaders });
|
|
76
|
+
};
|
|
77
|
+
export const buildPATCH = ({ prisma }) => async (request, props) => {
|
|
78
|
+
const params = await props.params;
|
|
79
|
+
const { assistantId } = params;
|
|
80
|
+
const headersList = await headers();
|
|
81
|
+
const authorization = headersList.get('authorization');
|
|
82
|
+
if (!authorization) {
|
|
83
|
+
return NextResponse.json({ error: 'No authorization header found' }, { status: 400 });
|
|
84
|
+
}
|
|
85
|
+
const privateApiKey = await getApiKey({
|
|
86
|
+
authorization,
|
|
87
|
+
type: ApiKeyType.PRIVATE,
|
|
88
|
+
prisma,
|
|
89
|
+
});
|
|
90
|
+
if (!privateApiKey) {
|
|
91
|
+
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
92
|
+
}
|
|
93
|
+
const updateSchema = z
|
|
94
|
+
.object({
|
|
95
|
+
storageProviderType: z.nativeEnum(StorageProviderType).optional(),
|
|
96
|
+
storageProviderAssistantId: z.string().nullable().optional(),
|
|
97
|
+
modelProviderId: z.string().optional(),
|
|
98
|
+
model: z.string().optional(),
|
|
99
|
+
name: z.string().optional(),
|
|
100
|
+
description: z.string().optional(),
|
|
101
|
+
instructions: z.string().optional(),
|
|
102
|
+
codeInterpreterEnabled: z.boolean().optional(),
|
|
103
|
+
fileSearchEnabled: z.boolean().optional(),
|
|
104
|
+
})
|
|
105
|
+
.superRefine((data, ctx) => {
|
|
106
|
+
if (!data.storageProviderType)
|
|
107
|
+
return;
|
|
108
|
+
if (data.storageProviderType ===
|
|
109
|
+
StorageProviderType.SUPERINTERFACE_CLOUD &&
|
|
110
|
+
data.storageProviderAssistantId) {
|
|
111
|
+
ctx.addIssue({
|
|
112
|
+
code: z.ZodIssueCode.custom,
|
|
113
|
+
message: 'storageProviderAssistantId should not be provided for SUPERINTERFACE_CLOUD',
|
|
114
|
+
path: ['storageProviderAssistantId'],
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (data.storageProviderType !==
|
|
118
|
+
StorageProviderType.SUPERINTERFACE_CLOUD &&
|
|
119
|
+
!data.storageProviderAssistantId) {
|
|
120
|
+
ctx.addIssue({
|
|
121
|
+
code: z.ZodIssueCode.custom,
|
|
122
|
+
message: 'storageProviderAssistantId is required for this storage provider',
|
|
123
|
+
path: ['storageProviderAssistantId'],
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
const parseResult = updateSchema.safeParse(await request.json());
|
|
128
|
+
if (!parseResult.success) {
|
|
129
|
+
return NextResponse.json({
|
|
130
|
+
error: 'Invalid body: ' + parseResult.error.message,
|
|
131
|
+
}, { status: 400 });
|
|
132
|
+
}
|
|
133
|
+
const { storageProviderType, storageProviderAssistantId, modelProviderId, model, name, description, instructions, codeInterpreterEnabled, fileSearchEnabled, } = parseResult.data;
|
|
134
|
+
const data = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (storageProviderType !== undefined && { storageProviderType })), (storageProviderAssistantId !== undefined && {
|
|
135
|
+
openaiAssistantId: storageProviderAssistantId,
|
|
136
|
+
})), (modelProviderId !== undefined && {
|
|
137
|
+
modelProvider: { connect: { id: modelProviderId } },
|
|
138
|
+
})), (model !== undefined && { modelSlug: model })), (name !== undefined && { name })), (description !== undefined && { description })), (instructions !== undefined && { instructions })), { tools: {
|
|
139
|
+
create: [
|
|
140
|
+
...(codeInterpreterEnabled === true
|
|
141
|
+
? [
|
|
142
|
+
{
|
|
143
|
+
type: ToolType.CODE_INTERPRETER,
|
|
144
|
+
codeInterpreterTool: { create: {} },
|
|
145
|
+
},
|
|
146
|
+
]
|
|
147
|
+
: []),
|
|
148
|
+
...(fileSearchEnabled === true
|
|
149
|
+
? [{ type: ToolType.FILE_SEARCH, fileSearchTool: { create: {} } }]
|
|
150
|
+
: []),
|
|
151
|
+
],
|
|
152
|
+
deleteMany: [
|
|
153
|
+
...(codeInterpreterEnabled === false
|
|
154
|
+
? [{ assistantId, type: ToolType.CODE_INTERPRETER }]
|
|
155
|
+
: []),
|
|
156
|
+
...(fileSearchEnabled === false
|
|
157
|
+
? [{ assistantId, type: ToolType.FILE_SEARCH }]
|
|
158
|
+
: []),
|
|
159
|
+
],
|
|
160
|
+
} });
|
|
161
|
+
const assistant = await prisma.assistant.update({
|
|
162
|
+
where: {
|
|
163
|
+
id: assistantId,
|
|
164
|
+
workspaceId: privateApiKey.workspaceId,
|
|
165
|
+
},
|
|
166
|
+
data,
|
|
167
|
+
include: {
|
|
168
|
+
tools: true,
|
|
169
|
+
avatar: {
|
|
170
|
+
include: {
|
|
171
|
+
imageAvatar: true,
|
|
172
|
+
iconAvatar: true,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
return NextResponse.json({
|
|
178
|
+
assistant: serializeApiAssistant({ assistant }),
|
|
179
|
+
}, { headers: cacheHeaders });
|
|
180
|
+
};
|
|
181
|
+
export const buildDELETE = ({ prisma }) => async (_request, props) => {
|
|
182
|
+
const params = await props.params;
|
|
183
|
+
const { assistantId } = params;
|
|
184
|
+
const headersList = await headers();
|
|
185
|
+
const authorization = headersList.get('authorization');
|
|
186
|
+
if (!authorization) {
|
|
187
|
+
return NextResponse.json({ error: 'No authorization header found' }, { status: 400 });
|
|
188
|
+
}
|
|
189
|
+
const privateApiKey = await getApiKey({
|
|
190
|
+
authorization,
|
|
191
|
+
type: ApiKeyType.PRIVATE,
|
|
192
|
+
prisma,
|
|
193
|
+
});
|
|
194
|
+
if (!privateApiKey) {
|
|
195
|
+
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
196
|
+
}
|
|
197
|
+
const assistant = await prisma.assistant.findFirst({
|
|
198
|
+
where: {
|
|
199
|
+
id: assistantId,
|
|
200
|
+
workspaceId: privateApiKey.workspaceId,
|
|
201
|
+
},
|
|
202
|
+
include: {
|
|
203
|
+
tools: true,
|
|
204
|
+
avatar: {
|
|
205
|
+
include: {
|
|
206
|
+
imageAvatar: true,
|
|
207
|
+
iconAvatar: true,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
if (!assistant) {
|
|
213
|
+
return NextResponse.json({ error: 'No assistant found' }, { status: 400 });
|
|
214
|
+
}
|
|
215
|
+
await prisma.assistant.delete({
|
|
216
|
+
where: {
|
|
217
|
+
id: assistant.id,
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
return NextResponse.json({
|
|
221
|
+
assistant: serializeApiAssistant({ assistant }),
|
|
222
|
+
}, { headers: cacheHeaders });
|
|
223
|
+
};
|
|
224
|
+
export const buildOPTIONS = () => () => NextResponse.json({}, {
|
|
225
|
+
headers: cacheHeaders,
|
|
226
|
+
});
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { type PrismaClient } from '@prisma/client';
|
|
2
|
+
import { NextResponse, type NextRequest } from 'next/server';
|
|
3
|
+
type RouteProps = {
|
|
4
|
+
params: Promise<{
|
|
5
|
+
assistantId: string;
|
|
6
|
+
functionId: string;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
export declare const buildGET: ({ prisma }: {
|
|
10
|
+
prisma: PrismaClient;
|
|
11
|
+
}) => (_request: NextRequest, props: RouteProps) => Promise<NextResponse<{
|
|
12
|
+
error: string;
|
|
13
|
+
}> | NextResponse<{
|
|
14
|
+
function: {
|
|
15
|
+
id: string;
|
|
16
|
+
openapiSpec: PrismaJson.OpenapiSpec;
|
|
17
|
+
handler: {
|
|
18
|
+
deleteTaskHandler?: {
|
|
19
|
+
keyTemplate: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
updateTaskHandler?: {
|
|
22
|
+
keyTemplate: string;
|
|
23
|
+
} | undefined;
|
|
24
|
+
createTaskHandler?: {
|
|
25
|
+
keyTemplate: string;
|
|
26
|
+
} | undefined;
|
|
27
|
+
listTasksHandler?: {
|
|
28
|
+
keyTemplate: string;
|
|
29
|
+
} | undefined;
|
|
30
|
+
assistantHandler?: {
|
|
31
|
+
assistantId: string;
|
|
32
|
+
} | undefined;
|
|
33
|
+
clientToolHandler?: {
|
|
34
|
+
type: "FUNCTION";
|
|
35
|
+
name: string;
|
|
36
|
+
arguments: PrismaJson.ClientToolHandlerArguments;
|
|
37
|
+
} | undefined;
|
|
38
|
+
replicateHandler?: {
|
|
39
|
+
type: "RUN";
|
|
40
|
+
apiKey: string;
|
|
41
|
+
identifier: string;
|
|
42
|
+
body: PrismaJson.ReplicateHandlerBody;
|
|
43
|
+
} | undefined;
|
|
44
|
+
firecrawlHandler?: {
|
|
45
|
+
type: import("@prisma/client").$Enums.FirecrawlHandlerType;
|
|
46
|
+
apiKey: string;
|
|
47
|
+
body: PrismaJson.FirecrawlHandlerBody;
|
|
48
|
+
} | undefined;
|
|
49
|
+
requestHandler?: {
|
|
50
|
+
url: string;
|
|
51
|
+
method: import("@prisma/client").$Enums.MethodType;
|
|
52
|
+
headers: PrismaJson.RequestHandlerHeaders;
|
|
53
|
+
body: PrismaJson.RequestHandlerBody;
|
|
54
|
+
} | undefined;
|
|
55
|
+
type: import("@prisma/client").$Enums.HandlerType;
|
|
56
|
+
};
|
|
57
|
+
createdAt: string;
|
|
58
|
+
updatedAt: string;
|
|
59
|
+
};
|
|
60
|
+
}>>;
|
|
61
|
+
export declare const buildPATCH: ({ prisma }: {
|
|
62
|
+
prisma: PrismaClient;
|
|
63
|
+
}) => (request: NextRequest, props: RouteProps) => Promise<NextResponse<{
|
|
64
|
+
error: string;
|
|
65
|
+
}> | NextResponse<{
|
|
66
|
+
function: {
|
|
67
|
+
id: string;
|
|
68
|
+
openapiSpec: PrismaJson.OpenapiSpec;
|
|
69
|
+
handler: {
|
|
70
|
+
deleteTaskHandler?: {
|
|
71
|
+
keyTemplate: string;
|
|
72
|
+
} | undefined;
|
|
73
|
+
updateTaskHandler?: {
|
|
74
|
+
keyTemplate: string;
|
|
75
|
+
} | undefined;
|
|
76
|
+
createTaskHandler?: {
|
|
77
|
+
keyTemplate: string;
|
|
78
|
+
} | undefined;
|
|
79
|
+
listTasksHandler?: {
|
|
80
|
+
keyTemplate: string;
|
|
81
|
+
} | undefined;
|
|
82
|
+
assistantHandler?: {
|
|
83
|
+
assistantId: string;
|
|
84
|
+
} | undefined;
|
|
85
|
+
clientToolHandler?: {
|
|
86
|
+
type: "FUNCTION";
|
|
87
|
+
name: string;
|
|
88
|
+
arguments: PrismaJson.ClientToolHandlerArguments;
|
|
89
|
+
} | undefined;
|
|
90
|
+
replicateHandler?: {
|
|
91
|
+
type: "RUN";
|
|
92
|
+
apiKey: string;
|
|
93
|
+
identifier: string;
|
|
94
|
+
body: PrismaJson.ReplicateHandlerBody;
|
|
95
|
+
} | undefined;
|
|
96
|
+
firecrawlHandler?: {
|
|
97
|
+
type: import("@prisma/client").$Enums.FirecrawlHandlerType;
|
|
98
|
+
apiKey: string;
|
|
99
|
+
body: PrismaJson.FirecrawlHandlerBody;
|
|
100
|
+
} | undefined;
|
|
101
|
+
requestHandler?: {
|
|
102
|
+
url: string;
|
|
103
|
+
method: import("@prisma/client").$Enums.MethodType;
|
|
104
|
+
headers: PrismaJson.RequestHandlerHeaders;
|
|
105
|
+
body: PrismaJson.RequestHandlerBody;
|
|
106
|
+
} | undefined;
|
|
107
|
+
type: import("@prisma/client").$Enums.HandlerType;
|
|
108
|
+
};
|
|
109
|
+
createdAt: string;
|
|
110
|
+
updatedAt: string;
|
|
111
|
+
};
|
|
112
|
+
}>>;
|
|
113
|
+
export declare const buildDELETE: ({ prisma }: {
|
|
114
|
+
prisma: PrismaClient;
|
|
115
|
+
}) => (_request: NextRequest, props: RouteProps) => Promise<NextResponse<{
|
|
116
|
+
error: string;
|
|
117
|
+
}> | NextResponse<{
|
|
118
|
+
mcpServer: {
|
|
119
|
+
id: string;
|
|
120
|
+
openapiSpec: PrismaJson.OpenapiSpec;
|
|
121
|
+
handler: {
|
|
122
|
+
deleteTaskHandler?: {
|
|
123
|
+
keyTemplate: string;
|
|
124
|
+
} | undefined;
|
|
125
|
+
updateTaskHandler?: {
|
|
126
|
+
keyTemplate: string;
|
|
127
|
+
} | undefined;
|
|
128
|
+
createTaskHandler?: {
|
|
129
|
+
keyTemplate: string;
|
|
130
|
+
} | undefined;
|
|
131
|
+
listTasksHandler?: {
|
|
132
|
+
keyTemplate: string;
|
|
133
|
+
} | undefined;
|
|
134
|
+
assistantHandler?: {
|
|
135
|
+
assistantId: string;
|
|
136
|
+
} | undefined;
|
|
137
|
+
clientToolHandler?: {
|
|
138
|
+
type: "FUNCTION";
|
|
139
|
+
name: string;
|
|
140
|
+
arguments: PrismaJson.ClientToolHandlerArguments;
|
|
141
|
+
} | undefined;
|
|
142
|
+
replicateHandler?: {
|
|
143
|
+
type: "RUN";
|
|
144
|
+
apiKey: string;
|
|
145
|
+
identifier: string;
|
|
146
|
+
body: PrismaJson.ReplicateHandlerBody;
|
|
147
|
+
} | undefined;
|
|
148
|
+
firecrawlHandler?: {
|
|
149
|
+
type: import("@prisma/client").$Enums.FirecrawlHandlerType;
|
|
150
|
+
apiKey: string;
|
|
151
|
+
body: PrismaJson.FirecrawlHandlerBody;
|
|
152
|
+
} | undefined;
|
|
153
|
+
requestHandler?: {
|
|
154
|
+
url: string;
|
|
155
|
+
method: import("@prisma/client").$Enums.MethodType;
|
|
156
|
+
headers: PrismaJson.RequestHandlerHeaders;
|
|
157
|
+
body: PrismaJson.RequestHandlerBody;
|
|
158
|
+
} | undefined;
|
|
159
|
+
type: import("@prisma/client").$Enums.HandlerType;
|
|
160
|
+
};
|
|
161
|
+
createdAt: string;
|
|
162
|
+
updatedAt: string;
|
|
163
|
+
};
|
|
164
|
+
}>>;
|
|
165
|
+
export declare const buildOPTIONS: () => () => NextResponse<{}>;
|
|
166
|
+
export {};
|
|
167
|
+
//# sourceMappingURL=buildRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildRoute.d.ts","sourceRoot":"","sources":["../../../../../../../src/app/api/assistants/[assistantId]/functions/[functionId]/buildRoute.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAQ5D,KAAK,UAAU,GAAG;IAChB,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7D,CAAA;AA0BD,eAAO,MAAM,QAAQ,GAClB,YAAY;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,MAC9B,UAAU,WAAW,EAAE,OAAO,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4D9C,CAAA;AAEH,eAAO,MAAM,UAAU,GACpB,YAAY;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,MAC9B,SAAS,WAAW,EAAE,OAAO,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6E7C,CAAA;AAEH,eAAO,MAAM,WAAW,GACrB,YAAY;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,MAC9B,UAAU,WAAW,EAAE,OAAO,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgE9C,CAAA;AAEH,eAAO,MAAM,YAAY,8BAMtB,CAAA"}
|