From d97fcce0bd55e54432ee739b5675acbe5d26cff2 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Thu, 23 Jan 2025 15:10:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E4=BA=A7=E5=BA=93=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/lang/en.ts | 1 + src/store/conversation.ts | 1 - src/views/dialogue/dialogueView.vue | 20 ++++++++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/i18n/lang/en.ts b/src/i18n/lang/en.ts index 2c2601a..8799027 100644 --- a/src/i18n/lang/en.ts +++ b/src/i18n/lang/en.ts @@ -173,6 +173,7 @@ export default { }, witChainD: { witChainD: "WitChainD", + witChainD_id: "id", describe_the_witChainD: "Please enter witChainD id", }, flow: { diff --git a/src/store/conversation.ts b/src/store/conversation.ts index 2dd5b22..5e09718 100644 --- a/src/store/conversation.ts +++ b/src/store/conversation.ts @@ -459,7 +459,6 @@ export const useSessionStore = defineStore('conversation', () => { user_selected_flow?: string, params?: any, ): Promise => { - const groupId = groupId?groupId:""; const { updateSessionTitle, currentSelectedSession } = useHistorySessionStore(); if (conversationList.value.length === 0) { // 如果当前还没有对话记录,将第一个问题的questtion作为对话标题 diff --git a/src/views/dialogue/dialogueView.vue b/src/views/dialogue/dialogueView.vue index b024abd..fb0b0ce 100644 --- a/src/views/dialogue/dialogueView.vue +++ b/src/views/dialogue/dialogueView.vue @@ -20,6 +20,7 @@ import AppIconSelected from '@/assets/svgs/appIconSelected.svg'; import WitchainDIcon from '@/assets/images/witchainD.png'; import WitchainDIconSelected from '@/assets/svgs/WitchainDSelected.svg'; import { useRouter } from 'vue-router'; +import { reactive } from 'vue'; // 挂载全局事件 window.onHtmlEventDispatch = onHtmlEventDispatch as any; const { logout } = useAccountStore(); @@ -50,9 +51,8 @@ export interface ModelForm { openai_api_key?: string; [property: string]: any; } -const kb_id = localStorage.getItem('kb_id') || ''; -const ruleForm = ref({ - kb_id: kb_id, +const ruleForm = reactive({ + kb_id: "", }); const rules = ref(); @@ -144,13 +144,14 @@ const lang = computed(() => (language.value === 'EN' ? 'English' : '简体中文 const handleConfirmCreateModel = async (formData: any | undefined) => { const [_, res] = await api.updateKnowledgeList({ - kb_id: ruleForm.value.kb_id || '', + kb_id: ruleForm.kb_id || '', }); if (!_ && res) { - localStorage.setItem('kb_id', ruleForm.value.kb_id || ''); + localStorage.setItem('kb_id', ruleForm.kb_id || ''); ElMessage.success('成功'); KnowledgeVisible.value = false; } else { + ruleForm.kb_id = ''; ElMessage.error('失败'); KnowledgeVisible.value = false; } @@ -171,15 +172,18 @@ onMounted(() => { api.getKnowledgeList().then(res => { ruleForm.value = res; }); + if(localStorage.getItem('kb_id')){ + ruleForm.kb_id = localStorage.getItem('kb_id'); + } }); watch( ruleForm, () => { let flag = false; - Object.keys(ruleForm.value).forEach(item => { + Object.keys(ruleForm).forEach(item => { if (rules.value?.[item]?.[0]?.required) { - if (!ruleForm.value?.[item]?.toString()?.length) { + if (!ruleForm?.[item]?.toString()?.length) { flag = true; } } @@ -294,7 +298,7 @@ watch( title="WitChainD" > - +