-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When the workflow output panel (log details) is a text output type, the front-end page will not render correctly when the result outputs is an array object consisting of strings. #12682
Comments
Hello @weiwenyan-dev! I'm here to assist you with any bugs, questions, or contributions you have for Dify. Let me know how I can help! The issue you're experiencing with the front-end page not rendering correctly when the workflow output panel is a text output type and the result is an array of strings is due to the To fix this, you need to modify the const isTextOutput = useMemo(() => {
if (!outputs || Object.keys(outputs).length !== 1) return false;
const outputValue = outputs[Object.keys(outputs)[0]];
return typeof outputValue === 'string' ||
(Array.isArray(outputValue) && outputValue.every(item => typeof item === 'string'));
}, [outputs]); And modify the rendering logic to handle arrays: {isTextOutput && (
<div className='px-4 py-2'>
<Markdown content={Array.isArray(outputs[Object.keys(outputs)[0]])
? outputs[Object.keys(outputs)[0]].join('\n')
: outputs[Object.keys(outputs)[0]] || ''} />
</div>
)} This change ensures that arrays of strings are treated as text output and rendered correctly [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
LLM supports text or file only, if you want to render arrays please use template node to transform it. |
What do you mean I found out about it myself and figured out how to fix it by submitting an issue first and then submitting the merge request |
|
Self Checks
Dify version
0.14.2
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
✔️ Expected Behavior
According to text type, display data and format normally.
❌ Actual Behavior
The result page cannot be rendered.
The text was updated successfully, but these errors were encountered: