mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-09 17:57:06 +08:00
perf: Assistant token
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user