Skip to content

Commit f467cb3

Browse files
perf: Advanced assistant encounters 401 error when viewing history
1 parent 346fd1c commit f467cb3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

frontend/src/utils/request.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class HttpService {
7575
private setupInterceptors() {
7676
// Request interceptor
7777
this.instance.interceptors.request.use(
78-
(config: InternalAxiosRequestConfig) => {
78+
async (config: InternalAxiosRequestConfig) => {
7979
// Add auth token
8080
const token = wsCache.get('user.token')
8181
if (token && config.headers) {
@@ -90,6 +90,9 @@ class HttpService {
9090
!!(assistantStore.getType % 2) &&
9191
assistantStore.getCertificate
9292
) {
93+
if (config.method?.toLowerCase() === 'get' && /\/chat\/\d+$/.test(config.url || '')) {
94+
await assistantStore.refreshCertificate()
95+
}
9396
config.headers['X-SQLBOT-ASSISTANT-CERTIFICATE'] = btoa(
9497
encodeURIComponent(assistantStore.getCertificate)
9598
)

0 commit comments

Comments
 (0)