first commit

This commit is contained in:
jerryjzhang
2023-06-12 18:44:01 +08:00
commit dc4fc69b57
879 changed files with 573090 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
import axios from './axiosInstance';
import { ChatContextType, HistoryType, MsgDataType, SearchRecommendItem } from '../common/type';
import { QueryDataType } from '../common/type';
const DEFAULT_CHAT_ID = 0;
const prefix = '/api';
export function searchRecommend(queryText: string, chatId?: number, domainId?: number) {
return axios.post<Result<SearchRecommendItem[]>>(`${prefix}/chat/query/search`, {
queryText,
chatId: chatId || DEFAULT_CHAT_ID,
domainId,
});
}
export function chatQuery(queryText: string, chatId?: number, domainId?: number, isSaveQuestionAnswer?: boolean) {
return axios.post<Result<MsgDataType>>(`${prefix}/chat/query/query`, {
queryText,
chatId: chatId || DEFAULT_CHAT_ID,
domainId,
isSaveQuestionAnswer
});
}
export function queryData(chatContext: ChatContextType) {
return axios.post<Result<QueryDataType>>(`${prefix}/chat/query/queryData`, chatContext);
}
export function queryContext(queryText: string, chatId?: number) {
return axios.post<Result<ChatContextType>>(`${prefix}/chat/query/queryContext`, {
queryText,
chatId: chatId || DEFAULT_CHAT_ID,
});
}
export function querySuggestionInfo(domainId: number) {
return axios.get<Result<any>>(`${prefix}/chat/recommend/${domainId}`);
}
export function getHistoryMsg(current: number, chatId: number = DEFAULT_CHAT_ID, pageSize: number = 10) {
return axios.post<Result<HistoryType>>(`${prefix}/chat/manage/pageQueryInfo?chatId=${chatId}`, {
current,
pageSize,
});
}
export function queryMetricInfo(data: any) {
return axios.get(`/semantic/metric/getMetric/${data.classId}/${data.uniqueId}`);
}
export function getRelatedDimensionFromStatInfo(data: any) {
return axios.get(
`/semantic/metric/getRelatedDimensionFromStatInfo/${data.classId}/${data.uniqueId}`,
);
}
export function getMetricQueryInfo(data: any) {
return axios.get<any>(
`getMetricQueryInfo/${data.classId}/${data.metricName}`
);
}
export function saveConversation(chatName: string) {
return axios.post<Result<any>>(`${prefix}/chat/manage/save?chatName=${chatName}`);
}
export function getAllConversations() {
return axios.get<Result<any>>(`${prefix}/chat/manage/getAll`);
}