limit resp
parent
87afa13a42
commit
f68b1e78e0
|
@ -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 },
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue