Skip to content
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

Single Variable Assigner cannot append multiple values to the same array #12357

Closed
5 tasks done
Tracked by #12671
kurokobo opened this issue Jan 4, 2025 · 4 comments · Fixed by #12672
Closed
5 tasks done
Tracked by #12671

Single Variable Assigner cannot append multiple values to the same array #12357

kurokobo opened this issue Jan 4, 2025 · 4 comments · Fixed by #12672
Assignees
Labels
💪 enhancement New feature or request

Comments

@kurokobo
Copy link
Contributor

kurokobo commented Jan 4, 2025

Self Checks

  • This is only for bug report, if you would like to ask a question, 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).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.14.2

Cloud or Self Hosted

Cloud, Self Hosted (Docker)

Steps to reproduce

  1. Create new chatflow app
  2. Define new conversation variable with the type array[string]
  3. Add Variable Assigner
  4. Try Append ing multiple string values to the same conversation variable in the single Variable Assigner

DSL:
variable assigner.txt

Screenshot:
image

✔️ Expected Behavior

In the above case, the variable bulk should have three values.

❌ Actual Behavior

The variable bulk has only the last appended value.

As a workaround, we can append value one-by-one by adding multiple variable assigner.

image

Copy link

dosubot bot commented Jan 4, 2025

To append multiple values to the same array using a Single Variable Assigner in Dify version 0.14.2, you should use the "Extend" operation mode instead of "Append." The "Extend" operation allows you to add multiple elements to an array in a single operation, effectively solving the issue you're encountering with the "Append" operation, which only adds a single element at a time [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot dosubot bot added the 💪 enhancement New feature or request label Jan 4, 2025
@kurokobo
Copy link
Contributor Author

kurokobo commented Jan 4, 2025

Note for the comment from the dosubot:

Extend mode is designed to extend the existing array by using another array, so we can't select any string type variables if we select Extend mode.
image

@laipz8200
Copy link
Member

laipz8200 commented Jan 13, 2025

Hi @kurokobo. I fixed this issue in #12672, could you try it?

@kurokobo
Copy link
Contributor Author

@laipz8200
Thanks, I'll test the PR later 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants