Skip to content

[add] Lark AI recognition API: OCR, Bank Card, Resume & Contract#28

Merged
TechQuery merged 5 commits into
mainfrom
copilot/fix-47602664-470670876-5b34ad0a-bdd7-4abb-b4ed-f64f26d7cb63
Jun 19, 2026
Merged

[add] Lark AI recognition API: OCR, Bank Card, Resume & Contract#28
TechQuery merged 5 commits into
mainfrom
copilot/fix-47602664-470670876-5b34ad0a-bdd7-4abb-b4ed-f64f26d7cb63

Conversation

Copilot AI commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

PR-28 PR-28 PR-28 Powered by Pull Request Badge

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 positions
  • BankCardbank_card_number | bank_card_date_of_expiry entity
  • ResumeEntity — structured resume fields (name, gender, DOB, contact, education/work history, etc.)
  • ContractEntity — extracted contract fields (parties, dates, amount, payment terms, etc.)

New methods (DocumentAIModel)

Method API endpoint
recognizeText(image: string) optical_char_recognition/v1/image/basic_recognize
recognizeBankCard(file: File) document_ai/v1/bank_card/recognize
parseResume(file: File) document_ai/v1/resume/parse
extractContractFields(file: File) document_ai/v1/contract/field_extraction

Note: recognizeText accepts 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.

// OCR — base64 input
const texts = await documentAIStore.recognizeText(base64Image);
// texts: OcrText[] — each with .text and .positions (bounding box corners)

// File-upload APIs
const cards    = await documentAIStore.recognizeBankCard(file);
const resumes  = await documentAIStore.parseResume(file);
const contracts = await documentAIStore.extractContractFields(file);

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
    • Triggering command: /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)
    • Triggering command: /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)
    • Triggering command: /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

  1. [migrate] upgrade to PNPM 11, Lint-Staged 17 & other latest Upstream packages/actions
  2. [fix] many Copilot type bugs

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
Copilot AI requested a review from TechQuery April 15, 2026 21:41
…packages/actions

[fix] many Copilot type bugs
@TechQuery TechQuery added the feature New feature or request label Jun 19, 2026
@TechQuery TechQuery marked this pull request as ready for review June 19, 2026 00:22
Copilot AI review requested due to automatic review settings June 19, 2026 00:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 source field 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 thread src/module/DocumentAI/type.ts Outdated
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 thread src/module/DocumentAI/type.ts Outdated
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>;
TechQuery and others added 2 commits June 19, 2026 08:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@TechQuery TechQuery changed the title Add Feishu AI document analysis APIs: OCR, bank card, resume, contract [add] Lark AI recognition API: OCR, Bank Card, Resume & Contract Jun 19, 2026
@TechQuery TechQuery merged commit 420a1c4 into main Jun 19, 2026
2 checks passed
@TechQuery TechQuery deleted the copilot/fix-47602664-470670876-5b34ad0a-bdd7-4abb-b4ed-f64f26d7cb63 branch June 19, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

封装飞书【智能文档解析】非证照、票据类接口

3 participants