Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] - Modify the result of post ocr based on the refined uploading process #2075

Closed
7 tasks done
arealclimber opened this issue Aug 15, 2024 · 4 comments · Fixed by #2076 or #2084
Closed
7 tasks done
Assignees
Labels
5 hard level 5 BE backend enhancement New feature or request FE frontend

Comments

@arealclimber
Copy link
Member

arealclimber commented Aug 15, 2024

Summary

根據修改後上傳流程修改post ocr結果,目的在於提升用戶體驗

Tasks

後端

  • API POST api/v1/company/[companyId]/ocr request body 的 formDataimage 改成 image, imageName, imageSize, uploadIdentifier
  • API POST api/v1/company/[companyId]/ocr response 改成回傳 IOCR
  • IOCR 需修改,並且 imageName, imageSize, uploadIdentifier 由前端傳入,後端不需要修改這三個值
    export interface IOCR {
      id: number;
      aichResultId: string;
      imageName: string; // Info: from frontend (20240815 - Shirley)
      imageUrl: string;
      imageSize: string; // Info: from frontend (20240815 - Shirley)
      progress: number; // 0 ~ 100 Float
      status: ProgressStatus;
      createdAt: number;
      uploadIdentifier?: string; // Info: from frontend (20240815 - Shirley)
    }

前端

  • Originally posted by @arealclimber in [FEATURE] - Refine the UI procedure of uploading OCR #2057 (comment)
  • Originally posted by @arealclimber in [FEATURE] - Refine the UI procedure of uploading OCR #2057 (comment)
  • IOCR interface 上新增一個 propertyA 去判斷檔案是否上傳成功
  • 在 accounting context 裡區分 pendingOCRList 跟 uploadedOCRList ,透過比對兩個 OCRList 的 propertyA 來檢查 skeleton file list 是否需要減少
  • 在 post request 成功之後,需直接在 pendingOCRList 刪掉對應 propertyA,並且轉移到 uploadedOCRList(代表需要後端在 post request 成功後回傳完整 IOCR interface)
  • 在 pending 時,OCR item 保留 file name 跟 file size,也就是由前端決定 uploadIdentifier, fileName, fileSize,以滿足在上傳如 PDF 檔案時,無法產生縮圖或AI辨識失敗時,能讓用戶知道特定檔案的上傳紀錄

  • TODO: 考慮上傳超過檔案大小限制的情形,前端畫面要提示用戶

Dependencies

API Availability, Backend Support, Frontend Framework

Other Dependencies

No response

Additional Notes

No response

@arealclimber
Copy link
Member Author

前端傳入 image, imageSize, imageName, uploadIdentifier
CleanShot 2024-08-15 at 18 18 08

@TinyMurky TinyMurky linked a pull request Aug 16, 2024 that will close this issue
11 tasks
@TinyMurky
Copy link
Contributor

後端更改完成,目前會接收前端傳入的formData之後存入Data base 並回傳IOCR
但是上傳的一瞬間會是紅色的圖案
2024-08-16_13-40
upload

@TinyMurky
Copy link
Contributor

took 2 hours
done!

@TinyMurky
Copy link
Contributor

upload pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment