limit resp
parent
87afa13a42
commit
f68b1e78e0
|
@ -1,7 +1,7 @@
|
||||||
const aiFollowupQuestion = async (req, res) => {
|
const aiFollowupQuestion = async (req, res) => {
|
||||||
|
|
||||||
const { MongoClient } = require('mongodb');
|
const { MongoClient } = require('mongodb');
|
||||||
const fetch = require('node-fetch');
|
// const fetch = require('node-fetch');
|
||||||
const { v4: uuidv4 } = require('uuid');
|
const { v4: uuidv4 } = require('uuid');
|
||||||
const url = process.env.MONGODB_URL;
|
const url = process.env.MONGODB_URL;
|
||||||
const dbName = process.env.MONGO_DB_NAME;
|
const dbName = process.env.MONGO_DB_NAME;
|
||||||
|
@ -20,16 +20,18 @@ const aiFollowupQuestion = async (req, res) => {
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
model: model,
|
model: model,
|
||||||
// messages: messages,
|
messages: messages,
|
||||||
messages: [
|
// messages: [
|
||||||
{ role: "system", content: "reply must not exceed 20 words" },
|
// { role: "system", content: "reply must not exceed 20 words" },
|
||||||
{ role: "user", content: messages }
|
// { role: "user", content: messages }
|
||||||
],
|
// ],
|
||||||
max_tokens: max_tokens,
|
max_tokens: max_tokens,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
console.log(process.env.OPENAI_KEY)
|
||||||
|
console.log(data)
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +52,7 @@ const aiFollowupQuestion = async (req, res) => {
|
||||||
conversation = {
|
conversation = {
|
||||||
sessionId: newSessionId,
|
sessionId: newSessionId,
|
||||||
conversationHistory: [
|
conversationHistory: [
|
||||||
{ role: 'system', content: 'answer within 50 words' },
|
{ role: 'system', content: 'answer within 10 words' },
|
||||||
{ role: 'user', content: prompt },
|
{ role: 'user', content: prompt },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue