balibabu
fix: remove Top K in retrieval testing #770 and if the document parsing fails, the error message returned by the backend is displayed (#782)
e890f0a
| 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; | |
| }; | |