From bca1b35177a5dac39c5e963c80ebbbcb05bd9899 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Fri, 20 Dec 2024 01:32:36 +0800 Subject: [PATCH] fix: bad value --- packages/stage/src/components/Settings.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/stage/src/components/Settings.vue b/packages/stage/src/components/Settings.vue index 0788f83..62b3cf8 100644 --- a/packages/stage/src/components/Settings.vue +++ b/packages/stage/src/components/Settings.vue @@ -13,7 +13,18 @@ const show = ref(false) const dark = useDark({ disableTransition: false }) const supportedModels = ref<{ id: string, name?: string }[]>([]) const { models } = useLLM() -const { openAiApiBaseURL, openAiApiKey } = storeToRefs(settings) +const { openAiModel, openAiApiBaseURL, openAiApiKey } = storeToRefs(settings) + +function handleModelChange(event: Event) { + const target = event.target as HTMLSelectElement + const found = supportedModels.value.find(m => m.id === target.value) + if (!found) { + openAiModel.value = undefined + return + } + + openAiModel.value = found +} watch([openAiApiBaseURL, openAiApiKey], async ([baseUrl, apiKey]) => { if (!baseUrl || !apiKey) { @@ -164,8 +175,9 @@ onMounted(async () => {