[add] Lark AI recognition API: OCR, Bank Card, Resume & Contract#28
Merged
TechQuery merged 5 commits intoJun 19, 2026
Merged
Conversation
Closed
Copilot
AI
changed the title
[WIP] Add encapsulation for 飞书智能文档解析 non-licensed interfaces
Add Feishu AI document analysis APIs: OCR, bank card, resume, contract
Apr 15, 2026
…packages/actions [fix] many Copilot type bugs
There was a problem hiding this comment.
Pull request overview
This PR adds new Feishu/Lark “Document AI” wrappers (OCR, bank card recognition, resume parsing, contract field extraction) and updates repo/tooling configuration (pnpm workspace + dependency bumps) plus a few GitHub workflow/script improvements.
Changes:
- Added new DocumentAI types and methods for bank cards, resumes, contracts, and OCR.
- Updated reward-automation scripts/workflows to carry a
sourcefield and to push tags more narrowly. - Introduced
pnpm-workspace.yaml, bumped dependencies, and updated CI to pnpm v11.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/module/DocumentAI/type.ts | Adds new document-AI response types (bank card, resume, contract); includes a typo + several doc/code naming mismatches. |
| src/module/DocumentAI/index.ts | Adds new DocumentAIModel API methods (OCR/bank card/resume/contract); several signatures/names diverge from the PR description. |
| src/module/BITable/index.ts | Refines BiSearch generics to improve type inference for the wrapped model. |
| src/Lark.ts | Changes LarkAppOption from interface inheritance to a type intersection. |
| pnpm-workspace.yaml | Adds pnpm workspace manifest and build-allowlist configuration. |
| pnpm-lock.yaml | Updates lockfile for dependency bumps. |
| package.json | Bumps version to 2.9.0, updates dependencies, and removes pnpm.onlyBuiltDependencies block. |
| .github/workflows/main.yml | Updates CI to use pnpm v11. |
| .github/workflows/Lark-notification.yml | Refactors message serialization to pass GitHub context via env + printf piping. |
| .github/workflows/claim-issue-reward.yml | Passes an additional source argument into the reward-sharing script. |
| .github/scripts/type.ts | Adds optional source field to the Reward type. |
| .github/scripts/share-reward.ts | Accepts/persists source, and pushes only the created tag (not all tags). |
| .github/scripts/count-reward.ts | Refactors last-month range filtering and pushes only the created tag. |
| .github/ISSUE_TEMPLATE/reward-task.yml | Adds a “Task source” input field to the reward task issue form. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+73
to
+84
| @toggle('uploading') | ||
| async recognizeText(image: File) { | ||
| const URI = (await readAs(image, 'dataURL').result) as string; | ||
|
|
||
| const [, base64] = URI.split(','); | ||
|
|
||
| const { body } = await this.client.post<LarkData<{ text_list: string[] }>>( | ||
| 'optical_char_recognition/v1/image/basic_recognize', | ||
| { image: base64 } | ||
| ); | ||
| return body!.data!.text_list; | ||
| } |
| @@ -1,8 +1,16 @@ | |||
| import { makeFormData } from 'koajax'; | |||
| import { makeFormData, readAs } from 'koajax'; | |||
| * @see {@link https://open.feishu.cn/document/server-docs/ai/document_ai-v1/contract/field_extraction} | ||
| */ | ||
| @toggle('uploading') | ||
| async extractContract( |
Comment on lines
+71
to
+74
| export interface BankCardEntity { | ||
| type: 'card_number' | 'date_of_expiry'; | ||
| value: string; | ||
| } |
Comment on lines
+115
to
+118
| file: File, | ||
| ocr_mode: 'unused' | 'force' | 'auto' = 'auto', | ||
| pdf_page_limit = 100 | ||
| ) { |
Comment on lines
+101
to
+103
| export interface Resume | ||
| extends | ||
| Record< |
Comment on lines
+71
to
+76
| export interface BankCardEntity { | ||
| type: 'card_number' | 'date_of_expiry'; | ||
| value: string; | ||
| } | ||
|
|
||
| export type ResumePeriod = Record<'start_date' | 'start_time' | 'end_date' | 'end_time', string>; |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
TechQuery
approved these changes
Jun 19, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wraps four Feishu intelligent document parsing APIs that fall outside the existing invoice/certificate category.
New types (
DocumentAI/type.ts)OcrText— recognized text block with bounding box corner positionsBankCard—bank_card_number | bank_card_date_of_expiryentityResumeEntity— structured resume fields (name, gender, DOB, contact, education/work history, etc.)ContractEntity— extracted contract fields (parties, dates, amount, payment terms, etc.)New methods (
DocumentAIModel)recognizeText(image: string)optical_char_recognition/v1/image/basic_recognizerecognizeBankCard(file: File)document_ai/v1/bank_card/recognizeparseResume(file: File)document_ai/v1/resume/parseextractContractFields(file: File)document_ai/v1/contract/field_extractionNote:
recognizeTextaccepts a base64-encoded image string (not a file upload), matching the OCR API's JSON body contract — unlike the other three which use multipart form data.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
open.feishu.cn/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/MobX-Lark/MobX-Lark/node_modules/.bin/ts-node test/index.spec.ts(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/MobX-Lark/MobX-Lark/node_modules/.bin/ts-node test/index.spec.ts git conf�� it} --global rgo/bin/bash gpg.program(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Human changes