@superinterface/server 1.0.19 → 1.0.20
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/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]__228bff78._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__228bff78._.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]__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]__3307123c._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__3307123c._.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]__50c5f12c._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__50c5f12c._.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]__6b8ba839._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__6b8ba839._.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]__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]__e7819e95._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__e7819e95._.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]__f0dfab03._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__ff90af03._.js +2 -2
- package/.next/server/chunks/[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/functions-config-manifest.json +2 -2
- 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]/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/[apiKeyId]/route.js +4 -4
- package/dist/app/api/api-keys/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/route.js +3 -3
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +4 -4
- package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/route.js +3 -3
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +3 -3
- 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 +4 -4
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +3 -3
- package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/route.js +4 -4
- package/dist/app/api/assistants/route.d.ts.map +1 -1
- package/dist/app/api/assistants/route.js +3 -3
- package/dist/app/api/files/[fileId]/contents/route.js +5 -5
- package/dist/app/api/files/route.d.ts.map +1 -1
- package/dist/app/api/files/route.js +4 -4
- package/dist/app/api/messages/route.d.ts.map +1 -1
- package/dist/app/api/messages/route.js +15 -11
- package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/assistants/route.js +2 -2
- package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/models/route.js +2 -2
- package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/route.js +4 -4
- package/dist/app/api/providers/route.d.ts.map +1 -1
- package/dist/app/api/providers/route.js +3 -3
- package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
- package/dist/app/api/tasks/[taskId]/route.js +4 -4
- package/dist/app/api/tasks/callback/route.js +6 -6
- package/dist/app/api/tasks/route.d.ts.map +1 -1
- package/dist/app/api/tasks/route.js +3 -3
- 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 +2 -2
- package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/[workspaceId]/route.js +3 -3
- package/dist/app/api/workspaces/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/route.js +3 -3
- package/dist/lib/mcpServers/connectMcpServer.d.ts +1 -1
- package/dist/lib/prisma/index.d.ts +2 -0
- package/dist/lib/prisma/index.d.ts.map +1 -1
- package/dist/lib/prisma/index.js +16 -4
- package/dist/lib/threads/createThread/index.d.ts +3 -3
- package/package.json +1 -1
- /package/.next/static/{rEvucoSBXJWMKfLWTgPF2 → Ggpv5PXa7pPyxP1NXVbh6}/_buildManifest.js +0 -0
- /package/.next/static/{rEvucoSBXJWMKfLWTgPF2 → Ggpv5PXa7pPyxP1NXVbh6}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{rEvucoSBXJWMKfLWTgPF2 → Ggpv5PXa7pPyxP1NXVbh6}/_ssgManifest.js +0 -0
|
@@ -2,13 +2,13 @@ import { headers } from 'next/headers';
|
|
|
2
2
|
import { ApiKeyType } from '@prisma/client';
|
|
3
3
|
import { NextResponse } from 'next/server';
|
|
4
4
|
import { cacheHeaders } from '../../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import {
|
|
5
|
+
import { getPrisma } from '../../../../../../lib/prisma';
|
|
6
6
|
import { getApiKey } from '../../../../../../lib/apiKeys/getApiKey';
|
|
7
7
|
import { validate } from 'uuid';
|
|
8
8
|
import { serializeApiFunction } from '../../../../../../lib/functions/serializeApiFunction';
|
|
9
9
|
import { functionSchema } from '../../../../../../lib/functions/functionSchema';
|
|
10
10
|
import { updateFunction } from '../../../../../../lib/functions/updateFunction';
|
|
11
|
-
export const buildGET = ({ prisma =
|
|
11
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
12
12
|
const { assistantId, functionId } = await props.params;
|
|
13
13
|
const headersList = await headers();
|
|
14
14
|
const authorization = headersList.get('authorization');
|
|
@@ -61,7 +61,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
|
|
|
61
61
|
}, { headers: cacheHeaders });
|
|
62
62
|
};
|
|
63
63
|
export const GET = buildGET();
|
|
64
|
-
export const buildPATCH = ({ prisma =
|
|
64
|
+
export const buildPATCH = ({ prisma = getPrisma() } = {}) => async (request, props) => {
|
|
65
65
|
const { assistantId, functionId } = await props.params;
|
|
66
66
|
const headersList = await headers();
|
|
67
67
|
const authorization = headersList.get('authorization');
|
|
@@ -127,7 +127,7 @@ export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, p
|
|
|
127
127
|
}, { headers: cacheHeaders });
|
|
128
128
|
};
|
|
129
129
|
export const PATCH = buildPATCH();
|
|
130
|
-
export const buildDELETE = ({ prisma =
|
|
130
|
+
export const buildDELETE = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
131
131
|
const { assistantId, functionId } = await props.params;
|
|
132
132
|
const headersList = await headers();
|
|
133
133
|
const authorization = headersList.get('authorization');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/functions/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAS9D,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/functions/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAS9D,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEF,CAAA;AAEH,eAAO,MAAM,GAAG,aAvEF,WAAW,SACd;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEwB,CAAA;AAE7B,eAAO,MAAM,SAAS,GACnB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEF,CAAA;AAEH,eAAO,MAAM,IAAI,YA1EJ,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuE0B,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -2,12 +2,12 @@ import { NextResponse } from 'next/server';
|
|
|
2
2
|
import { ApiKeyType } from '@prisma/client';
|
|
3
3
|
import { headers } from 'next/headers';
|
|
4
4
|
import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import {
|
|
5
|
+
import { getPrisma } from '../../../../../lib/prisma';
|
|
6
6
|
import { getApiKey } from '../../../../../lib/apiKeys/getApiKey';
|
|
7
7
|
import { serializeApiFunction } from '../../../../../lib/functions/serializeApiFunction';
|
|
8
8
|
import { functionSchema } from '../../../../../lib/functions/functionSchema';
|
|
9
9
|
import { createFunction } from '../../../../../lib/functions/createFunction';
|
|
10
|
-
export const buildGET = ({ prisma =
|
|
10
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
11
11
|
const { assistantId } = await props.params;
|
|
12
12
|
const headersList = await headers();
|
|
13
13
|
const authorization = headersList.get('authorization');
|
|
@@ -60,7 +60,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
|
|
|
60
60
|
}, { headers: cacheHeaders });
|
|
61
61
|
};
|
|
62
62
|
export const GET = buildGET();
|
|
63
|
-
export const buildPOST = ({ prisma =
|
|
63
|
+
export const buildPOST = ({ prisma = getPrisma() } = {}) => async (request, props) => {
|
|
64
64
|
const { assistantId } = await props.params;
|
|
65
65
|
const headersList = await headers();
|
|
66
66
|
const authorization = headersList.get('authorization');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/initial-messages/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAS9E,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/initial-messages/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAS9E,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;GAiDF,CAAA;AAEH,eAAO,MAAM,GAAG,aAtDF,WAAW,SACd;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;GAmDwB,CAAA;AAE7B,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;GAwDF,CAAA;AAEH,eAAO,MAAM,GAAG,YA7DH,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;GA0DwB,CAAA;AAE7B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -2,12 +2,12 @@ import { NextResponse } from 'next/server';
|
|
|
2
2
|
import { ApiKeyType } from '@prisma/client';
|
|
3
3
|
import { headers } from 'next/headers';
|
|
4
4
|
import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import {
|
|
5
|
+
import { getPrisma } from '../../../../../lib/prisma';
|
|
6
6
|
import { serializeApiInitialMessage } from '../../../../../lib/initialMessages/serializeApiInitialMessage';
|
|
7
7
|
import { initialMessagesSchema } from '../../../../../lib/initialMessages/schema';
|
|
8
8
|
import { updateInitialMessages } from '../../../../../lib/initialMessages/updateInitialMessages';
|
|
9
9
|
import { getApiKey } from '../../../../../lib/apiKeys/getApiKey';
|
|
10
|
-
export const buildGET = ({ prisma =
|
|
10
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
11
11
|
const { assistantId } = await props.params;
|
|
12
12
|
const headersList = await headers();
|
|
13
13
|
const authorization = headersList.get('authorization');
|
|
@@ -43,7 +43,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
|
|
|
43
43
|
}, { headers: cacheHeaders });
|
|
44
44
|
};
|
|
45
45
|
export const GET = buildGET();
|
|
46
|
-
export const buildPUT = ({ prisma =
|
|
46
|
+
export const buildPUT = ({ prisma = getPrisma() } = {}) => async (request, props) => {
|
|
47
47
|
const { assistantId } = await props.params;
|
|
48
48
|
const headersList = await headers();
|
|
49
49
|
const authorization = headersList.get('authorization');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAQ5D,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAQ5D,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC9D;;;;;;;;;;;;;;;;;;;;;;;GAgEF,CAAA;AAEH,eAAO,MAAM,GAAG,aArEF,WAAW,SACd;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC9D;;;;;;;;;;;;;;;;;;;;;;;GAkEwB,CAAA;AAE7B,eAAO,MAAM,UAAU,GACpB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC9D;;;;;;;;;;;;;;;;;;;;;;;GAuGF,CAAA;AAEH,eAAO,MAAM,KAAK,YA5GL,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC9D;;;;;;;;;;;;;;;;;;;;;;;GAyG4B,CAAA;AAEjC,eAAO,MAAM,WAAW,GACrB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC9D;;;;;;;;;;;;;;;;;;;;;;;GAoEF,CAAA;AAEH,eAAO,MAAM,MAAM,aAzEL,WAAW,SACd;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC9D;;;;;;;;;;;;;;;;;;;;;;;GAsE8B,CAAA;AAEnC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -2,12 +2,12 @@ import { headers } from 'next/headers';
|
|
|
2
2
|
import { ApiKeyType, TransportType } from '@prisma/client';
|
|
3
3
|
import { NextResponse } from 'next/server';
|
|
4
4
|
import { cacheHeaders } from '../../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import {
|
|
5
|
+
import { getPrisma } from '../../../../../../lib/prisma';
|
|
6
6
|
import { getApiKey } from '../../../../../../lib/apiKeys/getApiKey';
|
|
7
7
|
import { validate } from 'uuid';
|
|
8
8
|
import { serializeApiMcpServer } from '../../../../../../lib/mcpServers/serializeApiMcpServer';
|
|
9
9
|
import { mcpServerSchema } from '../../../../../../lib/mcpServers/mcpServerSchema';
|
|
10
|
-
export const buildGET = ({ prisma =
|
|
10
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
11
11
|
const { assistantId, mcpServerId } = await props.params;
|
|
12
12
|
const headersList = await headers();
|
|
13
13
|
const authorization = headersList.get('authorization');
|
|
@@ -49,7 +49,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
|
|
|
49
49
|
}, { headers: cacheHeaders });
|
|
50
50
|
};
|
|
51
51
|
export const GET = buildGET();
|
|
52
|
-
export const buildPATCH = ({ prisma =
|
|
52
|
+
export const buildPATCH = ({ prisma = getPrisma() } = {}) => async (request, props) => {
|
|
53
53
|
const { assistantId, mcpServerId } = await props.params;
|
|
54
54
|
const headersList = await headers();
|
|
55
55
|
const authorization = headersList.get('authorization');
|
|
@@ -121,7 +121,7 @@ export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, p
|
|
|
121
121
|
}, { headers: cacheHeaders });
|
|
122
122
|
};
|
|
123
123
|
export const PATCH = buildPATCH();
|
|
124
|
-
export const buildDELETE = ({ prisma =
|
|
124
|
+
export const buildDELETE = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
125
125
|
const { assistantId, mcpServerId } = await props.params;
|
|
126
126
|
const headersList = await headers();
|
|
127
127
|
const authorization = headersList.get('authorization');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/mcp-servers/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAQ7E,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/mcp-servers/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAQ7E,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;;;;;;;;;;;;GAwDF,CAAA;AAEH,eAAO,MAAM,GAAG,aA7DF,WAAW,SACd;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;;;;;;;;;;;;GA0DwB,CAAA;AAE7B,eAAO,MAAM,SAAS,GACnB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;;;;;;;;;;;;GAqFF,CAAA;AAEH,eAAO,MAAM,IAAI,YA1FJ,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;;;;;;;;;;;;;;;GAuF0B,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -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 {
|
|
5
|
+
import { getPrisma } 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 buildGET = ({ prisma =
|
|
9
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
10
10
|
const { assistantId } = await props.params;
|
|
11
11
|
const headersList = await headers();
|
|
12
12
|
const authorization = headersList.get('authorization');
|
|
@@ -49,7 +49,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
|
|
|
49
49
|
}, { headers: cacheHeaders });
|
|
50
50
|
};
|
|
51
51
|
export const GET = buildGET();
|
|
52
|
-
export const buildPOST = ({ prisma =
|
|
52
|
+
export const buildPOST = ({ prisma = getPrisma() } = {}) => async (request, props) => {
|
|
53
53
|
const { assistantId } = await props.params;
|
|
54
54
|
const headersList = await headers();
|
|
55
55
|
const authorization = headersList.get('authorization');
|
|
@@ -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;AAC5D,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAUvB,eAAO,MAAM,QAAQ,GAClB,
|
|
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,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,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,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,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,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,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 {
|
|
5
|
+
import { getPrisma } 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 buildGET = ({ prisma =
|
|
11
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (request, props) => {
|
|
12
12
|
const params = await props.params;
|
|
13
13
|
const { assistantId } = params;
|
|
14
14
|
const headersList = await headers();
|
|
@@ -76,7 +76,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (request, pro
|
|
|
76
76
|
}, { headers: cacheHeaders });
|
|
77
77
|
};
|
|
78
78
|
export const GET = buildGET();
|
|
79
|
-
export const buildPATCH = ({ prisma =
|
|
79
|
+
export const buildPATCH = ({ prisma = getPrisma() } = {}) => async (request, props) => {
|
|
80
80
|
const params = await props.params;
|
|
81
81
|
const { assistantId } = params;
|
|
82
82
|
const headersList = await headers();
|
|
@@ -181,7 +181,7 @@ export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, p
|
|
|
181
181
|
}, { headers: cacheHeaders });
|
|
182
182
|
};
|
|
183
183
|
export const PATCH = buildPATCH();
|
|
184
|
-
export const buildDELETE = ({ prisma =
|
|
184
|
+
export const buildDELETE = ({ prisma = getPrisma() } = {}) => async (request, props) => {
|
|
185
185
|
const params = await props.params;
|
|
186
186
|
const { assistantId } = params;
|
|
187
187
|
const headersList = await headers();
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CxD,CAAA;AAEH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;GAAa,CAAA;AAwC7B,eAAO,MAAM,SAAS,GACnB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAClD,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGtB,CAAA;AAEH,eAAO,MAAM,IAAI,YAnGC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGM,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -3,10 +3,10 @@ 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 {
|
|
6
|
+
import { getPrisma } from '../../../lib/prisma';
|
|
7
7
|
import { serializeApiAssistant } from '../../../lib/assistants/serializeApiAssistant';
|
|
8
8
|
import { getApiKey } from '../../../lib/apiKeys/getApiKey';
|
|
9
|
-
export const buildGET = ({ prisma =
|
|
9
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async () => {
|
|
10
10
|
const headersList = await headers();
|
|
11
11
|
const authorization = headersList.get('authorization');
|
|
12
12
|
if (!authorization) {
|
|
@@ -69,7 +69,7 @@ const createAssistantSchema = z
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
export const buildPOST = ({ prisma =
|
|
72
|
+
export const buildPOST = ({ prisma = getPrisma() } = {}) => async (request) => {
|
|
73
73
|
const headersList = await headers();
|
|
74
74
|
const authorization = headersList.get('authorization');
|
|
75
75
|
if (!authorization) {
|
|
@@ -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 {
|
|
6
|
+
import { getPrisma } from '../../../../../lib/prisma';
|
|
7
7
|
import { isOpenaiAssistantsStorageProvider } from '../../../../../lib/storageProviders/isOpenaiAssistantsStorageProvider';
|
|
8
|
-
export const buildGET = ({ prisma =
|
|
8
|
+
export const buildGET = ({ prisma = getPrisma(), 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;
|
|
@@ -63,15 +63,15 @@ export const buildGET = ({ prisma = defaultPrisma, purposeAssistantsResponse = (
|
|
|
63
63
|
!assistant.openaiAssistantId) {
|
|
64
64
|
return NextResponse.json({ error: 'Assistant setup is not done.' }, { status: 400 });
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
const file = await
|
|
66
|
+
const assistantClient = assistantClientAdapter({ assistant, prisma });
|
|
67
|
+
const file = await assistantClient.files.retrieve(fileId);
|
|
68
68
|
if (!file) {
|
|
69
69
|
return NextResponse.json({ error: 'No file found' }, { status: 404 });
|
|
70
70
|
}
|
|
71
71
|
if (file.purpose === 'assistants') {
|
|
72
72
|
return purposeAssistantsResponse({ file, workspaceAccessWhere });
|
|
73
73
|
}
|
|
74
|
-
const fileContentResponse = await
|
|
74
|
+
const fileContentResponse = await assistantClient.files.content(fileId);
|
|
75
75
|
const fileData = await fileContentResponse.arrayBuffer();
|
|
76
76
|
return new NextResponse(fileData, {
|
|
77
77
|
headers: Object.assign(Object.assign({}, cacheHeaders), { 'Content-Type': (_a = fileContentResponse.headers.get('Content-Type')) !== null && _a !== void 0 ? _a : 'application/octet-stream', 'Content-Disposition': (_b = fileContentResponse.headers.get('Content-Disposition')) !== null && _b !== void 0 ? _b : 'inline' }),
|
|
@@ -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;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,
|
|
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,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAClD,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 {
|
|
7
|
+
import { getPrisma } from '../../../lib/prisma';
|
|
8
8
|
import { isOpenaiAssistantsStorageProvider } from '../../../lib/storageProviders/isOpenaiAssistantsStorageProvider';
|
|
9
|
-
export const buildPOST = ({ prisma =
|
|
9
|
+
export const buildPOST = ({ prisma = getPrisma() } = {}) => async (request) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const formData = await request.formData();
|
|
12
12
|
const assistantId = formData.get('assistantId');
|
|
@@ -67,9 +67,9 @@ export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request) =>
|
|
|
67
67
|
!assistant.openaiAssistantId) {
|
|
68
68
|
return NextResponse.json({ error: 'Assistant setup is not done.' }, { status: 400 });
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const assistantClient = assistantClientAdapter({ assistant, prisma });
|
|
71
71
|
const purpose = (_a = formData.get('purpose')) !== null && _a !== void 0 ? _a : 'assistants';
|
|
72
|
-
const createFileResponse = await
|
|
72
|
+
const createFileResponse = await assistantClient.files.create(Object.assign({
|
|
73
73
|
// @ts-expect-error file is Uploadable
|
|
74
74
|
file,
|
|
75
75
|
purpose }, (assistant.storageProviderType === StorageProviderType.OPENAI
|
|
@@ -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;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,
|
|
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,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAClD,SAAS,WAAW;;;;;;;;;;;;;;;;;;4EA2K1B,CAAA;AAEH,eAAO,MAAM,GAAG,YA7KE,WAAW;;;;;;;;;;;;;;;;;;4EA6KA,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,sBA+f1B,CAAA;AAEH,eAAO,MAAM,IAAI,YAjgBC,WAAW,sBAigBI,CAAA;AAEjC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -24,7 +24,7 @@ import { createRunOpts } from '../../../lib/runs/createRunOpts';
|
|
|
24
24
|
import { handleToolCall } from '../../../lib/toolCalls/handleToolCall';
|
|
25
25
|
import { createThread } from '../../../lib/threads/createThread';
|
|
26
26
|
import { managedOpenaiThreadId } from '../../../lib/threads/managedOpenaiThreadId';
|
|
27
|
-
import {
|
|
27
|
+
import { getPrisma } from '../../../lib/prisma';
|
|
28
28
|
import { createLog } from '../../../lib/logs/createLog';
|
|
29
29
|
import { serializeThread } from './lib/serializeThread';
|
|
30
30
|
import { getWorkspaceId } from './lib/getWorkspaceId';
|
|
@@ -34,7 +34,7 @@ import { serializeMetadata } from '../../../lib/metadata/serializeMetadata';
|
|
|
34
34
|
import { isResponsesStorageProvider } from '../../../lib/storageProviders/isResponsesStorageProvider';
|
|
35
35
|
import { serializeError } from '../../../lib/errors/serializeError';
|
|
36
36
|
export const maxDuration = 800;
|
|
37
|
-
export const buildGET = ({ prisma =
|
|
37
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (request) => {
|
|
38
38
|
var _a;
|
|
39
39
|
const paramsResult = z
|
|
40
40
|
.object({
|
|
@@ -142,7 +142,11 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (request) =>
|
|
|
142
142
|
headers: cacheHeaders,
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
-
const
|
|
145
|
+
const assistantClient = assistantClientAdapter({
|
|
146
|
+
assistant,
|
|
147
|
+
prisma,
|
|
148
|
+
thread,
|
|
149
|
+
});
|
|
146
150
|
const storageThreadId = getStorageThreadId({
|
|
147
151
|
thread,
|
|
148
152
|
});
|
|
@@ -152,7 +156,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (request) =>
|
|
|
152
156
|
});
|
|
153
157
|
}
|
|
154
158
|
try {
|
|
155
|
-
return NextResponse.json(await messagesResponse(Object.assign({ threadId: storageThreadId, client }, (pageParam ? { pageParam } : {}))), {
|
|
159
|
+
return NextResponse.json(await messagesResponse(Object.assign({ threadId: storageThreadId, client: assistantClient }, (pageParam ? { pageParam } : {}))), {
|
|
156
160
|
headers: cacheHeaders,
|
|
157
161
|
});
|
|
158
162
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -176,7 +180,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (request) =>
|
|
|
176
180
|
}
|
|
177
181
|
};
|
|
178
182
|
export const GET = buildGET();
|
|
179
|
-
export const buildPOST = ({ prisma =
|
|
183
|
+
export const buildPOST = ({ prisma = getPrisma(), onSuccessCreateThread = () => void 0, } = {}) => async (request) => {
|
|
180
184
|
var _a;
|
|
181
185
|
const bodyResult = z
|
|
182
186
|
.object({
|
|
@@ -462,13 +466,13 @@ export const buildPOST = ({ prisma = defaultPrisma, onSuccessCreateThread = () =
|
|
|
462
466
|
});
|
|
463
467
|
return NextResponse.json({ error: 'Failed to get content.' }, { status: 500 });
|
|
464
468
|
}
|
|
465
|
-
const
|
|
469
|
+
const assistantClient = assistantClientAdapter({
|
|
466
470
|
assistant,
|
|
467
471
|
prisma,
|
|
468
472
|
thread,
|
|
469
473
|
});
|
|
470
474
|
try {
|
|
471
|
-
await
|
|
475
|
+
await assistantClient.beta.threads.messages.create(storageThreadId, Object.assign(Object.assign({ role: 'user', content }, ((attachments === null || attachments === void 0 ? void 0 : attachments.length) ? { attachments } : {})), { metadata: serializeMetadata({
|
|
472
476
|
variables,
|
|
473
477
|
workspaceId: assistant.workspaceId,
|
|
474
478
|
prisma,
|
|
@@ -494,7 +498,7 @@ export const buildPOST = ({ prisma = defaultPrisma, onSuccessCreateThread = () =
|
|
|
494
498
|
}
|
|
495
499
|
let createRunStream;
|
|
496
500
|
try {
|
|
497
|
-
createRunStream = await
|
|
501
|
+
createRunStream = await assistantClient.beta.threads.runs.create(storageThreadId, await createRunOpts({ assistant, thread, prisma }));
|
|
498
502
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
499
503
|
}
|
|
500
504
|
catch (error) {
|
|
@@ -517,7 +521,7 @@ export const buildPOST = ({ prisma = defaultPrisma, onSuccessCreateThread = () =
|
|
|
517
521
|
let latestInProgressRunData = null;
|
|
518
522
|
let latestCompletedRunData = null;
|
|
519
523
|
return new Response(createMessageResponse({
|
|
520
|
-
client,
|
|
524
|
+
client: assistantClient,
|
|
521
525
|
createRunStream,
|
|
522
526
|
handleToolCall: handleToolCall({ assistant, thread, prisma }),
|
|
523
527
|
onStart: ({ controller, }) => {
|
|
@@ -550,7 +554,7 @@ export const buildPOST = ({ prisma = defaultPrisma, onSuccessCreateThread = () =
|
|
|
550
554
|
prisma,
|
|
551
555
|
});
|
|
552
556
|
// if (latestInProgressRunData) {
|
|
553
|
-
// await
|
|
557
|
+
// await assistantClient.beta.threads.runs.cancel(
|
|
554
558
|
// latestInProgressRunData.thread_id,
|
|
555
559
|
// latestInProgressRunData.id,
|
|
556
560
|
// )
|
|
@@ -588,7 +592,7 @@ export const buildPOST = ({ prisma = defaultPrisma, onSuccessCreateThread = () =
|
|
|
588
592
|
}))
|
|
589
593
|
return;
|
|
590
594
|
if (latestInProgressRunData) {
|
|
591
|
-
await
|
|
595
|
+
await assistantClient.beta.threads.runs.cancel(latestInProgressRunData.id, {
|
|
592
596
|
thread_id: latestInProgressRunData.thread_id,
|
|
593
597
|
});
|
|
594
598
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/providers/[modelProviderId]/assistants/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/providers/[modelProviderId]/assistants/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;GAiDF,CAAA;AAEH,eAAO,MAAM,GAAG,aAtDF,WAAW,SACd;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;GAmDwB,CAAA;AAE7B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -2,11 +2,11 @@ import { headers } from 'next/headers';
|
|
|
2
2
|
import { ApiKeyType } from '@prisma/client';
|
|
3
3
|
import { NextResponse } from 'next/server';
|
|
4
4
|
import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import {
|
|
5
|
+
import { getPrisma } from '../../../../../lib/prisma';
|
|
6
6
|
import { getApiKey } from '../../../../../lib/apiKeys/getApiKey';
|
|
7
7
|
import { getStorageProviderAssistants } from '../../../../../lib/storageProviders/getStorageProviderAssistants';
|
|
8
8
|
import { serializeApiStorageProviderAssistant } from '../../../../../lib/storageProviders/serializeApiStorageProviderAssistant';
|
|
9
|
-
export const buildGET = ({ prisma =
|
|
9
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
10
10
|
const { modelProviderId } = await props.params;
|
|
11
11
|
const headersList = await headers();
|
|
12
12
|
const authorization = headersList.get('authorization');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/providers/[modelProviderId]/models/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/providers/[modelProviderId]/models/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;GAiDF,CAAA;AAEH,eAAO,MAAM,GAAG,aAtDF,WAAW,SACd;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;GAmDwB,CAAA;AAE7B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -2,11 +2,11 @@ import { headers } from 'next/headers';
|
|
|
2
2
|
import { ApiKeyType } from '@prisma/client';
|
|
3
3
|
import { NextResponse } from 'next/server';
|
|
4
4
|
import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import {
|
|
5
|
+
import { getPrisma } from '../../../../../lib/prisma';
|
|
6
6
|
import { getApiKey } from '../../../../../lib/apiKeys/getApiKey';
|
|
7
7
|
import { getModels } from '../../../../../lib/models/getModels';
|
|
8
8
|
import { serializeApiModel } from '../../../../../lib/models/serializeApiModel';
|
|
9
|
-
export const buildGET = ({ prisma =
|
|
9
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
10
10
|
const { modelProviderId } = await props.params;
|
|
11
11
|
const headersList = await headers();
|
|
12
12
|
const authorization = headersList.get('authorization');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/providers/[modelProviderId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAQ5D,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/providers/[modelProviderId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAQ5D,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;;;;GA+CF,CAAA;AAEH,eAAO,MAAM,GAAG,aApDF,WAAW,SACd;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;;;;GAiDwB,CAAA;AAE7B,eAAO,MAAM,UAAU,GACpB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;;;;GAkFF,CAAA;AAEH,eAAO,MAAM,KAAK,YAvFL,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;;;;GAoF4B,CAAA;AAEjC,eAAO,MAAM,WAAW,GACrB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;;;;GA8DF,CAAA;AAEH,eAAO,MAAM,MAAM,aAnEL,WAAW,SACd;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;;;;GAgE8B,CAAA;AAEnC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -3,11 +3,11 @@ import { ApiKeyType, ModelProviderType, } 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 {
|
|
6
|
+
import { getPrisma } from '../../../../lib/prisma';
|
|
7
7
|
import { serializeModelProvider } from '../../../../lib/modelProviders/serializeModelProvider';
|
|
8
8
|
import { getApiKey } from '../../../../lib/apiKeys/getApiKey';
|
|
9
9
|
import { validate } from 'uuid';
|
|
10
|
-
export const buildGET = ({ prisma =
|
|
10
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
11
11
|
const { modelProviderId } = await props.params;
|
|
12
12
|
const headersList = await headers();
|
|
13
13
|
const authorization = headersList.get('authorization');
|
|
@@ -39,7 +39,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
|
|
|
39
39
|
}, { headers: cacheHeaders });
|
|
40
40
|
};
|
|
41
41
|
export const GET = buildGET();
|
|
42
|
-
export const buildPATCH = ({ prisma =
|
|
42
|
+
export const buildPATCH = ({ prisma = getPrisma() } = {}) => async (request, props) => {
|
|
43
43
|
const { modelProviderId } = await props.params;
|
|
44
44
|
const headersList = await headers();
|
|
45
45
|
const authorization = headersList.get('authorization');
|
|
@@ -89,7 +89,7 @@ export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, p
|
|
|
89
89
|
}, { headers: cacheHeaders });
|
|
90
90
|
};
|
|
91
91
|
export const PATCH = buildPATCH();
|
|
92
|
-
export const buildDELETE = ({ prisma =
|
|
92
|
+
export const buildDELETE = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
93
93
|
const { modelProviderId } = await props.params;
|
|
94
94
|
const headersList = await headers();
|
|
95
95
|
const authorization = headersList.get('authorization');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/providers/route.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/providers/route.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO;;;;;;;;;;;;;;GAmCxD,CAAA;AAEH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;GAAa,CAAA;AAE7B,eAAO,MAAM,SAAS,GACnB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAClD,SAAS,WAAW;;;;;;;;;;;;;;GA6D1B,CAAA;AAEH,eAAO,MAAM,IAAI,YA/DC,WAAW;;;;;;;;;;;;;;GA+DE,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -3,10 +3,10 @@ import { ApiKeyType, ModelProviderType, } 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 {
|
|
6
|
+
import { getPrisma } from '../../../lib/prisma';
|
|
7
7
|
import { serializeModelProvider } from '../../../lib/modelProviders/serializeModelProvider';
|
|
8
8
|
import { getApiKey } from '../../../lib/apiKeys/getApiKey';
|
|
9
|
-
export const buildGET = ({ prisma =
|
|
9
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async () => {
|
|
10
10
|
const headersList = await headers();
|
|
11
11
|
const authorization = headersList.get('authorization');
|
|
12
12
|
if (!authorization) {
|
|
@@ -30,7 +30,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async () => {
|
|
|
30
30
|
}, { headers: cacheHeaders });
|
|
31
31
|
};
|
|
32
32
|
export const GET = buildGET();
|
|
33
|
-
export const buildPOST = ({ prisma =
|
|
33
|
+
export const buildPOST = ({ prisma = getPrisma() } = {}) => async (request) => {
|
|
34
34
|
const headersList = await headers();
|
|
35
35
|
const authorization = headersList.get('authorization');
|
|
36
36
|
if (!authorization) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/tasks/[taskId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAkB5D,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/tasks/[taskId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAkB5D,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;GA8C/C,CAAA;AAEH,eAAO,MAAM,GAAG,aAjDF,WAAW,SACd;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;GAgDrB,CAAA;AAE7B,eAAO,MAAM,UAAU,GACpB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,SAAS,WAAW,EACpB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;GAiF/C,CAAA;AAEH,eAAO,MAAM,KAAK,YApFL,WAAW,SACb;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;GAmFjB,CAAA;AAEjC,eAAO,MAAM,WAAW,GACrB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;GAkD/C,CAAA;AAEH,eAAO,MAAM,MAAM,aArDL,WAAW,SACd;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;GAoDf,CAAA;AAEnC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { NextResponse } from 'next/server';
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { validate } from 'uuid';
|
|
6
6
|
import { cacheHeaders } from '../../../../lib/cache/cacheHeaders';
|
|
7
|
-
import {
|
|
7
|
+
import { getPrisma } from '../../../../lib/prisma';
|
|
8
8
|
import { serializeTask } from '../../../../lib/tasks/serializeTask';
|
|
9
9
|
import { validateSchedule } from '../../../../lib/tasks/validateSchedule';
|
|
10
10
|
import { getApiKey } from '../../../../lib/apiKeys/getApiKey';
|
|
@@ -16,7 +16,7 @@ const updateTaskSchema = z.object({
|
|
|
16
16
|
schedule: z.any().optional(),
|
|
17
17
|
key: z.string().optional(),
|
|
18
18
|
});
|
|
19
|
-
export const buildGET = ({ prisma =
|
|
19
|
+
export const buildGET = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
20
20
|
const { taskId } = await props.params;
|
|
21
21
|
const headersList = await headers();
|
|
22
22
|
const authorization = headersList.get('authorization');
|
|
@@ -49,7 +49,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
|
|
|
49
49
|
return NextResponse.json({ task: serializeTask({ task }) }, { headers: cacheHeaders });
|
|
50
50
|
};
|
|
51
51
|
export const GET = buildGET();
|
|
52
|
-
export const buildPATCH = ({ prisma =
|
|
52
|
+
export const buildPATCH = ({ prisma = getPrisma() } = {}) => async (request, props) => {
|
|
53
53
|
const { taskId } = await props.params;
|
|
54
54
|
const headersList = await headers();
|
|
55
55
|
const authorization = headersList.get('authorization');
|
|
@@ -101,7 +101,7 @@ export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, p
|
|
|
101
101
|
return NextResponse.json({ task: serializeTask({ task }) }, { headers: cacheHeaders });
|
|
102
102
|
};
|
|
103
103
|
export const PATCH = buildPATCH();
|
|
104
|
-
export const buildDELETE = ({ prisma =
|
|
104
|
+
export const buildDELETE = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
|
|
105
105
|
const { taskId } = await props.params;
|
|
106
106
|
const headersList = await headers();
|
|
107
107
|
const authorization = headersList.get('authorization');
|