change model to claud 3.5

This commit is contained in:
dayuan.jiang
2025-04-03 15:10:53 +00:00
parent bc7ef5c5d4
commit 645980fbb6
5 changed files with 433 additions and 74 deletions

View File

@@ -1,17 +1,9 @@
import { google } from "@ai-sdk/google"; import { bedrock } from '@ai-sdk/amazon-bedrock';
import { openai } from "@ai-sdk/openai";
import { streamText } from "ai"; import { streamText } from "ai";
import { z } from "zod"; import { z } from "zod";
import { readFileSync } from 'fs';
import { resolve } from 'path';
// Allow streaming responses up to 30 seconds
export const maxDuration = 30;
// Read the XML guide from file // Read the XML guide from file
const guide = readFileSync(resolve('./app/api/chat/xml_guide.md'), 'utf8');
export async function POST(req: Request) { export async function POST(req: Request) {
const body = await req.json(); const body = await req.json();
@@ -40,18 +32,10 @@ Core capabilities:
- Structure complex systems into clear, organized visual components - Structure complex systems into clear, organized visual components
Note that: Note that:
- Always validate XML string integrity before output.
- Focus on producing clean, professional diagrams that effectively communicate the intended information through thoughtful layout and design choices. - Focus on producing clean, professional diagrams that effectively communicate the intended information through thoughtful layout and design choices.
- When artistic drawings are requested, creatively compose them using standard diagram shapes and connectors while maintaining visual clarity. - When artistic drawings are requested, creatively compose them using standard diagram shapes and connectors while maintaining visual clarity.
- **Don't** write out the XML string. Just return the XML string in the tool call. - **Don't** write out the XML string. Just return the XML string in the tool call.
- If user asks you to replicate a diagram based on an image, remember to match the diagram style and layout as closely as possible. Especially, pay attention to the lines and shapes, for example, if the lines are straight or curved, and if the shapes are rounded or square. - If user asks you to replicate a diagram based on an image, remember to match the diagram style and layout as closely as possible. Especially, pay attention to the lines and shapes, for example, if the lines are straight or curved, and if the shapes are rounded or square.
Here are the guide of XML format for draw.io:
"""md
${guide}
"""
`; `;
const lastMessage = messages[messages.length - 1]; const lastMessage = messages[messages.length - 1];
@@ -66,11 +50,14 @@ ${lastMessage.content}
"""`; """`;
let enhancedMessages = [{ role: "system", content: systemMessage }, ...messages]; let enhancedMessages = [{ role: "system", content: systemMessage }, ...messages];
enhancedMessages = [...enhancedMessages.slice(0, -1), { ...lastMessage, content: formattedContent }]; enhancedMessages = [...enhancedMessages.slice(0, -1), { ...lastMessage, content: formattedContent }];
console.log("Enhanced messages:", enhancedMessages); // console.log("Enhanced messages:", enhancedMessages);
const result = streamText({ const result = streamText({
// model: google("gemini-2.0-flash"), // model: google("gemini-2.5-pro-exp-03-25"),
// model: openai("chatgpt-4o-latest"), // model: google("gemini-2.0-flash-001"),
model: openai("gpt-4o"), // model: openrouter("google/gemini-2.0-flash-exp:free"),
model: bedrock('anthropic.claude-3-5-sonnet-20241022-v2:0'),
// model: openai("gpt-4o"),
toolCallStreaming: true, toolCallStreaming: true,
messages: enhancedMessages, messages: enhancedMessages,
tools: { tools: {
@@ -93,6 +80,5 @@ ${lastMessage.content}
}, },
temperature: 0, temperature: 0,
}); });
return result.toDataStreamResponse(); return result.toDataStreamResponse();
} }

View File

@@ -42,6 +42,7 @@ export function ChatMessageDisplay({
{ {
const currentXml = toolInvocation.args?.xml || ""; const currentXml = toolInvocation.args?.xml || "";
console.log("toolInvocation", toolInvocation);
// Increment the step counter // Increment the step counter
// Determine whether to show details based on a simple threshold // Determine whether to show details based on a simple threshold
@@ -54,7 +55,6 @@ export function ChatMessageDisplay({
convertedXml convertedXml
); );
onDisplayChart(replacedXML); onDisplayChart(replacedXML);
// if convertedXml changed // if convertedXml changed
} }
} }
@@ -69,7 +69,12 @@ export function ChatMessageDisplay({
<div className="text-xs text-gray-500 mt-1"> <div className="text-xs text-gray-500 mt-1">
Tool: display_diagram Tool: display_diagram
<div className="mt-1 font-mono text-xs"> <div className="mt-1 font-mono text-xs">
onDisplayChart Args:{" "}
{JSON.stringify(
toolInvocation.args,
null,
2
)}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -14,12 +14,14 @@ import { useChat } from "@ai-sdk/react";
import { ChatInput } from "@/components/chat-input"; import { ChatInput } from "@/components/chat-input";
import { ChatMessageDisplay } from "./chat-message-display"; import { ChatMessageDisplay } from "./chat-message-display";
import { useDiagram } from "@/contexts/diagram-context"; import { useDiagram } from "@/contexts/diagram-context";
import { replaceNodes } from "@/lib/utils";
export default function ChatPanel() { export default function ChatPanel() {
const { const {
loadDiagram: onDisplayChart, loadDiagram: onDisplayChart,
handleExport: onExport, handleExport: onExport,
resolverRef, resolverRef,
chartXML,
clearDiagram, clearDiagram,
} = useDiagram(); } = useDiagram();
@@ -61,7 +63,7 @@ export default function ChatPanel() {
if (toolCall.toolName === "display_diagram") { if (toolCall.toolName === "display_diagram") {
const { xml } = toolCall.args as { xml: string }; const { xml } = toolCall.args as { xml: string };
// do nothing because we will handle this streamingly in the ChatMessageDisplay component // do nothing because we will handle this streamingly in the ChatMessageDisplay component
// onDisplayChart(xml); onDisplayChart(replaceNodes(chartXML, xml));
return "Successfully displayed the flowchart."; return "Successfully displayed the flowchart.";
} }
}, },

456
package-lock.json generated
View File

@@ -8,15 +8,17 @@
"name": "next-ai-draw-io", "name": "next-ai-draw-io",
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"@ai-sdk/google": "^1.1.25", "@ai-sdk/amazon-bedrock": "^2.2.4",
"@ai-sdk/google": "^1.2.5",
"@ai-sdk/openai": "^1.2.5", "@ai-sdk/openai": "^1.2.5",
"@openrouter/ai-sdk-provider": "^0.4.5",
"@radix-ui/react-dialog": "^1.1.6", "@radix-ui/react-dialog": "^1.1.6",
"@radix-ui/react-scroll-area": "^1.2.3", "@radix-ui/react-scroll-area": "^1.2.3",
"@radix-ui/react-slot": "^1.1.2", "@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.8", "@radix-ui/react-tooltip": "^1.1.8",
"@vercel/analytics": "^1.5.0", "@vercel/analytics": "^1.5.0",
"@xmldom/xmldom": "^0.9.8", "@xmldom/xmldom": "^0.9.8",
"ai": "^4.1.62", "ai": "^4.2.11",
"base-64": "^1.0.0", "base-64": "^1.0.0",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
@@ -41,14 +43,17 @@
"typescript": "^5" "typescript": "^5"
} }
}, },
"node_modules/@ai-sdk/google": { "node_modules/@ai-sdk/amazon-bedrock": {
"version": "1.1.25", "version": "2.2.4",
"resolved": "https://registry.npmjs.org/@ai-sdk/google/-/google-1.1.25.tgz", "resolved": "https://registry.npmjs.org/@ai-sdk/amazon-bedrock/-/amazon-bedrock-2.2.4.tgz",
"integrity": "sha512-4eIssVphgVmAAsrDqWbH+YH0LXgHpXXY7ye7yuxK+fobpDifZ7LLLEwsbjtg9mfjwSUJ4dSyI/L5mlZ1eQqu0A==", "integrity": "sha512-KaHSwtEVG3CpxZr1wFoJlXQksRni7v9z5IGOju4pGQ2MNfwV6Zq1mmHl8wb2M3w4bb6GC+VpafubkeIRnI+Hrw==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@ai-sdk/provider": "1.0.11", "@ai-sdk/provider": "1.1.0",
"@ai-sdk/provider-utils": "2.1.13" "@ai-sdk/provider-utils": "2.2.3",
"@smithy/eventstream-codec": "^4.0.1",
"@smithy/util-utf8": "^4.0.0",
"aws4fetch": "^1.0.20"
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
@@ -57,6 +62,80 @@
"zod": "^3.0.0" "zod": "^3.0.0"
} }
}, },
"node_modules/@ai-sdk/amazon-bedrock/node_modules/@ai-sdk/provider": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-1.1.0.tgz",
"integrity": "sha512-0M+qjp+clUD0R1E5eWQFhxEvWLNaOtGQRUaBn8CUABnSKredagq92hUS9VjOzGsTm37xLfpaxl97AVtbeOsHew==",
"license": "Apache-2.0",
"dependencies": {
"json-schema": "^0.4.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@ai-sdk/amazon-bedrock/node_modules/@ai-sdk/provider-utils": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-2.2.3.tgz",
"integrity": "sha512-o3fWTzkxzI5Af7U7y794MZkYNEsxbjLam2nxyoUZSScqkacb7vZ3EYHLh21+xCcSSzEC161C7pZAGHtC0hTUMw==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/provider": "1.1.0",
"nanoid": "^3.3.8",
"secure-json-parse": "^2.7.0"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"zod": "^3.23.8"
}
},
"node_modules/@ai-sdk/google": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/@ai-sdk/google/-/google-1.2.5.tgz",
"integrity": "sha512-ykSPjYDmaDg7Qblo6Ea6n6O01NpyehZJE0j3+HCYBtUXKXP2RZWesr7XlceIfFBKHd0sumovRtX4ozHrb+1+sw==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/provider": "1.1.0",
"@ai-sdk/provider-utils": "2.2.3"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"zod": "^3.0.0"
}
},
"node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-1.1.0.tgz",
"integrity": "sha512-0M+qjp+clUD0R1E5eWQFhxEvWLNaOtGQRUaBn8CUABnSKredagq92hUS9VjOzGsTm37xLfpaxl97AVtbeOsHew==",
"license": "Apache-2.0",
"dependencies": {
"json-schema": "^0.4.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider-utils": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-2.2.3.tgz",
"integrity": "sha512-o3fWTzkxzI5Af7U7y794MZkYNEsxbjLam2nxyoUZSScqkacb7vZ3EYHLh21+xCcSSzEC161C7pZAGHtC0hTUMw==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/provider": "1.1.0",
"nanoid": "^3.3.8",
"secure-json-parse": "^2.7.0"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"zod": "^3.23.8"
}
},
"node_modules/@ai-sdk/openai": { "node_modules/@ai-sdk/openai": {
"version": "1.2.5", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/@ai-sdk/openai/-/openai-1.2.5.tgz", "resolved": "https://registry.npmjs.org/@ai-sdk/openai/-/openai-1.2.5.tgz",
@@ -109,13 +188,13 @@
} }
}, },
"node_modules/@ai-sdk/react": { "node_modules/@ai-sdk/react": {
"version": "1.1.23", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/@ai-sdk/react/-/react-1.1.23.tgz", "resolved": "https://registry.npmjs.org/@ai-sdk/react/-/react-1.2.5.tgz",
"integrity": "sha512-R+PG9ya0GLs6orzt+1MxmjrWFuZM0gVs+l8ihBr1u+42wwkVeojY4CAtQjW4nrfGTVbdJYkl5y+r/VKfjr42aQ==", "integrity": "sha512-0jOop3S2WkDOdO4X5I+5fTGqZlNX8/h1T1eYokpkR9xh8Vmrxqw8SsovqGvrddTsZykH8uXRsvI+G4FTyy894A==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@ai-sdk/provider-utils": "2.1.13", "@ai-sdk/provider-utils": "2.2.3",
"@ai-sdk/ui-utils": "1.1.19", "@ai-sdk/ui-utils": "1.2.4",
"swr": "^2.2.5", "swr": "^2.2.5",
"throttleit": "2.1.0" "throttleit": "2.1.0"
}, },
@@ -124,37 +203,87 @@
}, },
"peerDependencies": { "peerDependencies": {
"react": "^18 || ^19 || ^19.0.0-rc", "react": "^18 || ^19 || ^19.0.0-rc",
"zod": "^3.0.0" "zod": "^3.23.8"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"react": {
"optional": true
},
"zod": { "zod": {
"optional": true "optional": true
} }
} }
}, },
"node_modules/@ai-sdk/ui-utils": { "node_modules/@ai-sdk/react/node_modules/@ai-sdk/provider": {
"version": "1.1.19", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@ai-sdk/ui-utils/-/ui-utils-1.1.19.tgz", "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-1.1.0.tgz",
"integrity": "sha512-rDHy2uxlPMt3jjS9L6mBrsfhEInZ5BVoWevmD13fsAt2s/XWy2OwwKmgmUQkdLlY4mn/eyeYAfDGK8+5CbOAgg==", "integrity": "sha512-0M+qjp+clUD0R1E5eWQFhxEvWLNaOtGQRUaBn8CUABnSKredagq92hUS9VjOzGsTm37xLfpaxl97AVtbeOsHew==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@ai-sdk/provider": "1.0.11", "json-schema": "^0.4.0"
"@ai-sdk/provider-utils": "2.1.13", },
"engines": {
"node": ">=18"
}
},
"node_modules/@ai-sdk/react/node_modules/@ai-sdk/provider-utils": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-2.2.3.tgz",
"integrity": "sha512-o3fWTzkxzI5Af7U7y794MZkYNEsxbjLam2nxyoUZSScqkacb7vZ3EYHLh21+xCcSSzEC161C7pZAGHtC0hTUMw==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/provider": "1.1.0",
"nanoid": "^3.3.8",
"secure-json-parse": "^2.7.0"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"zod": "^3.23.8"
}
},
"node_modules/@ai-sdk/ui-utils": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@ai-sdk/ui-utils/-/ui-utils-1.2.4.tgz",
"integrity": "sha512-wLTxEZrKZRyBmlVZv8nGXgLBg5tASlqXwbuhoDu0MhZa467ZFREEnosH/OC/novyEHTQXko2zC606xoVbMrUcA==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/provider": "1.1.0",
"@ai-sdk/provider-utils": "2.2.3",
"zod-to-json-schema": "^3.24.1" "zod-to-json-schema": "^3.24.1"
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
}, },
"peerDependencies": { "peerDependencies": {
"zod": "^3.0.0" "zod": "^3.23.8"
},
"peerDependenciesMeta": {
"zod": {
"optional": true
} }
},
"node_modules/@ai-sdk/ui-utils/node_modules/@ai-sdk/provider": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-1.1.0.tgz",
"integrity": "sha512-0M+qjp+clUD0R1E5eWQFhxEvWLNaOtGQRUaBn8CUABnSKredagq92hUS9VjOzGsTm37xLfpaxl97AVtbeOsHew==",
"license": "Apache-2.0",
"dependencies": {
"json-schema": "^0.4.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@ai-sdk/ui-utils/node_modules/@ai-sdk/provider-utils": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-2.2.3.tgz",
"integrity": "sha512-o3fWTzkxzI5Af7U7y794MZkYNEsxbjLam2nxyoUZSScqkacb7vZ3EYHLh21+xCcSSzEC161C7pZAGHtC0hTUMw==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/provider": "1.1.0",
"nanoid": "^3.3.8",
"secure-json-parse": "^2.7.0"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"zod": "^3.23.8"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@@ -181,6 +310,82 @@
"lru-cache": "^10.4.3" "lru-cache": "^10.4.3"
} }
}, },
"node_modules/@aws-crypto/crc32": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz",
"integrity": "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==",
"license": "Apache-2.0",
"dependencies": {
"@aws-crypto/util": "^5.2.0",
"@aws-sdk/types": "^3.222.0",
"tslib": "^2.6.2"
},
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/@aws-crypto/util": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz",
"integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==",
"license": "Apache-2.0",
"dependencies": {
"@aws-sdk/types": "^3.222.0",
"@smithy/util-utf8": "^2.0.0",
"tslib": "^2.6.2"
}
},
"node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz",
"integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz",
"integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==",
"license": "Apache-2.0",
"dependencies": {
"@smithy/is-array-buffer": "^2.2.0",
"tslib": "^2.6.2"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz",
"integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==",
"license": "Apache-2.0",
"dependencies": {
"@smithy/util-buffer-from": "^2.2.0",
"tslib": "^2.6.2"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@aws-sdk/types": {
"version": "3.775.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.775.0.tgz",
"integrity": "sha512-ZoGKwa4C9fC9Av6bdfqcW6Ix5ot05F/S4VxWR2nHuMv7hzfmAjTOcUiWT7UR4hM/U0whf84VhDtXN/DWAk52KA==",
"license": "Apache-2.0",
"dependencies": {
"@smithy/types": "^4.2.0",
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@csstools/color-helpers": { "node_modules/@csstools/color-helpers": {
"version": "5.0.2", "version": "5.0.2",
"resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.0.2.tgz", "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.0.2.tgz",
@@ -389,6 +594,57 @@
"node": ">= 10" "node": ">= 10"
} }
}, },
"node_modules/@openrouter/ai-sdk-provider": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/@openrouter/ai-sdk-provider/-/ai-sdk-provider-0.4.5.tgz",
"integrity": "sha512-gbCOcSjNhyWlLHyYZX2rIFnpJi3C2RXNyyzJj+d6pMRfTS/mdvEEOsU66KxK9H8Qju2i9YRLOn/FdQT26K7bIQ==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/provider": "1.0.9",
"@ai-sdk/provider-utils": "2.1.10"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"zod": "^3.0.0"
}
},
"node_modules/@openrouter/ai-sdk-provider/node_modules/@ai-sdk/provider": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-1.0.9.tgz",
"integrity": "sha512-jie6ZJT2ZR0uVOVCDc9R2xCX5I/Dum/wEK28lx21PJx6ZnFAN9EzD2WsPhcDWfCgGx3OAZZ0GyM3CEobXpa9LA==",
"license": "Apache-2.0",
"dependencies": {
"json-schema": "^0.4.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@openrouter/ai-sdk-provider/node_modules/@ai-sdk/provider-utils": {
"version": "2.1.10",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-2.1.10.tgz",
"integrity": "sha512-4GZ8GHjOFxePFzkl3q42AU0DQOtTQ5w09vmaWUf/pKFXJPizlnzKSUkF0f+VkapIUfDugyMqPMT1ge8XQzVI7Q==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/provider": "1.0.9",
"eventsource-parser": "^3.0.0",
"nanoid": "^3.3.8",
"secure-json-parse": "^2.7.0"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"zod": "^3.0.0"
},
"peerDependenciesMeta": {
"zod": {
"optional": true
}
}
},
"node_modules/@opentelemetry/api": { "node_modules/@opentelemetry/api": {
"version": "1.9.0", "version": "1.9.0",
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz",
@@ -916,6 +1172,83 @@
"integrity": "sha512-A9+lCBZoaMJlVKcRBz2YByCG+Cp2t6nAnMnNba+XiWxnj6r4JUFqfsgwocMBZU9LPtdxC6wB56ySYpc7LQIoJg==", "integrity": "sha512-A9+lCBZoaMJlVKcRBz2YByCG+Cp2t6nAnMnNba+XiWxnj6r4JUFqfsgwocMBZU9LPtdxC6wB56ySYpc7LQIoJg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@smithy/eventstream-codec": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-4.0.2.tgz",
"integrity": "sha512-p+f2kLSK7ZrXVfskU/f5dzksKTewZk8pJLPvER3aFHPt76C2MxD9vNatSfLzzQSQB4FNO96RK4PSXfhD1TTeMQ==",
"license": "Apache-2.0",
"dependencies": {
"@aws-crypto/crc32": "5.2.0",
"@smithy/types": "^4.2.0",
"@smithy/util-hex-encoding": "^4.0.0",
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@smithy/is-array-buffer": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-4.0.0.tgz",
"integrity": "sha512-saYhF8ZZNoJDTvJBEWgeBccCg+yvp1CX+ed12yORU3NilJScfc6gfch2oVb4QgxZrGUx3/ZJlb+c/dJbyupxlw==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@smithy/types": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/@smithy/types/-/types-4.2.0.tgz",
"integrity": "sha512-7eMk09zQKCO+E/ivsjQv+fDlOupcFUCSC/L2YUPgwhvowVGWbPQHjEFcmjt7QQ4ra5lyowS92SV53Zc6XD4+fg==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@smithy/util-buffer-from": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-4.0.0.tgz",
"integrity": "sha512-9TOQ7781sZvddgO8nxueKi3+yGvkY35kotA0Y6BWRajAv8jjmigQ1sBwz0UX47pQMYXJPahSKEKYFgt+rXdcug==",
"license": "Apache-2.0",
"dependencies": {
"@smithy/is-array-buffer": "^4.0.0",
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@smithy/util-hex-encoding": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-4.0.0.tgz",
"integrity": "sha512-Yk5mLhHtfIgW2W2WQZWSg5kuMZCVbvhFmC7rV4IO2QqnZdbEFPmQnCcGMAX2z/8Qj3B9hYYNjZOhWym+RwhePw==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@smithy/util-utf8": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-4.0.0.tgz",
"integrity": "sha512-b+zebfKCfRdgNJDknHCob3O7FpeYQN6ZG6YLExMcasDHsCXlsXCEuiPZeLnJLpwa5dvPetGlnGCiMHuLwGvFow==",
"license": "Apache-2.0",
"dependencies": {
"@smithy/util-buffer-from": "^4.0.0",
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@swc/counter": { "node_modules/@swc/counter": {
"version": "0.1.3", "version": "0.1.3",
"license": "Apache-2.0" "license": "Apache-2.0"
@@ -1280,17 +1613,16 @@
} }
}, },
"node_modules/ai": { "node_modules/ai": {
"version": "4.1.62", "version": "4.2.11",
"resolved": "https://registry.npmjs.org/ai/-/ai-4.1.62.tgz", "resolved": "https://registry.npmjs.org/ai/-/ai-4.2.11.tgz",
"integrity": "sha512-+cEyxjOUUA4IxaPiPhmGSQHVrwFplDLqFADzmK0lRnLgacmtI4j1jWuT0HeqAHM3pVtKPYubbQNDuY1djc934A==", "integrity": "sha512-XvYFz+I2MNpkNeso/cEvm2q22cuU7B3EdUxGyhpa94gHbb3HEk73d42+UPJqweSBmoXA52mZ9qvb6jt3P4TITQ==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@ai-sdk/provider": "1.0.11", "@ai-sdk/provider": "1.1.0",
"@ai-sdk/provider-utils": "2.1.13", "@ai-sdk/provider-utils": "2.2.3",
"@ai-sdk/react": "1.1.23", "@ai-sdk/react": "1.2.5",
"@ai-sdk/ui-utils": "1.1.19", "@ai-sdk/ui-utils": "1.2.4",
"@opentelemetry/api": "1.9.0", "@opentelemetry/api": "1.9.0",
"eventsource-parser": "^3.0.0",
"jsondiffpatch": "0.6.0" "jsondiffpatch": "0.6.0"
}, },
"engines": { "engines": {
@@ -1298,17 +1630,43 @@
}, },
"peerDependencies": { "peerDependencies": {
"react": "^18 || ^19 || ^19.0.0-rc", "react": "^18 || ^19 || ^19.0.0-rc",
"zod": "^3.0.0" "zod": "^3.23.8"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"react": { "react": {
"optional": true "optional": true
},
"zod": {
"optional": true
} }
} }
}, },
"node_modules/ai/node_modules/@ai-sdk/provider": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-1.1.0.tgz",
"integrity": "sha512-0M+qjp+clUD0R1E5eWQFhxEvWLNaOtGQRUaBn8CUABnSKredagq92hUS9VjOzGsTm37xLfpaxl97AVtbeOsHew==",
"license": "Apache-2.0",
"dependencies": {
"json-schema": "^0.4.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/ai/node_modules/@ai-sdk/provider-utils": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-2.2.3.tgz",
"integrity": "sha512-o3fWTzkxzI5Af7U7y794MZkYNEsxbjLam2nxyoUZSScqkacb7vZ3EYHLh21+xCcSSzEC161C7pZAGHtC0hTUMw==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/provider": "1.1.0",
"nanoid": "^3.3.8",
"secure-json-parse": "^2.7.0"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"zod": "^3.23.8"
}
},
"node_modules/aria-hidden": { "node_modules/aria-hidden": {
"version": "1.2.4", "version": "1.2.4",
"resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.4.tgz", "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.4.tgz",
@@ -1327,6 +1685,12 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/aws4fetch": {
"version": "1.0.20",
"resolved": "https://registry.npmjs.org/aws4fetch/-/aws4fetch-1.0.20.tgz",
"integrity": "sha512-/djoAN709iY65ETD6LKCtyyEI04XIBP5xVvfmNxsEP0uJB5tyaGBztSryRr4HqMStr9R06PisQE7m9zDTXKu6g==",
"license": "MIT"
},
"node_modules/bail": { "node_modules/bail": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz",
@@ -4160,9 +4524,9 @@
} }
}, },
"node_modules/use-sync-external-store": { "node_modules/use-sync-external-store": {
"version": "1.4.0", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.4.0.tgz", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.5.0.tgz",
"integrity": "sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==", "integrity": "sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==",
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
@@ -4298,9 +4662,9 @@
} }
}, },
"node_modules/zod-to-json-schema": { "node_modules/zod-to-json-schema": {
"version": "3.24.4", "version": "3.24.5",
"resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.4.tgz", "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz",
"integrity": "sha512-0uNlcvgabyrni9Ag8Vghj21drk7+7tp7VTwwR7KxxXXc/3pbXz2PHlDgj3cICahgF1kHm4dExBFj7BXrZJXzig==", "integrity": "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==",
"license": "ISC", "license": "ISC",
"peerDependencies": { "peerDependencies": {
"zod": "^3.24.1" "zod": "^3.24.1"

View File

@@ -9,15 +9,17 @@
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {
"@ai-sdk/google": "^1.1.25", "@ai-sdk/amazon-bedrock": "^2.2.4",
"@ai-sdk/google": "^1.2.5",
"@ai-sdk/openai": "^1.2.5", "@ai-sdk/openai": "^1.2.5",
"@openrouter/ai-sdk-provider": "^0.4.5",
"@radix-ui/react-dialog": "^1.1.6", "@radix-ui/react-dialog": "^1.1.6",
"@radix-ui/react-scroll-area": "^1.2.3", "@radix-ui/react-scroll-area": "^1.2.3",
"@radix-ui/react-slot": "^1.1.2", "@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.8", "@radix-ui/react-tooltip": "^1.1.8",
"@vercel/analytics": "^1.5.0", "@vercel/analytics": "^1.5.0",
"@xmldom/xmldom": "^0.9.8", "@xmldom/xmldom": "^0.9.8",
"ai": "^4.1.62", "ai": "^4.2.11",
"base-64": "^1.0.0", "base-64": "^1.0.0",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",