Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix(assistant): reject restored ordinary sessions (#4356)
hahahahahayesyeseysaeeb72a61a19
diff --git a/frontend/src/components/assistant/AssistantPanel.test.ts b/frontend/src/components/assistant/AssistantPanel.test.tsindex 7aa86ad59..d368c3e09 100644--- a/frontend/src/components/assistant/AssistantPanel.test.ts+++ b/frontend/src/components/assistant/AssistantPanel.test.ts@@ -98,7 +98,7 @@ async function fixture('./AssistantAccessPicker.vue': emptyComponent,'@/api/chat': {createSessions: createSession,- getSession: api.getSession || (async () => ({ success: true, data: {} })),+ getSession: api.getSession || (async () => ({ success: true, data: { kind: 'assistant' } })),getSessionsList: async (...args: any[]) => {listCalls.push(args)return api.getSessionsList ? api.getSessionsList(...args) : { success: true, data: [], total: 0 }@@ -328,6 +328,19 @@ for (const status of [403, 404, 500]) {})}+test('stored ordinary session is rejected instead of mounting it as assistant history', async () => {+ const f = await fixture(undefined, undefined, {+ getSession: async () => ({ success: true, data: { id: 'workspace-b-session', kind: '' } }),+ })+ try {+ f.auth.effectiveTenantId = 2+ await flush()+ assert.equal(f.assistant.sessionId, '')+ assert.equal(f.sessionStorage.getItem('weknora:assistant-session:user-a:2'), null)+ assert.equal(f.mounted.length, 0)+ } finally { f.close() }+})+test('history distinguishes empty and failed loads and retries the same page', async () => {let failed = trueconst f = await fixture(undefined, undefined, {diff --git a/frontend/src/components/assistant/AssistantPanel.vue b/frontend/src/components/assistant/AssistantPanel.vueindex 52c832ce5..63f42839b 100644--- a/frontend/src/components/assistant/AssistantPanel.vue+++ b/frontend/src/components/assistant/AssistantPanel.vue@@ -344,8 +344,13 @@ async function validateSession(id: string) {return}try {- await getSession(id)- if (owner === conversationOwner.value && id === assistant.sessionId) readySessionId.value = id+ const res: any = await getSession(id)+ if (owner !== conversationOwner.value || id !== assistant.sessionId) return+ if (res?.data?.kind !== 'assistant') {+ startNewConversation()+ return+ }+ readySessionId.value = id} catch (error: any) {if (owner !== conversationOwner.value || id !== assistant.sessionId) returnconst status = error?.$httpStatus ?? error?.response?.status ?? error?.status