This commit is contained in:
Avraham Sakal
2025-05-02 12:03:48 -04:00
parent a42b6a63bb
commit cb523bbe35
4 changed files with 0 additions and 25 deletions
-21
View File
@@ -23,27 +23,6 @@ const app = new Hono();
const openrouter = createOpenRouter({
apiKey: import.meta.env.VITE_OPENROUTER_API_KEY || env.OPENROUTER_API_KEY,
});
const systemMessage = {
role: "system",
content:
"You are a wise old man named Dorf that answers questions succintly.",
};
app.post("/api/chat", async (c) => {
const input = await c.req.json();
console.log(input);
const result = streamText({
model: openrouter("mistral/ministral-8b"),
messages: [systemMessage, ...input.messages],
tools: {},
});
// Mark the response as a v1 data stream:
c.header("X-Vercel-AI-Data-Stream", "v1");
c.header("Content-Type", "text/plain; charset=utf-8");
return stream(c, (stream) => stream.pipe(result.toDataStream()));
});
const agentsByName: Record<string, Agent> = {
assistant: personalAssistantAgent,