Temporarily addressing the issue of high chat costs by limiting the number of historical messages the AI remembers / 通过限制AI记忆的历史消息条数来暂时解决聊天费用过高的问题 #1354
AdventuringTime
started this conversation in
Show and tell
Replies: 2 comments
|
I think, compared to long-term and short-term memory, this cost is still high. Looking forward to the implementation of long-term and short-term memory soon. 感觉相比长短期记忆来说,这成本还是有些高了。期待长短期记忆即将实装。 |
0 replies
|
我之前写过一个关于短期记忆的 pr,不过其实挺简单粗暴,就是只能回想最近几条消息: #1707 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
I've been chatting for the past two days, and noticed that the number of tokens consumed for input keeps increasing, leading to higher costs. As a student, it's hard for me to afford such expenses. So, I dug up the source code and temporarily limited the number of historical messages included in each AI response to control costs.
我最近聊了两天,发现输入消耗的 tokens 越来越多,产生的费用也越来越多,但是学生党难以支付那么多费用。于是我把源代码翻了出来,暂时限制每次 AI 回答时所输入的历史消息条数,来控制费用消耗。
This is just a temporary workaround before implementing a memory system. I haven't added a feature that allows users to set the maximum number of historical messages, so I won't be submitting a PR. Instead, I'm sharing this in the Discussion for reference, hoping it might help others facing similar issues~
不过这只是作为记忆系统实现前的权宜之计,而且我也没写让用户设置最大历史消息条数的部分,所以就不提交 PR 啦,只在 Discussion 分享一下,以供遇到类似问题的同好参考~
Solution: Add the following code in
packages\stage-ui\src\stores\chat.tsand modify the subsequent variable:解决方案:在
packages\stage-ui\src\stores\chat.ts中添加以下代码,并修改随后的一处变量:I don't know TypeScript programming, and the above code was modified with the help of AI. Please forgive any mistakes.
本人并不了解 Typescript 编程,以上代码由AI辅助修改,请各位大佬见谅。
This English translation is generated by AI, please forgive any grammatical issues.
英文由AI翻译生成,如有语法问题请见谅。
All reactions