mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-06 19:38:36 +08:00
### Summary The Go backend Agent component was not returning artifacts produced by the CodeExec tool. While the Python agent collects the "`_ARTIFACTS`" envelope from tool responses and appends artifact markdown to the final content, the Go agent only returned the assistant text, so generated images were missing from the chat output. ### Changes - Wire `react.WithMessageFuture()` in `runEinoReActAgent` and store the resulting `MessageFuture` in the invocation context. - After the ReAct loop finishes, drain the future and extract ``_ARTIFACTS`` entries from every tool response message. - Support reading the tool payload from both `msg.Content` and `msg.UserInputMultiContent` to match eino's tool contract. - De-duplicate artifacts by URL and render images as `!` and other files as download links. - Add `agent_artifact_test.go` with a regression test that simulates a CodeExec-style tool response carrying an image artifact and verifies it is collected and formatted. ### Verification - `go test ./internal/agent/component/... -run TestAgent_ReActAgent_CollectsArtifactsFromCodeExecTool` passes. - `go test ./internal/agent/component/... -count=1` compiles; the only failure is an unrelated DNS-pinning timeout test (`TestInvoke_ProxyDNSPin`). - `gofmt` clean for modified files. ### Related Fixes the behavior shown in the screenshot where the Go agent ignored the CodeExec-generated PNG artifact.