@superinterface/server 1.0.17 → 1.0.19
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/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 +3 -3
- package/.next/server/app/api/messages/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]__13c6bd62._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__13c6bd62._.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]__27aadac9._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__27aadac9._.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]__29b43490._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__29b43490._.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]__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]__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]__51977f30._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__51977f30._.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]__7f9ca1e3._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.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]__a135e388._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__a135e388._.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]__b9a334c3._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__b9a334c3._.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]__dd176cb5._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__dd176cb5._.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]__ed6cf593._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__ed6cf593._.js.map +1 -1
- package/.next/server/chunks/{[root-of-the-server]__30845206._.js → [root-of-the-server]__ff90af03._.js} +3 -3
- package/.next/server/chunks/{[root-of-the-server]__30845206._.js.map → [root-of-the-server]__ff90af03._.js.map} +1 -1
- 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/chunks/supercorp_superinterface_bebd2c96._.js +2 -2
- package/.next/server/chunks/supercorp_superinterface_bebd2c96._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/trace +1 -1
- package/bin/index.cjs +2 -0
- package/dist/app/api/api-keys/[apiKeyId]/route.d.ts +55 -0
- package/dist/app/api/api-keys/[apiKeyId]/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/[apiKeyId]/route.js +10 -4
- package/dist/app/api/api-keys/route.d.ts +29 -0
- package/dist/app/api/api-keys/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/route.js +8 -3
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts +172 -0
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +11 -4
- package/dist/app/api/assistants/[assistantId]/functions/route.d.ts +113 -0
- package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/route.js +8 -3
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts +39 -0
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +8 -3
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts +94 -0
- 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 +10 -4
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts +61 -0
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +7 -3
- package/dist/app/api/assistants/[assistantId]/route.d.ts +123 -0
- package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/route.js +15 -6
- package/dist/app/api/assistants/route.d.ts +59 -0
- package/dist/app/api/assistants/route.d.ts.map +1 -1
- package/dist/app/api/assistants/route.js +8 -4
- package/dist/app/api/files/[fileId]/contents/route.d.ts +3 -2
- package/dist/app/api/files/[fileId]/contents/route.d.ts.map +1 -1
- package/dist/app/api/files/[fileId]/contents/route.js +6 -3
- package/dist/app/api/files/route.d.ts +10 -0
- package/dist/app/api/files/route.d.ts.map +1 -1
- package/dist/app/api/files/route.js +7 -3
- package/dist/app/api/messages/route.d.ts +24 -1
- package/dist/app/api/messages/route.d.ts.map +1 -1
- package/dist/app/api/messages/route.js +27 -6
- package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts +19 -0
- package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/assistants/route.js +4 -2
- package/dist/app/api/providers/[modelProviderId]/models/route.d.ts +14 -0
- package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/models/route.js +4 -2
- package/dist/app/api/providers/[modelProviderId]/route.d.ts +64 -0
- package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/route.js +12 -6
- package/dist/app/api/providers/route.d.ts +35 -0
- package/dist/app/api/providers/route.d.ts.map +1 -1
- package/dist/app/api/providers/route.js +9 -5
- package/dist/app/api/tasks/[taskId]/route.d.ts +61 -0
- package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
- package/dist/app/api/tasks/[taskId]/route.js +11 -5
- package/dist/app/api/tasks/callback/route.d.ts.map +1 -1
- package/dist/app/api/tasks/callback/route.js +14 -6
- package/dist/app/api/tasks/route.d.ts +33 -0
- package/dist/app/api/tasks/route.d.ts.map +1 -1
- package/dist/app/api/tasks/route.js +8 -4
- package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts +9 -1
- 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 +5 -3
- package/dist/app/api/workspaces/[workspaceId]/route.d.ts +33 -0
- package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/[workspaceId]/route.js +7 -3
- package/dist/app/api/workspaces/route.d.ts +17 -3
- package/dist/app/api/workspaces/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/route.js +8 -4
- package/dist/lib/apiKeys/getApiKey.d.ts +3 -2
- package/dist/lib/apiKeys/getApiKey.d.ts.map +1 -1
- package/dist/lib/apiKeys/getApiKey.js +1 -2
- package/dist/lib/apiKeys/workspaceAccessWhere.d.ts +3 -1
- package/dist/lib/apiKeys/workspaceAccessWhere.d.ts.map +1 -1
- package/dist/lib/apiKeys/workspaceAccessWhere.js +2 -1
- package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.d.ts +3 -2
- package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.d.ts.map +1 -1
- package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.js +3 -3
- package/dist/lib/assistants/assistantClientAdapter/index.d.ts.map +1 -1
- package/dist/lib/assistants/assistantClientAdapter/index.js +7 -2
- package/dist/lib/computerCalls/handleComputerCall/index.d.ts +3 -2
- package/dist/lib/computerCalls/handleComputerCall/index.d.ts.map +1 -1
- package/dist/lib/computerCalls/handleComputerCall/index.js +5 -1
- package/dist/lib/functions/createFunction.d.ts +2 -1
- package/dist/lib/functions/createFunction.d.ts.map +1 -1
- package/dist/lib/functions/createFunction.js +2 -2
- package/dist/lib/functions/handleFunction/handleAssistant.d.ts +3 -2
- package/dist/lib/functions/handleFunction/handleAssistant.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleAssistant.js +12 -2
- package/dist/lib/functions/handleFunction/handleClientTool.d.ts +3 -2
- package/dist/lib/functions/handleFunction/handleClientTool.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleClientTool.js +2 -1
- package/dist/lib/functions/handleFunction/handleFirecrawl.d.ts +3 -2
- package/dist/lib/functions/handleFunction/handleFirecrawl.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleFirecrawl.js +7 -1
- package/dist/lib/functions/handleFunction/handleReplicate.d.ts +3 -2
- package/dist/lib/functions/handleFunction/handleReplicate.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleReplicate.js +4 -1
- package/dist/lib/functions/handleFunction/handleRequest.d.ts +3 -2
- package/dist/lib/functions/handleFunction/handleRequest.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleRequest.js +6 -1
- package/dist/lib/functions/handleFunction/index.d.ts +3 -2
- package/dist/lib/functions/handleFunction/index.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/index.js +25 -1
- package/dist/lib/functions/handleFunction/tasks/handleCreateTask.d.ts +3 -2
- package/dist/lib/functions/handleFunction/tasks/handleCreateTask.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/tasks/handleCreateTask.js +4 -4
- package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.d.ts +3 -2
- package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.js +3 -3
- package/dist/lib/functions/handleFunction/tasks/handleListTasks.d.ts +3 -2
- package/dist/lib/functions/handleFunction/tasks/handleListTasks.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/tasks/handleListTasks.js +3 -3
- package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.d.ts +3 -2
- package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.js +4 -4
- package/dist/lib/functions/updateFunction.d.ts +2 -1
- package/dist/lib/functions/updateFunction.d.ts.map +1 -1
- package/dist/lib/functions/updateFunction.js +2 -2
- package/dist/lib/handlers/handlerPrismaInput.d.ts +3 -1
- package/dist/lib/handlers/handlerPrismaInput.d.ts.map +1 -1
- package/dist/lib/handlers/handlerPrismaInput.jsx +1 -2
- package/dist/lib/initialMessages/updateInitialMessages.d.ts +3 -2
- package/dist/lib/initialMessages/updateInitialMessages.d.ts.map +1 -1
- package/dist/lib/initialMessages/updateInitialMessages.js +1 -2
- package/dist/lib/logs/createLog.d.ts +3 -2
- package/dist/lib/logs/createLog.d.ts.map +1 -1
- package/dist/lib/logs/createLog.js +1 -2
- package/dist/lib/mcpServers/connectMcpServer.d.ts +6 -4
- package/dist/lib/mcpServers/connectMcpServer.d.ts.map +1 -1
- package/dist/lib/mcpServers/connectMcpServer.js +7 -5
- package/dist/lib/mcpServers/getToolCallMcpServer.d.ts +3 -2
- package/dist/lib/mcpServers/getToolCallMcpServer.d.ts.map +1 -1
- package/dist/lib/mcpServers/getToolCallMcpServer.js +2 -1
- package/dist/lib/mcpServers/headers.d.ts +3 -2
- package/dist/lib/mcpServers/headers.d.ts.map +1 -1
- package/dist/lib/mcpServers/headers.js +2 -1
- package/dist/lib/mcpServers/url.d.ts +3 -2
- package/dist/lib/mcpServers/url.d.ts.map +1 -1
- package/dist/lib/mcpServers/url.js +2 -1
- package/dist/lib/metadata/serializeMetadata.d.ts +3 -1
- package/dist/lib/metadata/serializeMetadata.d.ts.map +1 -1
- package/dist/lib/metadata/serializeMetadata.js +3 -2
- package/dist/lib/organizationApiKeys/getOrganizationApiKey.d.ts +3 -2
- package/dist/lib/organizationApiKeys/getOrganizationApiKey.d.ts.map +1 -1
- package/dist/lib/organizationApiKeys/getOrganizationApiKey.js +1 -2
- package/dist/lib/runs/createRunOpts.d.ts +3 -2
- package/dist/lib/runs/createRunOpts.d.ts.map +1 -1
- package/dist/lib/runs/createRunOpts.js +2 -2
- package/dist/lib/tasks/getTaskToolKey.d.ts +3 -2
- package/dist/lib/tasks/getTaskToolKey.d.ts.map +1 -1
- package/dist/lib/tasks/getTaskToolKey.js +2 -1
- package/dist/lib/tasks/parseTaskToolArgs.d.ts +3 -2
- package/dist/lib/tasks/parseTaskToolArgs.d.ts.map +1 -1
- package/dist/lib/tasks/parseTaskToolArgs.js +4 -1
- package/dist/lib/tasks/scheduleTask.d.ts +3 -2
- package/dist/lib/tasks/scheduleTask.d.ts.map +1 -1
- package/dist/lib/tasks/scheduleTask.js +1 -2
- package/dist/lib/threads/createThread/index.d.ts +3 -3
- package/dist/lib/threads/createThread/index.d.ts.map +1 -1
- package/dist/lib/threads/createThread/index.js +1 -0
- package/dist/lib/threads/managedOpenaiThreadId.d.ts +3 -2
- package/dist/lib/threads/managedOpenaiThreadId.d.ts.map +1 -1
- package/dist/lib/threads/managedOpenaiThreadId.js +1 -2
- package/dist/lib/toolCalls/handleToolCall.d.ts +3 -2
- package/dist/lib/toolCalls/handleToolCall.d.ts.map +1 -1
- package/dist/lib/toolCalls/handleToolCall.js +5 -1
- package/dist/lib/tools/tools/index.d.ts +3 -2
- package/dist/lib/tools/tools/index.d.ts.map +1 -1
- package/dist/lib/tools/tools/index.js +9 -6
- package/package.json +2 -2
- package/scripts/utils/loadPrisma.ts +1 -2
- /package/.next/static/{kvFNeiykUJqaQCo-lW8D0 → rEvucoSBXJWMKfLWTgPF2}/_buildManifest.js +0 -0
- /package/.next/static/{kvFNeiykUJqaQCo-lW8D0 → rEvucoSBXJWMKfLWTgPF2}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{kvFNeiykUJqaQCo-lW8D0 → rEvucoSBXJWMKfLWTgPF2}/_ssgManifest.js +0 -0
|
@@ -2,11 +2,11 @@ import { NextResponse } from 'next/server';
|
|
|
2
2
|
import { ApiKeyType, TransportType } from '@prisma/client';
|
|
3
3
|
import { headers } from 'next/headers';
|
|
4
4
|
import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import { prisma } from '../../../../../lib/prisma';
|
|
5
|
+
import { prisma as defaultPrisma } from '../../../../../lib/prisma';
|
|
6
6
|
import { getApiKey } from '../../../../../lib/apiKeys/getApiKey';
|
|
7
7
|
import { serializeApiMcpServer } from '../../../../../lib/mcpServers/serializeApiMcpServer';
|
|
8
8
|
import { mcpServerSchema } from '../../../../../lib/mcpServers/mcpServerSchema';
|
|
9
|
-
export const
|
|
9
|
+
export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, props) => {
|
|
10
10
|
const { assistantId } = await props.params;
|
|
11
11
|
const headersList = await headers();
|
|
12
12
|
const authorization = headersList.get('authorization');
|
|
@@ -16,6 +16,7 @@ export const GET = async (_request, props) => {
|
|
|
16
16
|
const privateApiKey = await getApiKey({
|
|
17
17
|
type: ApiKeyType.PRIVATE,
|
|
18
18
|
authorization,
|
|
19
|
+
prisma,
|
|
19
20
|
});
|
|
20
21
|
if (!privateApiKey) {
|
|
21
22
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -47,7 +48,8 @@ export const GET = async (_request, props) => {
|
|
|
47
48
|
})),
|
|
48
49
|
}, { headers: cacheHeaders });
|
|
49
50
|
};
|
|
50
|
-
export const
|
|
51
|
+
export const GET = buildGET();
|
|
52
|
+
export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
|
|
51
53
|
const { assistantId } = await props.params;
|
|
52
54
|
const headersList = await headers();
|
|
53
55
|
const authorization = headersList.get('authorization');
|
|
@@ -57,6 +59,7 @@ export const POST = async (request, props) => {
|
|
|
57
59
|
const privateApiKey = await getApiKey({
|
|
58
60
|
authorization,
|
|
59
61
|
type: ApiKeyType.PRIVATE,
|
|
62
|
+
prisma,
|
|
60
63
|
});
|
|
61
64
|
if (!privateApiKey) {
|
|
62
65
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -109,6 +112,7 @@ export const POST = async (request, props) => {
|
|
|
109
112
|
mcpServer: serializeApiMcpServer({ mcpServer }),
|
|
110
113
|
}, { headers: cacheHeaders });
|
|
111
114
|
};
|
|
115
|
+
export const POST = buildPOST();
|
|
112
116
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
113
117
|
headers: cacheHeaders,
|
|
114
118
|
});
|
|
@@ -1,4 +1,61 @@
|
|
|
1
1
|
import { type NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const buildGET: ({ prisma }?: {
|
|
4
|
+
prisma?: PrismaClient;
|
|
5
|
+
}) => (request: NextRequest, props: {
|
|
6
|
+
params: Promise<{
|
|
7
|
+
assistantId: string;
|
|
8
|
+
}>;
|
|
9
|
+
}) => Promise<NextResponse<{
|
|
10
|
+
error: string;
|
|
11
|
+
}> | NextResponse<{
|
|
12
|
+
assistant: {
|
|
13
|
+
id: string;
|
|
14
|
+
storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
|
|
15
|
+
storageProviderAssistantId: string | null;
|
|
16
|
+
modelProviderId: string;
|
|
17
|
+
model: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
instructions: string;
|
|
21
|
+
codeInterpreterEnabled: boolean;
|
|
22
|
+
fileSearchEnabled: boolean;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
avatar: {
|
|
26
|
+
type: import("@prisma/client").$Enums.AvatarType;
|
|
27
|
+
imageAvatar: {
|
|
28
|
+
url: string;
|
|
29
|
+
} | null;
|
|
30
|
+
iconAvatar: {
|
|
31
|
+
name: import("@prisma/client").$Enums.IconAvatarName;
|
|
32
|
+
} | null;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}> | NextResponse<{
|
|
36
|
+
assistant: {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
theme: {
|
|
41
|
+
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";
|
|
42
|
+
grayColor: "auto" | "gray" | "mauve" | "slate" | "sage" | "olive" | "sand";
|
|
43
|
+
appearance: "inherit" | "light" | "dark";
|
|
44
|
+
radius: "small" | "none" | "medium" | "large" | "full";
|
|
45
|
+
scaling: "90%" | "95%" | "100%" | "105%" | "110%";
|
|
46
|
+
panelBackground: "solid";
|
|
47
|
+
};
|
|
48
|
+
avatar: {
|
|
49
|
+
type: import("@prisma/client").$Enums.AvatarType;
|
|
50
|
+
imageAvatar: {
|
|
51
|
+
url: string;
|
|
52
|
+
} | null;
|
|
53
|
+
iconAvatar: {
|
|
54
|
+
name: import("@prisma/client").$Enums.IconAvatarName;
|
|
55
|
+
} | null;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}>>;
|
|
2
59
|
export declare const GET: (request: NextRequest, props: {
|
|
3
60
|
params: Promise<{
|
|
4
61
|
assistantId: string;
|
|
@@ -53,6 +110,39 @@ export declare const GET: (request: NextRequest, props: {
|
|
|
53
110
|
};
|
|
54
111
|
};
|
|
55
112
|
}>>;
|
|
113
|
+
export declare const buildPATCH: ({ prisma }?: {
|
|
114
|
+
prisma?: PrismaClient;
|
|
115
|
+
}) => (request: NextRequest, props: {
|
|
116
|
+
params: Promise<{
|
|
117
|
+
assistantId: string;
|
|
118
|
+
}>;
|
|
119
|
+
}) => Promise<NextResponse<{
|
|
120
|
+
error: string;
|
|
121
|
+
}> | NextResponse<{
|
|
122
|
+
assistant: {
|
|
123
|
+
id: string;
|
|
124
|
+
storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
|
|
125
|
+
storageProviderAssistantId: string | null;
|
|
126
|
+
modelProviderId: string;
|
|
127
|
+
model: string;
|
|
128
|
+
name: string;
|
|
129
|
+
description: string;
|
|
130
|
+
instructions: string;
|
|
131
|
+
codeInterpreterEnabled: boolean;
|
|
132
|
+
fileSearchEnabled: boolean;
|
|
133
|
+
createdAt: string;
|
|
134
|
+
updatedAt: string;
|
|
135
|
+
avatar: {
|
|
136
|
+
type: import("@prisma/client").$Enums.AvatarType;
|
|
137
|
+
imageAvatar: {
|
|
138
|
+
url: string;
|
|
139
|
+
} | null;
|
|
140
|
+
iconAvatar: {
|
|
141
|
+
name: import("@prisma/client").$Enums.IconAvatarName;
|
|
142
|
+
} | null;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
}>>;
|
|
56
146
|
export declare const PATCH: (request: NextRequest, props: {
|
|
57
147
|
params: Promise<{
|
|
58
148
|
assistantId: string;
|
|
@@ -84,6 +174,39 @@ export declare const PATCH: (request: NextRequest, props: {
|
|
|
84
174
|
};
|
|
85
175
|
};
|
|
86
176
|
}>>;
|
|
177
|
+
export declare const buildDELETE: ({ prisma }?: {
|
|
178
|
+
prisma?: PrismaClient;
|
|
179
|
+
}) => (request: NextRequest, props: {
|
|
180
|
+
params: Promise<{
|
|
181
|
+
assistantId: string;
|
|
182
|
+
}>;
|
|
183
|
+
}) => Promise<NextResponse<{
|
|
184
|
+
error: string;
|
|
185
|
+
}> | NextResponse<{
|
|
186
|
+
assistant: {
|
|
187
|
+
id: string;
|
|
188
|
+
storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
|
|
189
|
+
storageProviderAssistantId: string | null;
|
|
190
|
+
modelProviderId: string;
|
|
191
|
+
model: string;
|
|
192
|
+
name: string;
|
|
193
|
+
description: string;
|
|
194
|
+
instructions: string;
|
|
195
|
+
codeInterpreterEnabled: boolean;
|
|
196
|
+
fileSearchEnabled: boolean;
|
|
197
|
+
createdAt: string;
|
|
198
|
+
updatedAt: string;
|
|
199
|
+
avatar: {
|
|
200
|
+
type: import("@prisma/client").$Enums.AvatarType;
|
|
201
|
+
imageAvatar: {
|
|
202
|
+
url: string;
|
|
203
|
+
} | null;
|
|
204
|
+
iconAvatar: {
|
|
205
|
+
name: import("@prisma/client").$Enums.IconAvatarName;
|
|
206
|
+
} | null;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
}>>;
|
|
87
210
|
export declare const DELETE: (request: NextRequest, props: {
|
|
88
211
|
params: Promise<{
|
|
89
212
|
assistantId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/assistants/[assistantId]/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/assistants/[assistantId]/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAUvB,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FF,CAAA;AAEH,eAAO,MAAM,GAAG,YAnGH,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FwB,CAAA;AAE7B,eAAO,MAAM,UAAU,GACpB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;GAsJF,CAAA;AAEH,eAAO,MAAM,KAAK,YA7JL,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;GAwJ4B,CAAA;AAEjC,eAAO,MAAM,WAAW,GACrB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDF,CAAA;AAEH,eAAO,MAAM,MAAM,YA/DN,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0D8B,CAAA;AAEnC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -2,13 +2,13 @@ import { NextResponse } from 'next/server';
|
|
|
2
2
|
import { StorageProviderType, ApiKeyType, ToolType, } from '@prisma/client';
|
|
3
3
|
import { cacheHeaders } from '../../../../lib/cache/cacheHeaders';
|
|
4
4
|
import { workspaceAccessWhere as getWorkspaceAccessWhere } from '../../../../lib/apiKeys/workspaceAccessWhere';
|
|
5
|
-
import { prisma } from '../../../../lib/prisma';
|
|
5
|
+
import { prisma as defaultPrisma } from '../../../../lib/prisma';
|
|
6
6
|
import { serializeAssistant } from '../../../../lib/assistants/serializeAssistant';
|
|
7
7
|
import { serializeApiAssistant } from '../../../../lib/assistants/serializeApiAssistant';
|
|
8
8
|
import { headers } from 'next/headers';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
import { getApiKey } from '../../../../lib/apiKeys/getApiKey';
|
|
11
|
-
export const
|
|
11
|
+
export const buildGET = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
|
|
12
12
|
const params = await props.params;
|
|
13
13
|
const { assistantId } = params;
|
|
14
14
|
const headersList = await headers();
|
|
@@ -17,6 +17,7 @@ export const GET = async (request, props) => {
|
|
|
17
17
|
const privateApiKey = await getApiKey({
|
|
18
18
|
authorization,
|
|
19
19
|
type: ApiKeyType.PRIVATE,
|
|
20
|
+
prisma,
|
|
20
21
|
});
|
|
21
22
|
if (!privateApiKey) {
|
|
22
23
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -45,6 +46,7 @@ export const GET = async (request, props) => {
|
|
|
45
46
|
}
|
|
46
47
|
const workspaceAccessWhere = await getWorkspaceAccessWhere({
|
|
47
48
|
publicApiKey: request.nextUrl.searchParams.get('publicApiKey'),
|
|
49
|
+
prisma,
|
|
48
50
|
});
|
|
49
51
|
if (!workspaceAccessWhere) {
|
|
50
52
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -73,7 +75,8 @@ export const GET = async (request, props) => {
|
|
|
73
75
|
assistant: serializeAssistant({ assistant }),
|
|
74
76
|
}, { headers: cacheHeaders });
|
|
75
77
|
};
|
|
76
|
-
export const
|
|
78
|
+
export const GET = buildGET();
|
|
79
|
+
export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
|
|
77
80
|
const params = await props.params;
|
|
78
81
|
const { assistantId } = params;
|
|
79
82
|
const headersList = await headers();
|
|
@@ -84,6 +87,7 @@ export const PATCH = async (request, props) => {
|
|
|
84
87
|
const privateApiKey = await getApiKey({
|
|
85
88
|
authorization,
|
|
86
89
|
type: ApiKeyType.PRIVATE,
|
|
90
|
+
prisma,
|
|
87
91
|
});
|
|
88
92
|
if (!privateApiKey) {
|
|
89
93
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -103,7 +107,8 @@ export const PATCH = async (request, props) => {
|
|
|
103
107
|
.superRefine((data, ctx) => {
|
|
104
108
|
if (!data.storageProviderType)
|
|
105
109
|
return;
|
|
106
|
-
if (data.storageProviderType ===
|
|
110
|
+
if (data.storageProviderType ===
|
|
111
|
+
StorageProviderType.SUPERINTERFACE_CLOUD &&
|
|
107
112
|
data.storageProviderAssistantId) {
|
|
108
113
|
ctx.addIssue({
|
|
109
114
|
code: z.ZodIssueCode.custom,
|
|
@@ -111,7 +116,8 @@ export const PATCH = async (request, props) => {
|
|
|
111
116
|
path: ['storageProviderAssistantId'],
|
|
112
117
|
});
|
|
113
118
|
}
|
|
114
|
-
if (data.storageProviderType !==
|
|
119
|
+
if (data.storageProviderType !==
|
|
120
|
+
StorageProviderType.SUPERINTERFACE_CLOUD &&
|
|
115
121
|
!data.storageProviderAssistantId) {
|
|
116
122
|
ctx.addIssue({
|
|
117
123
|
code: z.ZodIssueCode.custom,
|
|
@@ -174,7 +180,8 @@ export const PATCH = async (request, props) => {
|
|
|
174
180
|
assistant: serializeApiAssistant({ assistant }),
|
|
175
181
|
}, { headers: cacheHeaders });
|
|
176
182
|
};
|
|
177
|
-
export const
|
|
183
|
+
export const PATCH = buildPATCH();
|
|
184
|
+
export const buildDELETE = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
|
|
178
185
|
const params = await props.params;
|
|
179
186
|
const { assistantId } = params;
|
|
180
187
|
const headersList = await headers();
|
|
@@ -185,6 +192,7 @@ export const DELETE = async (request, props) => {
|
|
|
185
192
|
const privateApiKey = await getApiKey({
|
|
186
193
|
authorization,
|
|
187
194
|
type: ApiKeyType.PRIVATE,
|
|
195
|
+
prisma,
|
|
188
196
|
});
|
|
189
197
|
if (!privateApiKey) {
|
|
190
198
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -216,6 +224,7 @@ export const DELETE = async (request, props) => {
|
|
|
216
224
|
assistant: serializeApiAssistant({ assistant }),
|
|
217
225
|
}, { headers: cacheHeaders });
|
|
218
226
|
};
|
|
227
|
+
export const DELETE = buildDELETE();
|
|
219
228
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
220
229
|
headers: cacheHeaders,
|
|
221
230
|
});
|
|
@@ -1,4 +1,34 @@
|
|
|
1
|
+
import { type PrismaClient } from '@prisma/client';
|
|
1
2
|
import { NextResponse } from 'next/server';
|
|
3
|
+
export declare const buildGET: ({ prisma }?: {
|
|
4
|
+
prisma?: PrismaClient;
|
|
5
|
+
}) => () => Promise<NextResponse<{
|
|
6
|
+
error: string;
|
|
7
|
+
}> | NextResponse<{
|
|
8
|
+
assistants: {
|
|
9
|
+
id: string;
|
|
10
|
+
storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
|
|
11
|
+
storageProviderAssistantId: string | null;
|
|
12
|
+
modelProviderId: string;
|
|
13
|
+
model: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
instructions: string;
|
|
17
|
+
codeInterpreterEnabled: boolean;
|
|
18
|
+
fileSearchEnabled: boolean;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
avatar: {
|
|
22
|
+
type: import("@prisma/client").$Enums.AvatarType;
|
|
23
|
+
imageAvatar: {
|
|
24
|
+
url: string;
|
|
25
|
+
} | null;
|
|
26
|
+
iconAvatar: {
|
|
27
|
+
name: import("@prisma/client").$Enums.IconAvatarName;
|
|
28
|
+
} | null;
|
|
29
|
+
};
|
|
30
|
+
}[];
|
|
31
|
+
}>>;
|
|
2
32
|
export declare const GET: () => Promise<NextResponse<{
|
|
3
33
|
error: string;
|
|
4
34
|
}> | NextResponse<{
|
|
@@ -26,6 +56,35 @@ export declare const GET: () => Promise<NextResponse<{
|
|
|
26
56
|
};
|
|
27
57
|
}[];
|
|
28
58
|
}>>;
|
|
59
|
+
export declare const buildPOST: ({ prisma }?: {
|
|
60
|
+
prisma?: PrismaClient;
|
|
61
|
+
}) => (request: Request) => Promise<NextResponse<{
|
|
62
|
+
error: string;
|
|
63
|
+
}> | NextResponse<{
|
|
64
|
+
assistant: {
|
|
65
|
+
id: string;
|
|
66
|
+
storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
|
|
67
|
+
storageProviderAssistantId: string | null;
|
|
68
|
+
modelProviderId: string;
|
|
69
|
+
model: string;
|
|
70
|
+
name: string;
|
|
71
|
+
description: string;
|
|
72
|
+
instructions: string;
|
|
73
|
+
codeInterpreterEnabled: boolean;
|
|
74
|
+
fileSearchEnabled: boolean;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
updatedAt: string;
|
|
77
|
+
avatar: {
|
|
78
|
+
type: import("@prisma/client").$Enums.AvatarType;
|
|
79
|
+
imageAvatar: {
|
|
80
|
+
url: string;
|
|
81
|
+
} | null;
|
|
82
|
+
iconAvatar: {
|
|
83
|
+
name: import("@prisma/client").$Enums.IconAvatarName;
|
|
84
|
+
} | null;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}>>;
|
|
29
88
|
export declare const POST: (request: Request) => Promise<NextResponse<{
|
|
30
89
|
error: string;
|
|
31
90
|
}> | NextResponse<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/assistants/route.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/assistants/route.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO1C,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GA4C1D,CAAA;AAEH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;GAAa,CAAA;AAwC7B,eAAO,MAAM,SAAS,GACnB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGtB,CAAA;AAEH,eAAO,MAAM,IAAI,YAnGC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGM,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { headers } from 'next/headers';
|
|
2
|
-
import { ApiKeyType, StorageProviderType, ToolType } from '@prisma/client';
|
|
2
|
+
import { ApiKeyType, StorageProviderType, ToolType, } from '@prisma/client';
|
|
3
3
|
import { NextResponse } from 'next/server';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { cacheHeaders } from '../../../lib/cache/cacheHeaders';
|
|
6
|
-
import { prisma } from '../../../lib/prisma';
|
|
6
|
+
import { prisma as defaultPrisma } from '../../../lib/prisma';
|
|
7
7
|
import { serializeApiAssistant } from '../../../lib/assistants/serializeApiAssistant';
|
|
8
8
|
import { getApiKey } from '../../../lib/apiKeys/getApiKey';
|
|
9
|
-
export const
|
|
9
|
+
export const buildGET = ({ prisma = defaultPrisma } = {}) => async () => {
|
|
10
10
|
const headersList = await headers();
|
|
11
11
|
const authorization = headersList.get('authorization');
|
|
12
12
|
if (!authorization) {
|
|
@@ -15,6 +15,7 @@ export const GET = async () => {
|
|
|
15
15
|
const privateApiKey = await getApiKey({
|
|
16
16
|
authorization,
|
|
17
17
|
type: ApiKeyType.PRIVATE,
|
|
18
|
+
prisma,
|
|
18
19
|
});
|
|
19
20
|
if (!privateApiKey) {
|
|
20
21
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -37,6 +38,7 @@ export const GET = async () => {
|
|
|
37
38
|
assistants: assistants.map((a) => serializeApiAssistant({ assistant: a })),
|
|
38
39
|
}, { headers: cacheHeaders });
|
|
39
40
|
};
|
|
41
|
+
export const GET = buildGET();
|
|
40
42
|
const createAssistantSchema = z
|
|
41
43
|
.object({
|
|
42
44
|
storageProviderType: z.nativeEnum(StorageProviderType),
|
|
@@ -67,7 +69,7 @@ const createAssistantSchema = z
|
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
});
|
|
70
|
-
export const
|
|
72
|
+
export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request) => {
|
|
71
73
|
const headersList = await headers();
|
|
72
74
|
const authorization = headersList.get('authorization');
|
|
73
75
|
if (!authorization) {
|
|
@@ -76,6 +78,7 @@ export const POST = async (request) => {
|
|
|
76
78
|
const privateApiKey = await getApiKey({
|
|
77
79
|
authorization,
|
|
78
80
|
type: ApiKeyType.PRIVATE,
|
|
81
|
+
prisma,
|
|
79
82
|
});
|
|
80
83
|
if (!privateApiKey) {
|
|
81
84
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -137,6 +140,7 @@ export const POST = async (request) => {
|
|
|
137
140
|
assistant: serializeApiAssistant({ assistant }),
|
|
138
141
|
}, { headers: cacheHeaders });
|
|
139
142
|
};
|
|
143
|
+
export const POST = buildPOST();
|
|
140
144
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
141
145
|
headers: cacheHeaders,
|
|
142
146
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { OpenAI } from 'openai';
|
|
2
|
-
import type
|
|
2
|
+
import { type Prisma, type PrismaClient } from '@prisma/client';
|
|
3
3
|
import { type NextRequest, NextResponse } from 'next/server';
|
|
4
|
-
export declare const buildGET: ({ purposeAssistantsResponse, }
|
|
4
|
+
export declare const buildGET: ({ prisma, purposeAssistantsResponse, }?: {
|
|
5
|
+
prisma?: PrismaClient;
|
|
5
6
|
purposeAssistantsResponse?: ({ file, }: {
|
|
6
7
|
file: OpenAI.Files.FileObject;
|
|
7
8
|
workspaceAccessWhere: Prisma.WorkspaceWhereInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/files/[fileId]/contents/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/files/[fileId]/contents/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,yCAIE;IACD,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,yBAAyB,CAAC,EAAE,CAAC,EAC3B,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAA;QAC7B,oBAAoB,EAAE,MAAM,CAAC,mBAAmB,CAAA;KACjD,KAAK,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAA;CACtC,MAEJ,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,MAAM,EAAE,MAAM,CAAA;KACf,CAAC,CAAA;CACH,mCA6GF,CAAA;AAEH,eAAO,MAAM,GAAG,YApHH,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QACd,MAAM,EAAE,MAAM,CAAA;KACf,CAAC,CAAA;CACH,mCA+G0B,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -3,9 +3,9 @@ import { NextResponse } from 'next/server';
|
|
|
3
3
|
import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
|
|
4
4
|
import { assistantClientAdapter } from '../../../../../lib/assistants/assistantClientAdapter';
|
|
5
5
|
import { workspaceAccessWhere as getWorkspaceAccessWhere } from '../../../../../lib/apiKeys/workspaceAccessWhere';
|
|
6
|
-
import { prisma } from '../../../../../lib/prisma';
|
|
6
|
+
import { prisma as defaultPrisma } from '../../../../../lib/prisma';
|
|
7
7
|
import { isOpenaiAssistantsStorageProvider } from '../../../../../lib/storageProviders/isOpenaiAssistantsStorageProvider';
|
|
8
|
-
export const buildGET = ({ purposeAssistantsResponse = () => NextResponse.json({ error: 'No file source found' }, { status: 404 }), }) => async (request, props) => {
|
|
8
|
+
export const buildGET = ({ prisma = defaultPrisma, purposeAssistantsResponse = () => NextResponse.json({ error: 'No file source found' }, { status: 404 }), } = {}) => async (request, props) => {
|
|
9
9
|
var _a, _b;
|
|
10
10
|
const params = await props.params;
|
|
11
11
|
const { fileId } = params;
|
|
@@ -17,7 +17,10 @@ export const buildGET = ({ purposeAssistantsResponse = () => NextResponse.json({
|
|
|
17
17
|
if (!isString(publicApiKey)) {
|
|
18
18
|
return NextResponse.json({ error: 'Invalid publicApiKey' }, { status: 400 });
|
|
19
19
|
}
|
|
20
|
-
const workspaceAccessWhere = await getWorkspaceAccessWhere({
|
|
20
|
+
const workspaceAccessWhere = await getWorkspaceAccessWhere({
|
|
21
|
+
publicApiKey,
|
|
22
|
+
prisma,
|
|
23
|
+
});
|
|
21
24
|
if (!workspaceAccessWhere) {
|
|
22
25
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
23
26
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type OpenAI from 'openai';
|
|
2
|
+
import { type PrismaClient } from '@prisma/client';
|
|
2
3
|
import { type NextRequest, NextResponse } from 'next/server';
|
|
4
|
+
export declare const buildPOST: ({ prisma }?: {
|
|
5
|
+
prisma?: PrismaClient;
|
|
6
|
+
}) => (request: NextRequest) => Promise<NextResponse<{
|
|
7
|
+
error: string;
|
|
8
|
+
}> | NextResponse<{
|
|
9
|
+
file: OpenAI.Files.FileObject & {
|
|
10
|
+
_request_id?: string | null;
|
|
11
|
+
};
|
|
12
|
+
}>>;
|
|
3
13
|
export declare const POST: (request: NextRequest) => Promise<NextResponse<{
|
|
4
14
|
error: string;
|
|
5
15
|
}> | NextResponse<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/files/route.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/files/route.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACvE,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,SAAS,GACnB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;;;GA8G1B,CAAA;AAEH,eAAO,MAAM,IAAI,YAhHC,WAAW;;;;;;GAgHE,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -4,9 +4,9 @@ import { NextResponse } from 'next/server';
|
|
|
4
4
|
import { cacheHeaders } from '../../../lib/cache/cacheHeaders';
|
|
5
5
|
import { assistantClientAdapter } from '../../../lib/assistants/assistantClientAdapter';
|
|
6
6
|
import { workspaceAccessWhere as getWorkspaceAccessWhere } from '../../../lib/apiKeys/workspaceAccessWhere';
|
|
7
|
-
import { prisma } from '../../../lib/prisma';
|
|
7
|
+
import { prisma as defaultPrisma } from '../../../lib/prisma';
|
|
8
8
|
import { isOpenaiAssistantsStorageProvider } from '../../../lib/storageProviders/isOpenaiAssistantsStorageProvider';
|
|
9
|
-
export const
|
|
9
|
+
export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const formData = await request.formData();
|
|
12
12
|
const assistantId = formData.get('assistantId');
|
|
@@ -18,7 +18,10 @@ export const POST = async (request) => {
|
|
|
18
18
|
return NextResponse.json({ error: 'Invalid publicApiKey' }, { status: 400 });
|
|
19
19
|
}
|
|
20
20
|
const file = formData.get('file');
|
|
21
|
-
const workspaceAccessWhere = await getWorkspaceAccessWhere({
|
|
21
|
+
const workspaceAccessWhere = await getWorkspaceAccessWhere({
|
|
22
|
+
publicApiKey,
|
|
23
|
+
prisma,
|
|
24
|
+
});
|
|
22
25
|
if (!workspaceAccessWhere) {
|
|
23
26
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
24
27
|
}
|
|
@@ -81,6 +84,7 @@ export const POST = async (request) => {
|
|
|
81
84
|
file: createFileResponse,
|
|
82
85
|
}, { headers: cacheHeaders });
|
|
83
86
|
};
|
|
87
|
+
export const POST = buildPOST();
|
|
84
88
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
85
89
|
headers: cacheHeaders,
|
|
86
90
|
});
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
import { type NextRequest, NextResponse } from 'next/server';
|
|
2
2
|
import OpenAI from 'openai';
|
|
3
|
+
import { type PrismaClient } from '@prisma/client';
|
|
3
4
|
import type { Thread } from '@prisma/client';
|
|
4
5
|
export declare const maxDuration = 800;
|
|
6
|
+
export declare const buildGET: ({ prisma }?: {
|
|
7
|
+
prisma?: PrismaClient;
|
|
8
|
+
}) => (request: NextRequest) => Promise<NextResponse<{
|
|
9
|
+
error: string;
|
|
10
|
+
}> | NextResponse<{
|
|
11
|
+
data: {
|
|
12
|
+
id: string;
|
|
13
|
+
role: "user" | "assistant";
|
|
14
|
+
created_at: number;
|
|
15
|
+
content: OpenAI.Beta.Threads.Messages.MessageContent[];
|
|
16
|
+
run_id: string;
|
|
17
|
+
assistant_id: string;
|
|
18
|
+
thread_id: string;
|
|
19
|
+
attachments: OpenAI.Beta.Threads.Messages.Message.Attachment[];
|
|
20
|
+
metadata: import("openai/resources/shared.mjs").Metadata;
|
|
21
|
+
runSteps: Pick<OpenAI.Beta.Threads.Runs.Steps.RunStep, "id" | "run_id" | "step_details" | "completed_at" | "cancelled_at" | "failed_at" | "status">[];
|
|
22
|
+
status: "in_progress" | "incomplete" | "completed";
|
|
23
|
+
}[];
|
|
24
|
+
hasNextPage: boolean;
|
|
25
|
+
lastId: null;
|
|
26
|
+
}> | NextResponse<import("@superinterface/react/types/index").MessagesPage>>;
|
|
5
27
|
export declare const GET: (request: NextRequest) => Promise<NextResponse<{
|
|
6
28
|
error: string;
|
|
7
29
|
}> | NextResponse<{
|
|
@@ -21,7 +43,8 @@ export declare const GET: (request: NextRequest) => Promise<NextResponse<{
|
|
|
21
43
|
hasNextPage: boolean;
|
|
22
44
|
lastId: null;
|
|
23
45
|
}> | NextResponse<import("@superinterface/react/types/index").MessagesPage>>;
|
|
24
|
-
export declare const buildPOST: ({ onSuccessCreateThread, }
|
|
46
|
+
export declare const buildPOST: ({ prisma, onSuccessCreateThread, }?: {
|
|
47
|
+
prisma?: PrismaClient;
|
|
25
48
|
onSuccessCreateThread?: ({ thread, }: {
|
|
26
49
|
thread: Thread;
|
|
27
50
|
}) => void | Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/messages/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,MAAM,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/messages/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AA2B5C,eAAO,MAAM,WAAW,MAAM,CAAA;AAE9B,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;;;;;;;;;;;;;;;4EAuK1B,CAAA;AAEH,eAAO,MAAM,GAAG,YAzKE,WAAW;;;;;;;;;;;;;;;;;;4EAyKA,CAAA;AAE7B,eAAO,MAAM,SAAS,GACnB,qCAGE;IACD,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,qBAAqB,CAAC,EAAE,CAAC,EACvB,MAAM,GACP,EAAE;QACD,MAAM,EAAE,MAAM,CAAA;KACf,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACtB,MACC,SAAS,WAAW,sBA4f1B,CAAA;AAEH,eAAO,MAAM,IAAI,YA9fC,WAAW,sBA8fI,CAAA;AAEjC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|