diff options
Diffstat (limited to 'apps/web/src/app/api')
| -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(); |