mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 22:46:49 +00:00
[feature](webapp) upgrade chat version
This commit is contained in:
@@ -19,7 +19,7 @@ axiosInstance.interceptors.request.use(
|
||||
(config: any) => {
|
||||
const token = getToken();
|
||||
if (token && config?.headers) {
|
||||
config.headers.auth = `Bearer ${token}`;
|
||||
config.headers.Auth = `Bearer ${token}`;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
@@ -32,9 +32,16 @@ axiosInstance.interceptors.request.use(
|
||||
// 响应拦截器
|
||||
axiosInstance.interceptors.response.use(
|
||||
(response: any) => {
|
||||
if (Number(response.data.code) === 403) {
|
||||
window.location.href = '/#/login';
|
||||
return response;
|
||||
const redirect = response.headers.get('redirect');
|
||||
if (redirect === 'REDIRECT') {
|
||||
let win: any = window;
|
||||
while (win !== win.top) {
|
||||
win = win.top;
|
||||
}
|
||||
const contextpath = response.headers.get('contextpath');
|
||||
win.location.href =
|
||||
contextpath?.substring(0, contextpath?.indexOf('&')) +
|
||||
`&redirect_uri=${encodeURIComponent(`http://${win.location.host}`)}`;
|
||||
}
|
||||
return response;
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import axios from './axiosInstance';
|
||||
import { ChatContextType, HistoryType, MsgDataType, SearchRecommendItem } from '../common/type';
|
||||
import { QueryDataType } from '../common/type';
|
||||
|
||||
const DEFAULT_CHAT_ID = 2;
|
||||
const DEFAULT_CHAT_ID = 0;
|
||||
|
||||
const prefix = '/api';
|
||||
|
||||
@@ -57,7 +57,7 @@ export function getRelatedDimensionFromStatInfo(data: any) {
|
||||
|
||||
export function getMetricQueryInfo(data: any) {
|
||||
return axios.get<any>(
|
||||
`getMetricQueryInfo/${data.classId}/${data.metricName}`
|
||||
`/openapi/bd-bi/api/polaris/intelligentQuery/getMetricQueryInfo/${data.classId}/${data.metricName}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -67,4 +67,11 @@ export function saveConversation(chatName: string) {
|
||||
|
||||
export function getAllConversations() {
|
||||
return axios.get<Result<any>>(`${prefix}/chat/manage/getAll`);
|
||||
}
|
||||
|
||||
export function queryEntities(entityId: string | number, domainId: number) {
|
||||
return axios.post<Result<any>>(`${prefix}/chat/query/choice`, {
|
||||
entityId,
|
||||
domainId,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user