[NTE] BondGift && Some feature#345
Draft
HuiExcalibur wants to merge 7 commits into
Draft
Conversation
Contributor
Reviewer's Guide引入了一个可复用的包装层用于自定义动作(custom actions)和任务会话(task sessions),增加了多语言 OCR 和资源覆盖(resource overlay)的基础设施,并实现了共享的滚动与识别工具,以支持新的 BondGift 及相关自动化特性。 使用 task_action 包装的 CustomAction 带重试执行的时序图sequenceDiagram
autonumber
actor Pipeline
participant AgentServer
participant MyAction as CustomActionSubclass
participant CfgParser as _parse_config
participant ResultNorm as _normalize_result
Pipeline->>AgentServer: invoke custom_action name
AgentServer->>MyAction: run(context, argv)
loop [attempt 0..retries]
MyAction->>CfgParser: _parse_config(argv.custom_action_param, config_cls)
CfgParser-->>MyAction: config
MyAction->>MyAction: original_run(context, config)
alt [original_run returns]
break [exit loop]
MyAction->>ResultNorm: _normalize_result(result)
ResultNorm-->>MyAction: RunResult
MyAction-->>AgentServer: RunResult
AgentServer-->>Pipeline: RunResult
end
else [exception raised]
MyAction->>MyAction: log warning and optional delay
end
end
opt [all attempts failed]
MyAction-->>AgentServer: RunResult(success=False)
AgentServer-->>Pipeline: RunResult(success=False)
end
DynamicOCR 多语言 OCR 分析流程时序图sequenceDiagram
autonumber
actor Pipeline
participant AgentServer
participant DynamicOCR
participant TLFunc as TL
participant Context
Pipeline->>AgentServer: invoke custom_recognition "dynamic_ocr"
AgentServer->>DynamicOCR: analyze(context, argv)
DynamicOCR->>DynamicOCR: _parse_param(argv.custom_recognition_param)
DynamicOCR->>TLFunc: TL(node, lang)
TLFunc-->>DynamicOCR: expected_text or None
alt [expected_text is None]
DynamicOCR-->>AgentServer: AnalyzeResult(box=None, detail={})
AgentServer-->>Pipeline: AnalyzeResult
else [expected_text found]
DynamicOCR->>Context: run_recognition_direct(JRecognitionType.OCR, JOCR(roi, expected, threshold), argv.image)
Context-->>DynamicOCR: result
alt [result.hit and result.box]
DynamicOCR-->>AgentServer: AnalyzeResult(box, detail={node, expected})
AgentServer-->>Pipeline: AnalyzeResult
else [no hit]
DynamicOCR-->>AgentServer: AnalyzeResult(box=None, detail={})
AgentServer-->>Pipeline: AnalyzeResult
end
end
File-Level Changes
翻译:
翻译:
翻译:
翻译:
翻译:
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your Experience访问你的 控制面板 以:
Getting HelpOriginal review guide in EnglishReviewer's GuideIntroduces a reusable wrapping layer for custom actions and task sessions, adds infrastructure for multi-language OCR and resource overlays, and implements shared scrolling and recognition utilities to support new BondGift and related automation features. Sequence diagram for task_action-wrapped CustomAction execution with retriessequenceDiagram
autonumber
actor Pipeline
participant AgentServer
participant MyAction as CustomActionSubclass
participant CfgParser as _parse_config
participant ResultNorm as _normalize_result
Pipeline->>AgentServer: invoke custom_action name
AgentServer->>MyAction: run(context, argv)
loop [attempt 0..retries]
MyAction->>CfgParser: _parse_config(argv.custom_action_param, config_cls)
CfgParser-->>MyAction: config
MyAction->>MyAction: original_run(context, config)
alt [original_run returns]
break [exit loop]
MyAction->>ResultNorm: _normalize_result(result)
ResultNorm-->>MyAction: RunResult
MyAction-->>AgentServer: RunResult
AgentServer-->>Pipeline: RunResult
end
else [exception raised]
MyAction->>MyAction: log warning and optional delay
end
end
opt [all attempts failed]
MyAction-->>AgentServer: RunResult(success=False)
AgentServer-->>Pipeline: RunResult(success=False)
end
Sequence diagram for DynamicOCR multi-language OCR analyze flowsequenceDiagram
autonumber
actor Pipeline
participant AgentServer
participant DynamicOCR
participant TLFunc as TL
participant Context
Pipeline->>AgentServer: invoke custom_recognition "dynamic_ocr"
AgentServer->>DynamicOCR: analyze(context, argv)
DynamicOCR->>DynamicOCR: _parse_param(argv.custom_recognition_param)
DynamicOCR->>TLFunc: TL(node, lang)
TLFunc-->>DynamicOCR: expected_text or None
alt [expected_text is None]
DynamicOCR-->>AgentServer: AnalyzeResult(box=None, detail={})
AgentServer-->>Pipeline: AnalyzeResult
else [expected_text found]
DynamicOCR->>Context: run_recognition_direct(JRecognitionType.OCR, JOCR(roi, expected, threshold), argv.image)
Context-->>DynamicOCR: result
alt [result.hit and result.box]
DynamicOCR-->>AgentServer: AnalyzeResult(box, detail={node, expected})
AgentServer-->>Pipeline: AnalyzeResult
else [no hit]
DynamicOCR-->>AgentServer: AnalyzeResult(box=None, detail={})
AgentServer-->>Pipeline: AnalyzeResult
end
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Collaborator
|
可以来开发群 |
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.
Pull Request
提交前请阅读 PR 规范。
关联 Issue
Related #290
变更摘要
增加自动送礼功能
多语言OCR,而不是将所有多语言写在 json 的 expected 中
增强action注册,自动解析 json 内容并映射到 dataclass
验证
还在开发中
截图 / 日志 / 说明
Summary by Sourcery
引入可配置自定义动作、多语言 OCR,以及共享任务级状态的基础设施,以支持新的 BondGift 及相关自动化功能。
新功能:
task_action装饰器,用于注册自定义动作,并自动处理 JSON 到 dataclass 的配置解析、重试机制以及统一的结果规范化。TaskSession容器,用于存放每个任务的、按类型隔离的状态,并在相关动作之间共享。DynamicOCR自定义识别功能,从集中管理的 OCR 国际化数据中读取与语言相关的预期文本,并按对应语言执行 OCR。I18N_OCR映射中,并基于当前客户端语言提供便捷的查找辅助方法。Singleton基类,并在包级别设置wrap命名空间,用于对外暴露新的辅助工具。Original summary in English
Summary by Sourcery
Introduce infrastructure for configurable custom actions, multi-language OCR, and shared task-level state to support new BondGift and related automation features.
New Features: