fix: interpolate {{ variables }} in Agentflow v2 nodes#5800
fix: interpolate {{ variables }} in Agentflow v2 nodes#5800hztBUAA wants to merge 1 commit intoFlowiseAI:mainfrom
Conversation
Add content field to HumanInput output so {{ humanInputAgentflow_0 }}
resolves to user feedback (or action type when no feedback is given).
Also improve the fallback in resolveNodeReference: when a node is found
in executed data but has no content/http.data, stringify the entire
output instead of returning the raw template string.
Summary of ChangesHello @hztBUAA, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in Agentflow v2 where variable placeholders were not being correctly interpolated, leading to unrendered dynamic content. The changes introduce a new Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes variable interpolation in Agentflow v2 nodes by ensuring the HumanInput node provides a content field and improving the fallback mechanism in resolveVariables. The logic now correctly handles cases where specific output fields are missing by stringifying the entire output object, which enhances the flexibility of template variables across different node types. A minor improvement to type safety for formattedValue has also been suggested.
| Array.isArray(actualValue) || (typeof actualValue === 'object' && actualValue !== null) | ||
| ? JSON.stringify(actualValue) | ||
| : actualValue?.toString() ?? match | ||
| let formattedValue: any |
|
Thanks for the review and feedback. I am following up on this PR now and will either push the requested changes or reply point-by-point shortly. |
|
Quick follow-up: I am reviewing the feedback and will update this PR shortly. |
|
Closing as #5818 with similar fix |
Summary
{{ variable }}placeholders in Agentflow v2 nodes were not being interpolated with actual valuescontentfield to HumanInput node output (user feedback or action type) so{{ humanInputAgentflow_0 }}resolves correctlyresolveNodeReference: when a node is found but has nocontentorhttp.data, the entire output is stringified instead of returning the raw template stringCloses #5704
Test plan
{{ humanInputAgentflow_0 }}{{ llmAgentflow_0 }}) continue to work correctly