-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove Top K in retrieval testing #770 and if the document parsi…
…ng 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)
- Loading branch information
Showing
5 changed files
with
37 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters