diff --git a/cope2n-ai-fi/configs/sdsap_sbt/configs.py b/cope2n-ai-fi/configs/sdsap_sbt/configs.py index 288a546..855e26b 100755 --- a/cope2n-ai-fi/configs/sdsap_sbt/configs.py +++ b/cope2n-ai-fi/configs/sdsap_sbt/configs.py @@ -29,7 +29,7 @@ kvu_model = { "option": "sbt_v2", "model": { "pretrained_model_path": "/workspace/cope2n-ai-fi/weights/layoutxlm-base", - "config": "/workspace/cope2n-ai-fi/weights/models/sdsvkvu/key_value_understanding_for_sbt-20240506-175534/base.yaml", - "checkpoint": "/workspace/cope2n-ai-fi/weights/models/sdsvkvu/key_value_understanding_for_sbt-20240506-175534/checkpoints/best_model.pth" + "config": "/workspace/cope2n-ai-fi/weights/models/sdsvkvu/key_value_understanding_for_sbt-20240603-081908/base.yaml", + "checkpoint": "/workspace/cope2n-ai-fi/weights/models/sdsvkvu/key_value_understanding_for_sbt-20240603-081908/checkpoints/best_model.pth" } } \ No newline at end of file diff --git a/cope2n-fe/src/pages/reviews2/FileCard.tsx b/cope2n-fe/src/pages/reviews2/FileCard.tsx index 3c7d715..9ca7bc5 100644 --- a/cope2n-fe/src/pages/reviews2/FileCard.tsx +++ b/cope2n-fe/src/pages/reviews2/FileCard.tsx @@ -5,7 +5,7 @@ const FileCard = ({ file, isSelected, onClick }) => { const fileName = file['File Name']; const extensionType = fileName.split('.').pop(); const isRequired = file['Is Required']; - const isReviewd = file['Is Reviewed']; + const isReviewed = file['Is Reviewed']; return (
{ > {isRequired ? ( <> - {isReviewd ? ( + {isReviewed ? ( { textTransform: 'capitalize', }} > - Reviewd + Reviewed ) : ( { const [selectedFileData, setSelectedFileData] = useState(null); const [selectedFileDataSource, setSelectedFileDataSource] = useState({}); const [selectedFileName, setSelectedFileName] = useState(null); - + const [isOpenConfirmRequest, setIsOpenConfirmRequest] = useState(false); // Default date range: 1 month ago to today const [filterDateRange, setFilterDateRange] = useState(['', '']); @@ -144,14 +144,16 @@ const ReviewPage = () => { if (isEmpty(tempData[k][REVIEWED_RESULT])) { isEmptyResult = true; } - if (Array.isArray(tempData[k][REVIEWED_RESULT]) && tempData[k][REVIEWED_RESULT].length > 0) { + if ( + Array.isArray(tempData[k][REVIEWED_RESULT]) && + tempData[k][REVIEWED_RESULT].length > 0 + ) { isEmptyResult = tempData[k][REVIEWED_RESULT].every((r: any) => isEmpty(r), ); } if (isEmptyResult) { tempData[k][REVIEWED_RESULT] = tempData[k][PREDICTED_RESULT]; - } } }); @@ -195,13 +197,17 @@ const ReviewPage = () => { } setSelectedFileName(fileName); - const response = await fetch(fileURL); - if (response.status === 200) { - setSelectedFileData(fileURL); - } else { + try { + const response = await fetch(fileURL); + if (response.status === 200) { + setSelectedFileData(fileURL); + } else { + setSelectedFileData('FAILED_TO_LOAD_FILE'); + } + } catch (error) { setSelectedFileData('FAILED_TO_LOAD_FILE'); - setImageLoading(false); } + setImageLoading(false); }; const loadCurrentRequest = (requestIndex) => { setLoading(true); @@ -284,23 +290,18 @@ const ReviewPage = () => { }; const handleConfirmReview = async () => { - const isConfirmed = window.confirm( - 'Are you sure you want to confirm this request is reviewed?', - ); - if (isConfirmed) { - try { - await updateRevisedData(currentRequest?.RequestID); - addRecentRequest(currentRequest?.RequestID); - setCurrentRequest({ - ...currentRequest, - ['Is Reviewed']: true, - }); - notification.success({ message: 'Update file success' }); - } catch (error) { - notification.error({ - message: getErrorMessage(error), - }); - } + try { + await updateRevisedData(currentRequest?.RequestID); + addRecentRequest(currentRequest?.RequestID); + setCurrentRequest({ + ...currentRequest, + ['Is Reviewed']: true, + }); + notification.success({ message: 'Update file success' }); + } catch (error) { + notification.error({ + message: getErrorMessage(error), + }); } }; @@ -310,13 +311,12 @@ const ReviewPage = () => { let request_file_result = {}; SOURCE_KEYS.forEach((k) => { request_file_result[k] = selectedFileDataSource[k][REVIEWED_RESULT]; - if(Array.isArray(selectedFileDataSource[k][REVIEWED_RESULT])){ - request_file_result[k] = selectedFileDataSource[k][REVIEWED_RESULT].toString(); - }else{ + if (Array.isArray(selectedFileDataSource[k][REVIEWED_RESULT])) { + request_file_result[k] = + selectedFileDataSource[k][REVIEWED_RESULT].toString(); + } else { request_file_result[k] = selectedFileDataSource[k][REVIEWED_RESULT]; } - - }); let data = { request_file_result, @@ -358,7 +358,7 @@ const ReviewPage = () => { const updateRevisedByFeedback = (fieldName) => { setSelectedFileDataSource((prevData) => { prevData[fieldName][REVIEWED_RESULT] = - prevData[fieldName][FEEDBACK_RESULT]; + prevData[fieldName][FEEDBACK_RESULT]; return { ...prevData, }; @@ -523,7 +523,17 @@ const ReviewPage = () => {
)} {selectedFileData === 'FAILED_TO_LOAD_FILE' ? ( -

Failed to load file.

+
+

Failed to load file.

+
) : fileExtension === 'pdf' ? (
{ size='middle' disabled={currentRequest && currentRequest['Is Reviewed']} style={{ minWidth: '120px' }} - onClick={handleConfirmReview} + onClick={() => setIsOpenConfirmRequest(true)} > - Confirm request + Confirm request
@@ -997,6 +1007,20 @@ const ReviewPage = () => { + { + setIsOpenConfirmRequest(false); + handleConfirmReview(); + }} + onCancel={() => { + setIsOpenConfirmRequest(false); + }} + > +

Are you sure you want to confirm this request is reviewed?

+
); }; diff --git a/cope2n-fe/src/request/api.ts b/cope2n-fe/src/request/api.ts index 36cf3c5..2eecbfb 100644 --- a/cope2n-fe/src/request/api.ts +++ b/cope2n-fe/src/request/api.ts @@ -11,7 +11,7 @@ const environment = process.env.NODE_ENV; const AXIOS_TIMEOUT_MS = 30 * 60 * 1000; // This config sastified long-live upload file request const EXPIRED_PASSWORD_SIGNAL = 'expired_password'; -export const baseURL = environment === 'development' ? 'http://107.120.133.27:9000/api' : '/api'; +export const baseURL = environment === 'development' ? 'http://107.120.133.27:9881/api' : '/api'; // export const baseURL = '/api';