refactor(app_dsl_service): extract knowledge base parsing logic into a standalone utility function - #1997
Open
wanxunyang wants to merge 1 commit into
Open
refactor(app_dsl_service): extract knowledge base parsing logic into a standalone utility function#1997wanxunyang wants to merge 1 commit into
wanxunyang wants to merge 1 commit into
Conversation
…a standalone utility function Extract the knowledge base parsing code from the original workflow node into the _resolve_kb_entries private method, simplifying the code structure while reusing the parsing logic, and supporting knowledge base configuration handling for Agent nodes.
Contributor
Reviewer's Guide将知识库解析逻辑重构为可复用的辅助方法,并扩展至 Agent 节点,确保在 Knowledge Retrieval 和 Agent 节点配置中对知识库引用进行校验和清洗。 KnowledgeRetrieval 和 Agent 节点中知识库解析的流程图flowchart TD
A_resolve_nodes[_resolve_workflow_nodes] --> B_check_type{node_type}
B_check_type -->|KNOWLEDGE_RETRIEVAL| C_kb_node["config.knowledge_bases = _resolve_kb_entries(config.knowledge_bases)"]
B_check_type -->|AGENT| D_agent["Agent node config"]
D_agent --> E_nested_kb{knowledge_retrieval.knowledge_bases}
E_nested_kb -->|present| F_nested["knowledge_retrieval.knowledge_bases = _resolve_kb_entries(knowledge_retrieval.knowledge_bases)"]
D_agent --> G_legacy_kb{config.knowledge_bases}
G_legacy_kb -->|present| H_legacy["config.knowledge_bases = _resolve_kb_entries(config.knowledge_bases)"]
subgraph S[_resolve_kb_entries]
I_for_each[[for kb in knowledge_bases]] --> J_build_ref[build kb_ref from kb.kb_id]
J_build_ref --> K_call_resolve["_resolve_kb(kb_ref, workspace_id, empty list)"]
K_call_resolve --> L_match{resolved_id}
L_match -->|yes| M_keep[append kb with resolved kb_id]
L_match -->|no| N_warn[append warning for node_label]
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your Experience访问你的 dashboard 以:
Getting HelpOriginal review guide in EnglishReviewer's GuideRefactors knowledge base resolution logic into a reusable helper and extends it to Agent nodes, ensuring knowledge base references are validated and cleaned for both Knowledge Retrieval and Agent node configurations. Flow diagram for knowledge base resolution in KnowledgeRetrieval and Agent nodesflowchart TD
A_resolve_nodes[_resolve_workflow_nodes] --> B_check_type{node_type}
B_check_type -->|KNOWLEDGE_RETRIEVAL| C_kb_node["config.knowledge_bases = _resolve_kb_entries(config.knowledge_bases)"]
B_check_type -->|AGENT| D_agent["Agent node config"]
D_agent --> E_nested_kb{knowledge_retrieval.knowledge_bases}
E_nested_kb -->|present| F_nested["knowledge_retrieval.knowledge_bases = _resolve_kb_entries(knowledge_retrieval.knowledge_bases)"]
D_agent --> G_legacy_kb{config.knowledge_bases}
G_legacy_kb -->|present| H_legacy["config.knowledge_bases = _resolve_kb_entries(config.knowledge_bases)"]
subgraph S[_resolve_kb_entries]
I_for_each[[for kb in knowledge_bases]] --> J_build_ref[build kb_ref from kb.kb_id]
J_build_ref --> K_call_resolve["_resolve_kb(kb_ref, workspace_id, empty list)"]
K_call_resolve --> L_match{resolved_id}
L_match -->|yes| M_keep[append kb with resolved kb_id]
L_match -->|no| N_warn[append warning for node_label]
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
嗨——我已经Review了你的改动,看起来非常棒!
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈来改进之后的 Review。
Original comment in English
Hey - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
API Breaking Change ReportComparing against Breaking change approval label:
oasdiffOutputopenapi-diffOutputGate decisionNo breaking changes detected. The check passed without approval override. |
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.
Extract the knowledge base parsing code from the original workflow node into the _resolve_kb_entries private method, simplifying the code structure while reusing the parsing logic, and supporting knowledge base configuration handling for Agent nodes.
由 Sourcery 生成的总结
将工作流节点的知识库解析逻辑重构为可复用的辅助方法,并在相关节点类型中统一使用。
改进内容:
_resolve_kb_entries辅助方法中,以便在多个节点间复用。Original summary in English
Summary by Sourcery
Refactor workflow node knowledge base resolution into a reusable helper and apply it across relevant node types.
Enhancements: