From 1196fa886a7a14f63ac01c50bb3d9e892140b2b9 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Wed, 22 Nov 2023 13:11:26 -0800 Subject: [PATCH] fix: openai model support --- src/routes/(app)/+page.svelte | 7 ++++--- src/routes/(app)/c/[id]/+page.svelte | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index bcfa40618..3df52bee0 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -85,6 +85,7 @@ }; const sendPromptOllama = async (model, userPrompt, parentId) => { + console.log('sendPromptOllama'); let responseMessageId = uuidv4(); let responseMessage = { @@ -214,7 +215,7 @@ }; const sendPromptOpenAI = async (model, userPrompt, parentId) => { - if (settings.OPENAI_API_KEY) { + if ($settings.OPENAI_API_KEY) { if (models) { let responseMessageId = uuidv4(); @@ -242,7 +243,7 @@ method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${settings.OPENAI_API_KEY}` + Authorization: `Bearer ${$settings.OPENAI_API_KEY}` }, body: JSON.stringify({ model: model, @@ -251,7 +252,7 @@ $settings.system ? { role: 'system', - content: settings.system + content: $settings.system } : undefined, ...messages diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 410f04d66..00070f900 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -251,7 +251,7 @@ }; const sendPromptOpenAI = async (model, userPrompt, parentId) => { - if (settings.OPENAI_API_KEY) { + if ($settings.OPENAI_API_KEY) { if (models) { let responseMessageId = uuidv4(); @@ -279,7 +279,7 @@ method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${settings.OPENAI_API_KEY}` + Authorization: `Bearer ${$settings.OPENAI_API_KEY}` }, body: JSON.stringify({ model: model, @@ -288,7 +288,7 @@ $settings.system ? { role: 'system', - content: settings.system + content: $settings.system } : undefined, ...messages