mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: Guest mode browsing history in the embed (#1272)
This commit is contained in:
@@ -191,3 +191,5 @@ test.py
|
||||
!/.venv/
|
||||
|
||||
sqlbot-xpack
|
||||
|
||||
.claude
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user