Merge branch 'feat/dev-0.6' of https://github.com/eosphoros-ai/DB-GPT into feat/dev-0.6

This commit is contained in:
yhjun1026
2024-08-19 16:21:40 +08:00
6 changed files with 11 additions and 11 deletions

View File

@@ -5,8 +5,8 @@ import { SearchDocumentParams } from '@/types/knowledge';
/**
* 知识库编辑搜索
*/
export const searchDocumentList = (id: string, data: SearchDocumentParams) => {
return POST<SearchDocumentParams, { data: string[]; total: number; page: number }>(`/knowledge/${id}/document/list`, data);
export const searchDocumentList = (spaceName: string, data: SearchDocumentParams) => {
return POST<SearchDocumentParams, { data: string[]; total: number; page: number }>(`/knowledge/${spaceName}/document/list`, data);
};
/**

View File

@@ -164,7 +164,7 @@ export const saveArguments = (knowledgeName: string, data: ArgumentsParams) => {
export const getSpaceList = (data: any) => {
return POST<any, Array<ISpace>>('/knowledge/space/list', data);
};
export const getDocumentList = (spaceName: number, data: Record<string, number | Array<number>>) => {
export const getDocumentList = (spaceName: string, data: Record<string, number | Array<number>>) => {
return POST<Record<string, number | Array<number>>, IDocumentResponse>(`/knowledge/${spaceName}/document/list`, data);
};
export const getGraphVis = (spaceName: string, data: { limit: number }) => {

View File

@@ -21,7 +21,7 @@ const RecallTestModal: React.FC<RecallTestModalProps> = ({ open, setOpen, space
// 获取推荐问题
const { data: questions = [], run: questionsRun } = useRequest(
async () => {
const [, res] = await apiInterceptors(recallTestRecommendQuestion(space.id + ''));
const [, res] = await apiInterceptors(recallTestRecommendQuestion(space.name + ''));
return res ?? [];
},
{
@@ -32,7 +32,7 @@ const RecallTestModal: React.FC<RecallTestModalProps> = ({ open, setOpen, space
// 召回方法选项
const { data: options = [], run: optionsRun } = useRequest(
async () => {
const [, res] = await apiInterceptors(recallMethodOptions(space.id + ''));
const [, res] = await apiInterceptors(recallMethodOptions(space.name + ''));
return res ?? [];
},
{
@@ -57,7 +57,7 @@ const RecallTestModal: React.FC<RecallTestModalProps> = ({ open, setOpen, space
loading,
} = useRequest(
async (props: RecallTestProps) => {
const [, res] = await apiInterceptors(recallTest({ ...props }, space.id + ''));
const [, res] = await apiInterceptors(recallTest({ ...props }, space.name + ''));
return res ?? [];
},
{

View File

@@ -20,7 +20,7 @@ export default function ArgumentsModal({ space, argumentsShow, setArgumentsShow
const [spinning, setSpinning] = useState<boolean>(false);
const fetchArguments = async () => {
const [_, data] = await apiInterceptors(getArguments(space.id));
const [_, data] = await apiInterceptors(getArguments(space.name));
setNewSpaceArguments(data);
};
@@ -145,7 +145,7 @@ export default function ArgumentsModal({ space, argumentsShow, setArgumentsShow
const handleSubmit = async (fieldsValue: IArguments) => {
setSpinning(true);
const [_, data, res] = await apiInterceptors(
saveArguments(space.id, {
saveArguments(space.name, {
argument: JSON.stringify(fieldsValue),
}),
);

View File

@@ -117,7 +117,7 @@ export default function DocPanel(props: IProps) {
} = useRequest(
async () =>
await apiInterceptors(
getDocumentList(+space.id, {
getDocumentList(space.name, {
page: currentPageRef.current,
page_size,
}),
@@ -139,7 +139,7 @@ export default function DocPanel(props: IProps) {
}
currentPageRef.current += 1;
const [_, data] = await apiInterceptors(
getDocumentList(+space.id, {
getDocumentList(space.name, {
page: currentPageRef.current,
page_size,
}),

View File

@@ -103,7 +103,7 @@ const useChat = ({ queryAgentURL = '/api/v1/chat/completions', app_code }: Props
onError?.('Sorry, We meet some error, please try agin later.', err as Error);
}
},
[queryAgentURL, app_code],
[queryAgentURL, app_code, scene],
);
return { chat, ctrl };