Skip to content

Commit 905d889

Browse files
perf: Guest mode browsing history in the embed (#1272)
1 parent 0b48781 commit 905d889

5 files changed

Lines changed: 2 additions & 24 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,5 @@ test.py
191191
!/.venv/
192192

193193
sqlbot-xpack
194+
195+
.claude

‎frontend/src/stores/assistant.ts‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { defineStore } from 'pinia'
22
import { store } from './index'
33
import { chatApi, ChatInfo } from '@/api/chat'
4-
import { useCache } from '@/utils/useCache'
5-
6-
const { wsCache } = useCache()
7-
const flagKey = 'sqlbit-assistant-flag'
84
type Resolver<T = any> = (value: T | PromiseLike<T>) => void
95
type Rejecter = (reason?: any) => void
106
interface PendingRequest<T = any> {
@@ -16,7 +12,6 @@ interface AssistantState {
1612
id: string
1713
token: string
1814
assistant: boolean
19-
flag: number
2015
type: number
2116
certificate: string
2217
online: boolean
@@ -35,7 +30,6 @@ export const AssistantStore = defineStore('assistant', {
3530
id: '',
3631
token: '',
3732
assistant: false,
38-
flag: 0,
3933
type: 0,
4034
certificate: '',
4135
online: false,
@@ -61,9 +55,6 @@ export const AssistantStore = defineStore('assistant', {
6155
getAssistant(): boolean {
6256
return this.assistant
6357
},
64-
getFlag(): number {
65-
return this.flag
66-
},
6758
getType(): number {
6859
return this.type
6960
},
@@ -176,14 +167,6 @@ export const AssistantStore = defineStore('assistant', {
176167
setAssistant(assistant: boolean) {
177168
this.assistant = assistant
178169
},
179-
setFlag(flag: number) {
180-
if (wsCache.get(flagKey)) {
181-
this.flag = wsCache.get(flagKey)
182-
} else {
183-
this.flag = flag
184-
wsCache.set(flagKey, flag)
185-
}
186-
},
187170
setPageEmbedded(embedded?: boolean) {
188171
this.pageEmbedded = !!embedded
189172
},
@@ -208,7 +191,6 @@ export const AssistantStore = defineStore('assistant', {
208191
return chat
209192
},
210193
clear() {
211-
wsCache.delete(flagKey)
212194
this.$reset()
213195
},
214196
},

‎frontend/src/views/embedded/common.vue‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ onBeforeMount(async () => {
104104
return
105105
}
106106
assistantStore.setType(4)
107-
const now = Date.now()
108-
assistantStore.setFlag(now)
109107
assistantStore.setId(assistantId?.toString() || '')
110108
assistantStore.setAssistant(true)
111109
registerReady(assistantId)

‎frontend/src/views/embedded/index.vue‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ onBeforeMount(async () => {
208208
const history: boolean = route.query.history !== 'false'
209209
assistantStore.setHistory(history)
210210
211-
const now = Date.now()
212-
assistantStore.setFlag(now)
213211
assistantStore.setId(assistantId?.toString() || '')
214212
/* const param = {
215213
id: assistantId,

‎frontend/src/views/embedded/page.vue‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,6 @@ onBeforeMount(async () => {
211211
if (userFlag && userFlag === '1') {
212212
userFlag = '100001'
213213
}
214-
const now = Date.now()
215-
assistantStore.setFlag(now)
216214
assistantStore.setId(assistantId?.toString() || '')
217215
if (assistantType === 4) {
218216
assistantStore.setAssistant(true)

0 commit comments

Comments
 (0)