perf: Assistant token

This commit is contained in:
fit2cloud-chenyw
2025-07-10 12:43:14 +08:00
parent 4bd69b845f
commit e69caadd09
10 changed files with 149 additions and 58 deletions
+6
View File
@@ -10,6 +10,8 @@ import axios, {
import { useCache } from '@/utils/useCache'
import { getLocale } from './utils'
import { useAssistantStore } from '@/stores/assistant'
const assistantStore = useAssistantStore()
const { wsCache } = useCache()
// Response data structure
export interface ApiResponse<T = unknown> {
@@ -70,6 +72,10 @@ class HttpService {
if (token && config.headers) {
config.headers['X-SQLBOT-TOKEN'] = `Bearer ${token}`
}
if (assistantStore.getToken) {
config.headers['X-SQLBOT-ASSISTANT-TOKEN'] = `Assistant ${assistantStore.getToken}`
if (config.headers['X-SQLBOT-TOKEN']) config.headers.delete('X-SQLBOT-TOKEN')
}
const locale = getLocale()
if (locale) {
/* const mapping = {