From f68b1e78e01a8e43c5ae096694b59f1fcf08a185 Mon Sep 17 00:00:00 2001 From: Kar Date: Mon, 18 Nov 2024 19:14:04 +0530 Subject: [PATCH] limit resp --- src/routes/api/aiFollowupQuestion.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/routes/api/aiFollowupQuestion.js b/src/routes/api/aiFollowupQuestion.js index 3726db4..df653c3 100644 --- a/src/routes/api/aiFollowupQuestion.js +++ b/src/routes/api/aiFollowupQuestion.js @@ -1,7 +1,7 @@ const aiFollowupQuestion = async (req, res) => { const { MongoClient } = require('mongodb'); - const fetch = require('node-fetch'); + // const fetch = require('node-fetch'); const { v4: uuidv4 } = require('uuid'); const url = process.env.MONGODB_URL; const dbName = process.env.MONGO_DB_NAME; @@ -20,16 +20,18 @@ const aiFollowupQuestion = async (req, res) => { }, body: JSON.stringify({ model: model, - // messages: messages, - messages: [ - { role: "system", content: "reply must not exceed 20 words" }, - { role: "user", content: messages } - ], + messages: messages, + // messages: [ + // { role: "system", content: "reply must not exceed 20 words" }, + // { role: "user", content: messages } + // ], max_tokens: max_tokens, }), }); const data = await response.json(); + console.log(process.env.OPENAI_KEY) + console.log(data) return data; } @@ -50,7 +52,7 @@ const aiFollowupQuestion = async (req, res) => { conversation = { sessionId: newSessionId, conversationHistory: [ - { role: 'system', content: 'answer within 50 words' }, + { role: 'system', content: 'answer within 10 words' }, { role: 'user', content: prompt }, ], };