MaxKB icon indicating copy to clipboard operation
MaxKB copied to clipboard

[Bug] variable will be reinitialized after assignment

Open TraceIvan opened this issue 1 year ago • 8 comments

Contact Information

No response

MaxKB Version

v1.10.4

Problem Description

在多轮问答场景里,工作流中第一轮被赋值的全局变量在追问后会被初始化,应该保留第一轮被赋值的内容,初始化操作应当只在问答开始前操作一次。

Steps to Reproduce

工作流中,根据历史记录长度判断当前问答轮次,如果是第一轮则对全局变量赋值,否则输出全局变量值。发现第一轮被赋值的全局变量在后续轮次后会重新被初始化。

The expected correct result

No response

Related log output


Additional Information

No response

TraceIvan avatar Apr 23 '25 06:04 TraceIvan

您好,没有复现这个问题,方便的话请导出您的应用上传给我们看一下,并且截图说明一下具体是哪个变量,在什么节点变成了错误的值

zyyfit avatar Apr 23 '25 09:04 zyyfit

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Hello, this problem has not been reproduced. If it is convenient, please export your application and upload it to us to see it, and take a screenshot to explain which variable it is and which node it has become the wrong value.

shaohuzhang1 avatar Apr 23 '25 09:04 shaohuzhang1

感谢反馈,您想要的应该是会话级变量,目前仅支持一次对话的赋值,近期暂无计划支持。 当前如果想要会话级变量,可以写个函数把变量值存储到redis中,用的时候去读取一下。

baixin513 avatar Apr 24 '25 01:04 baixin513

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Thanks for feedback, what you want should be a session-level variable, which currently only supports assignment of one conversation, and there is no planned support in the near future. Currently, if you want session-level variables, you can write a function to store the variable value in redis, and read it when using it.

shaohuzhang1 avatar Apr 24 '25 01:04 shaohuzhang1

同样问题,在同一个chatid ,使用变量赋值组件赋值的全局变量,追问后应该不会重新初始化才对

JasonJasonXU avatar Apr 24 '25 01:04 JasonJasonXU

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The same problem is, in the same chatid, the global variable assigned by the component should not be re-initialized after asking.

shaohuzhang1 avatar Apr 24 '25 01:04 shaohuzhang1

感谢反馈,您想要的应该是会话级变量,目前仅支持一次对话的赋值,近期暂无计划支持。 当前如果想要会话级变量,可以写个函数把变量值存储到redis中,用的时候去读取一下。

是的,能够在会话中进行维护。感谢您提供的方法,我这边试试~

TraceIvan avatar Apr 24 '25 05:04 TraceIvan

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Thanks for the feedback, what you want should be a session-level variable, which currently only supports assignment of one conversation, and there is no planned support in the near future. Currently, if you want session-level variables, you can write a function to store the variable value in redis, and read it when using it.

Yes, it is able to maintain in sessions. Thank you for the method, I'll try it here~

shaohuzhang1 avatar Apr 24 '25 05:04 shaohuzhang1