SettingScreen.vue
1 <script setup lang="ts"> 2 import SettingPage from '@/renderer/components/pages/SettingPage.vue' 3 import { useChatbotStore } from '@/renderer/store/chatbot' 4 import { computed } from 'vue' 5 6 import type { ChatbotConfig } from '@/types/llm' 7 8 const chatbotStore = useChatbotStore() 9 10 const currentConfig = computed(() => { 11 return chatbotStore.getChatbotByIndex(chatbotStore.currentChatbotId) 12 }) 13 14 const handleConfigUpdate = (patch: Partial<ChatbotConfig>) => { 15 chatbotStore.updateChatbotConfig(chatbotStore.currentChatbotId, patch) 16 } 17 18 const batchApiKey = (apiCli: string, apiKey: string) => { 19 chatbotStore.batchChatbotApiKey(apiCli, apiKey) 20 } 21 </script> 22 23 <template> 24 <SettingPage 25 v-if="currentConfig" 26 :config="currentConfig" 27 @update:config="handleConfigUpdate" 28 @batch:token="batchApiKey" 29 /> 30 </template>