Repository navigation
fix(go-agent): add BGPT component and input form - #16684
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a new BGPT canvas component wrapper that adapts inputs, invokes the underlying tool, renders normalized results, registers the component, and verifies the behavior with unit tests. ChangesBGPT Component Integration
Estimated code review effort: 2 (Simple) | ~15 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
internal/agent/component/universe_a_wrappers.go (1)
223-238: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueMissing
URLfield in rendered output.
bgptResultcarries aurlfield (seeinternal/agent/tool/bgpt.go), butrenderBGPTResultsnever emits it, dropping paper source links fromformalized_content.♻️ Proposed addition
fmt.Sprintf("DOI: %s", bgptField("doi")), + fmt.Sprintf("URL: %s", bgptField("url")), fmt.Sprintf("Abstract: %s", bgptField("abstract")),🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/agent/component/universe_a_wrappers.go` around lines 223 - 238, The renderBGPTResults formatter in universe_a_wrappers.go is omitting the existing url value from bgptResult, so paper source links are lost in formalized_content. Update the lines slice built in renderBGPTResults to include the URL field alongside the other bgptField entries, using the same formatting pattern as Title, DOI, and Abstract so the rendered output preserves source links.internal/agent/component/bgpt_component_test.go (1)
55-96: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd test coverage for empty-query and error-envelope branches.
Current tests only cover the success path.
Invoke's empty-query short-circuit and the_ERRORhandling branch (universe_a_wrappers.go Line 133-135, 152-161) are untested.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/agent/component/bgpt_component_test.go` around lines 55 - 96, Add test coverage in TestBGPT_InvokeAdaptsCanvasInputsAndOutputs for the missing Invoke branches: the empty-query short-circuit and the _ERROR envelope handling in BGPTComponent.Invoke. Create focused cases using the existing newBGPTComponentWithInvoker and fakeBGPTInvoker helpers to verify an empty/whitespace query returns the expected early response without invoking the backend, and that a returned _ERROR payload is mapped to the intended error path instead of success output. Ensure the assertions target Invoke, fakeBGPTInvoker, and the output keys used by the adapter.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/agent/component/bgpt_component_test.go`:
- Around line 55-96: Add test coverage in
TestBGPT_InvokeAdaptsCanvasInputsAndOutputs for the missing Invoke branches: the
empty-query short-circuit and the _ERROR envelope handling in
BGPTComponent.Invoke. Create focused cases using the existing
newBGPTComponentWithInvoker and fakeBGPTInvoker helpers to verify an
empty/whitespace query returns the expected early response without invoking the
backend, and that a returned _ERROR payload is mapped to the intended error path
instead of success output. Ensure the assertions target Invoke, fakeBGPTInvoker,
and the output keys used by the adapter.
In `@internal/agent/component/universe_a_wrappers.go`:
- Around line 223-238: The renderBGPTResults formatter in universe_a_wrappers.go
is omitting the existing url value from bgptResult, so paper source links are
lost in formalized_content. Update the lines slice built in renderBGPTResults to
include the URL field alongside the other bgptField entries, using the same
formatting pattern as Title, DOI, and Abstract so the rendered output preserves
source links.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 878900ab-ce55-4f89-8242-010818c5b514
📒 Files selected for processing (3)
internal/agent/component/bgpt_component_test.gointernal/agent/component/fixture_stubs.gointernal/agent/component/universe_a_wrappers.go
…z-186/ragflow into fix/agent-BGPT-component
Summary
Adds the missing input form metadata for the Go BGPT canvas component.
Root Cause
The standalone BGPT component was registered in Go, but it did not implement GetInputForm(). During component trial run, the backend asks the component for its input_form. Since BGPT had none, the API returned:
component has no input_form: BGPT:<node_id>
Python BGPT already exposes the query input form, so the Go component needed the same contract.
Change
Added GetInputForm() to the Go BGPT component with a single query line input.
Added test coverage to ensure BGPT exposes the input form.
Validation
Backend:
bash build.sh --test -run TestBGPT ./internal/agent/component