perf: Guest mode browsing history in the embed (#1272)

This commit is contained in:
fit2cloud-chenyw
2026-07-14 17:59:38 +08:00
committed by GitHub
parent 0b4878199f
commit 905d889d36
5 changed files with 2 additions and 24 deletions
+2
View File
@@ -191,3 +191,5 @@ test.py
!/.venv/
sqlbot-xpack
.claude
-18
View File
@@ -1,10 +1,6 @@
import { defineStore } from 'pinia'
import { store } from './index'
import { chatApi, ChatInfo } from '@/api/chat'
import { useCache } from '@/utils/useCache'
const { wsCache } = useCache()
const flagKey = 'sqlbit-assistant-flag'
type Resolver<T = any> = (value: T | PromiseLike<T>) => void
type Rejecter = (reason?: any) => void
interface PendingRequest<T = any> {
@@ -16,7 +12,6 @@ interface AssistantState {
id: string
token: string
assistant: boolean
flag: number
type: number
certificate: string
online: boolean
@@ -35,7 +30,6 @@ export const AssistantStore = defineStore('assistant', {
id: '',
token: '',
assistant: false,
flag: 0,
type: 0,
certificate: '',
online: false,
@@ -61,9 +55,6 @@ export const AssistantStore = defineStore('assistant', {
getAssistant(): boolean {
return this.assistant
},
getFlag(): number {
return this.flag
},
getType(): number {
return this.type
},
@@ -176,14 +167,6 @@ export const AssistantStore = defineStore('assistant', {
setAssistant(assistant: boolean) {
this.assistant = assistant
},
setFlag(flag: number) {
if (wsCache.get(flagKey)) {
this.flag = wsCache.get(flagKey)
} else {
this.flag = flag
wsCache.set(flagKey, flag)
}
},
setPageEmbedded(embedded?: boolean) {
this.pageEmbedded = !!embedded
},
@@ -208,7 +191,6 @@ export const AssistantStore = defineStore('assistant', {
return chat
},
clear() {
wsCache.delete(flagKey)
this.$reset()
},
},
-2
View File
@@ -104,8 +104,6 @@ onBeforeMount(async () => {
return
}
assistantStore.setType(4)
const now = Date.now()
assistantStore.setFlag(now)
assistantStore.setId(assistantId?.toString() || '')
assistantStore.setAssistant(true)
registerReady(assistantId)
-2
View File
@@ -208,8 +208,6 @@ onBeforeMount(async () => {
const history: boolean = route.query.history !== 'false'
assistantStore.setHistory(history)
const now = Date.now()
assistantStore.setFlag(now)
assistantStore.setId(assistantId?.toString() || '')
/* const param = {
id: assistantId,
-2
View File
@@ -211,8 +211,6 @@ onBeforeMount(async () => {
if (userFlag && userFlag === '1') {
userFlag = '100001'
}
const now = Date.now()
assistantStore.setFlag(now)
assistantStore.setId(assistantId?.toString() || '')
if (assistantType === 4) {
assistantStore.setAssistant(true)