From 47951851c51f780e393dbcaadb1adb0952180748 Mon Sep 17 00:00:00 2001 From: Rafi Date: Tue, 18 Apr 2023 14:25:21 +0800 Subject: [PATCH] fix(gen_title) add `openaiApiKey` to request body --- utils/helper.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/helper.js b/utils/helper.js index 64bb18b..083f20b 100644 --- a/utils/helper.js +++ b/utils/helper.js @@ -24,12 +24,14 @@ export const addConversation = (conversation) => { export const genTitle = async (conversationId) => { - const { $i18n } = useNuxtApp() + const { $i18n, $settings } = useNuxtApp() + const openaiApiKey = useApiKey() const { data, error } = await useAuthFetch('/api/gen_title/', { method: 'POST', body: { conversationId: conversationId, - prompt: $i18n.t('genTitlePrompt') + prompt: $i18n.t('genTitlePrompt'), + openaiApiKey: $settings.open_api_key_setting === 'True' ? openaiApiKey.value : null, } }) if (!error.value) {