perf: Advanced assistant encounters 401 error when viewing history

This commit is contained in:
fit2cloud-chenyw
2025-10-21 14:54:36 +08:00
committed by fit2cloud-chenyw
parent 346fd1c89e
commit f467cb319f
+4 -1
View File
@@ -75,7 +75,7 @@ class HttpService {
private setupInterceptors() {
// Request interceptor
this.instance.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
async (config: InternalAxiosRequestConfig) => {
// Add auth token
const token = wsCache.get('user.token')
if (token && config.headers) {
@@ -90,6 +90,9 @@ class HttpService {
!!(assistantStore.getType % 2) &&
assistantStore.getCertificate
) {
if (config.method?.toLowerCase() === 'get' && /\/chat\/\d+$/.test(config.url || '')) {
await assistantStore.refreshCertificate()
}
config.headers['X-SQLBOT-ASSISTANT-CERTIFICATE'] = btoa(
encodeURIComponent(assistantStore.getCertificate)
)