fix: remove Top K in retrieval testing #770 and if the document parsing fails, the error message returned by the backend is displayed (#782)

### What problem does this PR solve?

fix: remove Top K in retrieval testing  #770
fix: if the document parsing fails, the error message returned by the
backend is displayed.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2024-05-15 13:58:30 +08:00
committed by GitHub
parent 4d47b2b459
commit 5effbfac80
5 changed files with 37 additions and 20 deletions

View File

@@ -0,0 +1,18 @@
import axios from 'axios';
import { useCallback, useEffect, useState } from 'react';
export const useCatchDocumentError = (url: string) => {
const [error, setError] = useState<string>('');
const fetchDocument = useCallback(async () => {
const { data } = await axios.get(url);
if (data.retcode !== 0) {
setError(data?.retmsg);
}
}, [url]);
useEffect(() => {
fetchDocument();
}, [fetchDocument]);
return error;
};