From a7806b7325079bea99e5a9309b0f2bc1f744fc6e Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 21 Oct 2025 14:51:44 +0800 Subject: [PATCH] perf: Advanced assistant encounters 401 error when viewing history --- frontend/src/utils/request.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/utils/request.ts b/frontend/src/utils/request.ts index 63b6ed70..cbf22931 100644 --- a/frontend/src/utils/request.ts +++ b/frontend/src/utils/request.ts @@ -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) )