[feature](webapp) upgrade chat version

This commit is contained in:
williamhliu
2023-06-30 17:42:03 +08:00
parent 8639c23dc4
commit 805a59dddd
69 changed files with 1570 additions and 842 deletions

View File

@@ -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;
},

View File

@@ -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,
});
}