Merge branch 'main' of https://code.sdsdev.co.kr/SDSRV-IDP/sbt-idp into dev/logging

This commit is contained in:
TannedCung 2024-06-26 15:51:51 +07:00
commit 68e0cff28b
4 changed files with 64 additions and 40 deletions

View File

@ -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"
}
}

View File

@ -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 (
<div
@ -60,7 +60,7 @@ const FileCard = ({ file, isSelected, onClick }) => {
>
{isRequired ? (
<>
{isReviewd ? (
{isReviewed ? (
<Tag
color={'success'}
style={{
@ -69,7 +69,7 @@ const FileCard = ({ file, isSelected, onClick }) => {
textTransform: 'capitalize',
}}
>
Reviewd
Reviewed
</Tag>
) : (
<Tag

View File

@ -63,7 +63,7 @@ const ReviewPage = () => {
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);
try {
const response = await fetch(fileURL);
if (response.status === 200) {
setSelectedFileData(fileURL);
} else {
setSelectedFileData('FAILED_TO_LOAD_FILE');
setImageLoading(false);
}
} catch (error) {
setSelectedFileData('FAILED_TO_LOAD_FILE');
}
setImageLoading(false);
};
const loadCurrentRequest = (requestIndex) => {
setLoading(true);
@ -284,10 +290,6 @@ 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);
@ -301,7 +303,6 @@ const ReviewPage = () => {
message: getErrorMessage(error),
});
}
}
};
const submitRevisedData = async () => {
@ -311,12 +312,11 @@ const ReviewPage = () => {
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();
request_file_result[k] =
selectedFileDataSource[k][REVIEWED_RESULT].toString();
} else {
request_file_result[k] = selectedFileDataSource[k][REVIEWED_RESULT];
}
});
let data = {
request_file_result,
@ -523,7 +523,17 @@ const ReviewPage = () => {
</div>
)}
{selectedFileData === 'FAILED_TO_LOAD_FILE' ? (
<div
style={{
flexGrow: 1,
overflow: 'auto',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
<p style={{ color: '#333' }}>Failed to load file.</p>
</div>
) : fileExtension === 'pdf' ? (
<div
style={{
@ -684,7 +694,7 @@ const ReviewPage = () => {
size='middle'
disabled={currentRequest && currentRequest['Is Reviewed']}
style={{ minWidth: '120px' }}
onClick={handleConfirmReview}
onClick={() => setIsOpenConfirmRequest(true)}
>
Confirm request
</Button>
@ -997,6 +1007,20 @@ const ReviewPage = () => {
</div>
</Form>
</Modal>
<Modal
title='Confirm this request?'
centered
open={isOpenConfirmRequest}
onOk={() => {
setIsOpenConfirmRequest(false);
handleConfirmReview();
}}
onCancel={() => {
setIsOpenConfirmRequest(false);
}}
>
<p>Are you sure you want to confirm this request is reviewed?</p>
</Modal>
</div>
);
};

View File

@ -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';