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

建议增加批量删除前面对话的一键操作 #27

Open
Raytow opened this issue Apr 6, 2023 · 4 comments
Open

建议增加批量删除前面对话的一键操作 #27

Raytow opened this issue Apr 6, 2023 · 4 comments

Comments

@Raytow
Copy link

Raytow commented Apr 6, 2023

每次对话超最大之后,都需要挨个删除前面无用的信息,需要增加一个选项,自动删除前面第一条消息。

@xqdoo00o
Copy link
Owner

xqdoo00o commented Apr 6, 2023

右下角

@Raytow
Copy link
Author

Raytow commented Apr 8, 2023 via email

@xqdoo00o
Copy link
Owner

xqdoo00o commented Apr 8, 2023

自动的话,怎么确定要不要清呢,等我重设计好对话选项UI再看看

@WhiteMagic2014
Copy link

自动的话,怎么确定要不要清呢,等我重设计好对话选项UI再看看

这个我是这样解决的,比如我使用的model 是 3.5turbo,max token 4096个,每次调用 chat接口设定的 最大token长度是 500(加上本次的prompt) 估成600吧,4096/600 = 6.8 左右, 那么我按每次最大来算 极限存储 6次对话。这个次数随着模型max token,设置的单次长度 变化,估一个大概也可以
然后用一个队列来存储对话, 队列达到6以后 第一次对话记录出队列,为了防止特殊情况,当返回context_length_exceeded 的时候(token长度超了) 第一个对话出队列,同时再次请求一次。
https://github.com/WhiteMagic2014/WMagicBotR/blob/master/src/main/java/com/whitemagic2014/service/impl/ChatPGTServiceImpl.java
这个是我说的逻辑的java实现

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants