fix(gen_title) add openaiApiKey to request body

This commit is contained in:
Rafi
2023-04-18 14:25:21 +08:00
parent f1b5f8cf3c
commit 47951851c5

View File

@@ -24,12 +24,14 @@ export const addConversation = (conversation) => {
export const genTitle = async (conversationId) => { export const genTitle = async (conversationId) => {
const { $i18n } = useNuxtApp() const { $i18n, $settings } = useNuxtApp()
const openaiApiKey = useApiKey()
const { data, error } = await useAuthFetch('/api/gen_title/', { const { data, error } = await useAuthFetch('/api/gen_title/', {
method: 'POST', method: 'POST',
body: { body: {
conversationId: conversationId, conversationId: conversationId,
prompt: $i18n.t('genTitlePrompt') prompt: $i18n.t('genTitlePrompt'),
openaiApiKey: $settings.open_api_key_setting === 'True' ? openaiApiKey.value : null,
} }
}) })
if (!error.value) { if (!error.value) {