kyd-shared-badge 0.3.36 → 0.3.38
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/package.json +2 -2
- package/src/ambient-ai.d.ts +2 -2
- package/src/lib/routes.ts +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kyd-shared-badge",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.38",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"module": "./src/index.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"react-dom": "^19.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@ai-sdk/
|
|
19
|
+
"@ai-sdk/openai": "^2.0.42",
|
|
20
20
|
"@aws-sdk/client-s3": "^3.893.0",
|
|
21
21
|
"@aws-sdk/lib-dynamodb": "^3.893.0",
|
|
22
22
|
"@chatscope/chat-ui-kit-react": "^2.1.1",
|
package/src/ambient-ai.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ declare module 'ai' {
|
|
|
2
2
|
export function streamText(args: any): any;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
declare module '@ai-sdk/
|
|
5
|
+
declare module '@ai-sdk/openai' {
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
-
export function
|
|
7
|
+
export function createOpenAI(config?: any): (model: string, options?: any) => any;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
|
package/src/lib/routes.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { NextRequest } from 'next/server';
|
|
5
5
|
import { streamText } from 'ai';
|
|
6
|
-
import {
|
|
6
|
+
import { createOpenAI } from '@ai-sdk/openai';
|
|
7
7
|
|
|
8
8
|
import { getHistory, putMessage } from './chat-store';
|
|
9
9
|
import {
|
|
@@ -42,8 +42,13 @@ export async function chatStreamRoute(req: NextRequest, userId: string, companyI
|
|
|
42
42
|
const system = buildAllContextPrompt(cleaned, graphData, { concise: true });
|
|
43
43
|
const history = await getHistory(sessionId, 20);
|
|
44
44
|
|
|
45
|
+
const openrouter = createOpenAI({
|
|
46
|
+
apiKey: process.env.OPENROUTER_API_KEY,
|
|
47
|
+
baseURL: 'https://openrouter.ai/api/v1',
|
|
48
|
+
});
|
|
49
|
+
|
|
45
50
|
const result = await streamText({
|
|
46
|
-
model:
|
|
51
|
+
model: openrouter('openai/o4-mini'),
|
|
47
52
|
system,
|
|
48
53
|
messages: [...history, { role: 'user' as const, content }],
|
|
49
54
|
maxTokens: 1024,
|