mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: Advanced assistant encounters 401 error when viewing history
This commit is contained in:
committed by
fit2cloud-chenyw
parent
346fd1c89e
commit
f467cb319f
@@ -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)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user