From 750ee9d5b68bc6a763fb94f28c4ab14f7c24edf9 Mon Sep 17 00:00:00 2001 From: Oyelola Victoria <123843734+VriaA@users.noreply.github.com> Date: Wed, 18 Sep 2024 08:54:37 +0000 Subject: [PATCH] remove console.logs --- app/api/chat/route.js | 3 --- app/api/rag/route.js | 4 ---- 2 files changed, 7 deletions(-) diff --git a/app/api/chat/route.js b/app/api/chat/route.js index f6ebf44..9713b10 100644 --- a/app/api/chat/route.js +++ b/app/api/chat/route.js @@ -8,7 +8,6 @@ export async function POST(req) { try { // Parse the request body const data = await req.json(); - console.log('Received request body:', data); // Fetch chat completion from Groq const chatCompletion = await groq.chat.completions.create({ @@ -18,7 +17,6 @@ export async function POST(req) { // Prepare the response const responseContent = chatCompletion.choices[0]?.message?.content || "No content returned"; - console.log('Chat completion content:', responseContent); // Return the response as a stream const encoder = new TextEncoder(); @@ -36,7 +34,6 @@ export async function POST(req) { return new NextResponse(stream); } catch (error) { - console.error('Error in POST /api/chat:', error); // Return an error response const errorResponse = JSON.stringify({ diff --git a/app/api/rag/route.js b/app/api/rag/route.js index a13284f..a4fa8b5 100644 --- a/app/api/rag/route.js +++ b/app/api/rag/route.js @@ -33,7 +33,6 @@ async function fetchDocuments() { // Check if the request was successful if (!response.ok) { - console.log('Docs call failing') throw new Error(`Failed to fetch documents: ${response.statusText}`); } @@ -67,10 +66,8 @@ export async function POST(req, res) { try { // Fetch query embeddings const queryEmbedding = await fetchEmbeddings(question); - console.log('Embeddings fetched') // Fetch documents from MongoDB const docs = await fetchDocuments(); - console.log('Docs fetched') // Calculate similarity scores const scores = docs.map((doc) => ({ @@ -90,7 +87,6 @@ export async function POST(req, res) { "${context}". Here is the user question: "${question}"`; - console.log(`prompt given: ${context}`) return NextResponse.json({ prompt }, { status: 200 }); } catch (error) { return NextResponse.json({ message: "An error occurred" }, { status: 500 });