Add message in Chatflow LLM gives error #2235

Closed
opened 2026-02-21 17:43:17 -05:00 by yindo · 0 comments
Owner

Originally created by @AndyMik90 on GitHub (Apr 15, 2024).

Originally assigned to: @iamjoel, @zxhlyh on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a quesion, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.6.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

After converting a normal Chatbot to Chatflow, pressing "add message" under Context, gives error.
CleanShot 2024-04-15 at 20 04 07

✔️ Expected Behavior

Add system prompt?

Actual Behavior

TypeError: Cannot read properties of undefined (reading 'role')

`app/components/workflow/nodes/llm/components/config-prompt.tsx (70:53) @ role

68 | const handleAddPrompt = useCallback(() => {
69 | const newPrompt = produce(payload as PromptItem[], (draft) => {

70 | const isLastItemUser = draft[draft.length - 1].role === PromptRole.user
| ^
71 | draft.push({ role: isLastItemUser ? PromptRole.assistant : PromptRole.user, text: '' })
72 | })
73 | onChange(newPrompt)`

Originally created by @AndyMik90 on GitHub (Apr 15, 2024). Originally assigned to: @iamjoel, @zxhlyh on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a quesion, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] Pleas do not modify this template :) and fill in all the required fields. ### Dify version 0.6.2 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce After converting a normal Chatbot to Chatflow, pressing "add message" under Context, gives error. ![CleanShot 2024-04-15 at 20 04 07](https://github.com/langgenius/dify/assets/119136210/a18f3fd0-9738-4dd0-b78e-81c4e723f335) ### ✔️ Expected Behavior Add system prompt? ### ❌ Actual Behavior TypeError: Cannot read properties of undefined (reading 'role') `app/components/workflow/nodes/llm/components/config-prompt.tsx (70:53) @ role 68 | const handleAddPrompt = useCallback(() => { 69 | const newPrompt = produce(payload as PromptItem[], (draft) => { > 70 | const isLastItemUser = draft[draft.length - 1].role === PromptRole.user | ^ 71 | draft.push({ role: isLastItemUser ? PromptRole.assistant : PromptRole.user, text: '' }) 72 | }) 73 | onChange(newPrompt)`
yindo added the 🐞 bug label 2026-02-21 17:43:17 -05:00
yindo closed this issue 2026-02-21 17:43:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#2235