diff options
| author | Dhravya <[email protected]> | 2024-04-08 18:39:32 -0700 |
|---|---|---|
| committer | Dhravya <[email protected]> | 2024-04-08 18:39:32 -0700 |
| commit | afd14a5dcdea26b98463dc8d643dabc9a4a16255 (patch) | |
| tree | f74c859a81a81a582e77446e5ccf9866a1aefb73 /apps/web/src/app | |
| parent | setup for multi chat (diff) | |
| download | supermemory-afd14a5dcdea26b98463dc8d643dabc9a4a16255.tar.xz supermemory-afd14a5dcdea26b98463dc8d643dabc9a4a16255.zip | |
messages streaminug
Diffstat (limited to 'apps/web/src/app')
| -rw-r--r-- | apps/web/src/app/api/chat/route.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/web/src/app/api/chat/route.ts b/apps/web/src/app/api/chat/route.ts index 2cb03186..ef59fd43 100644 --- a/apps/web/src/app/api/chat/route.ts +++ b/apps/web/src/app/api/chat/route.ts @@ -31,22 +31,25 @@ export async function POST(req: NextRequest) { chatHistory: ChatHistory[] }; + console.log("CHathistory", chatHistory) if (!query) { return new Response(JSON.stringify({ message: "Invalid query" }), { status: 400 }); } + const resp = await fetch(`https://cf-ai-backend.dhravya.workers.dev/chat?q=${query}&user=${session.user.email ?? session.user.name}&sourcesOnly=${sourcesOnly}`, { headers: { "X-Custom-Auth-Key": env.BACKEND_SECURITY_KEY, }, method: "POST", body: JSON.stringify({ - chatHistory + chatHistory: chatHistory.chatHistory ?? [] }) }) console.log(resp.status) + console.log(resp.statusText) if (resp.status !== 200 || !resp.ok) { const errorData = await resp.json(); |