Skip to content

Commit

Permalink
remove console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
VriaA committed Sep 18, 2024
1 parent ccb933e commit 750ee9d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
3 changes: 0 additions & 3 deletions app/api/chat/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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();
Expand All @@ -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({
Expand Down
4 changes: 0 additions & 4 deletions app/api/rag/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}

Expand Down Expand Up @@ -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) => ({
Expand All @@ -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 });
Expand Down

0 comments on commit 750ee9d

Please sign in to comment.