mirror of
https://github.com/vitalityAI/therapist.git
synced 2025-04-08 05:40:17 -04:00
chore: chatjs formatting
This commit is contained in:
parent
07fbc1ab29
commit
ecdd45b638
12
src/chat.js
12
src/chat.js
|
@ -13,13 +13,13 @@ const openai = new OpenAIApi(configuration);
|
|||
const convertRole = (role) => {
|
||||
switch (role) {
|
||||
case Role.BOT:
|
||||
return "assistant"
|
||||
return "assistant";
|
||||
case Role.USER:
|
||||
return "user"
|
||||
return "user";
|
||||
default:
|
||||
return "user"
|
||||
}
|
||||
return "user";
|
||||
}
|
||||
};
|
||||
|
||||
export const chat = async (callId) => {
|
||||
const msgs = await getMessages(callId);
|
||||
|
@ -38,12 +38,12 @@ export const chat = async (callId) => {
|
|||
});
|
||||
}
|
||||
|
||||
console.log(messages)
|
||||
console.log(messages);
|
||||
|
||||
const res = await openai.createChatCompletion({
|
||||
model: "gpt-3.5-turbo",
|
||||
messages: messages,
|
||||
});
|
||||
|
||||
return res.data.choices[0].message.content
|
||||
return res.data.choices[0].message.content;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user