fix: openai model support

This commit is contained in:
Timothy J. Baek 2023-11-22 13:11:26 -08:00
parent 044ee2a78c
commit 1196fa886a
2 changed files with 7 additions and 6 deletions

View file

@ -85,6 +85,7 @@
}; };
const sendPromptOllama = async (model, userPrompt, parentId) => { const sendPromptOllama = async (model, userPrompt, parentId) => {
console.log('sendPromptOllama');
let responseMessageId = uuidv4(); let responseMessageId = uuidv4();
let responseMessage = { let responseMessage = {
@ -214,7 +215,7 @@
}; };
const sendPromptOpenAI = async (model, userPrompt, parentId) => { const sendPromptOpenAI = async (model, userPrompt, parentId) => {
if (settings.OPENAI_API_KEY) { if ($settings.OPENAI_API_KEY) {
if (models) { if (models) {
let responseMessageId = uuidv4(); let responseMessageId = uuidv4();
@ -242,7 +243,7 @@
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Authorization: `Bearer ${settings.OPENAI_API_KEY}` Authorization: `Bearer ${$settings.OPENAI_API_KEY}`
}, },
body: JSON.stringify({ body: JSON.stringify({
model: model, model: model,
@ -251,7 +252,7 @@
$settings.system $settings.system
? { ? {
role: 'system', role: 'system',
content: settings.system content: $settings.system
} }
: undefined, : undefined,
...messages ...messages

View file

@ -251,7 +251,7 @@
}; };
const sendPromptOpenAI = async (model, userPrompt, parentId) => { const sendPromptOpenAI = async (model, userPrompt, parentId) => {
if (settings.OPENAI_API_KEY) { if ($settings.OPENAI_API_KEY) {
if (models) { if (models) {
let responseMessageId = uuidv4(); let responseMessageId = uuidv4();
@ -279,7 +279,7 @@
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Authorization: `Bearer ${settings.OPENAI_API_KEY}` Authorization: `Bearer ${$settings.OPENAI_API_KEY}`
}, },
body: JSON.stringify({ body: JSON.stringify({
model: model, model: model,
@ -288,7 +288,7 @@
$settings.system $settings.system
? { ? {
role: 'system', role: 'system',
content: settings.system content: $settings.system
} }
: undefined, : undefined,
...messages ...messages