Skip to content

集成deepseek使用sse方式,stop之后还会调用send #53

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

Open
Kingyumu opened this issue Mar 24, 2025 · 1 comment
Open

集成deepseek使用sse方式,stop之后还会调用send #53

Kingyumu opened this issue Mar 24, 2025 · 1 comment

Comments

@Kingyumu
Copy link

我的简要代码:

Image
使用的版本 v1.3.0,这样判断输出是否结束是没问题,只会进入一次stop

Image
日志:

Image

但是升级到版本 v1.3.1后,会进入两次stop,导致了误判断

Image

日志:

Image

期望:
stop之后不应该再调用send()了,或者增加一个布尔字段,统一以这个字段为准判断输出是否结束

@LnYo-Cly
Copy link
Owner

LnYo-Cly commented Apr 2, 2025

感谢。这部分在您的代码片段中确实存在问题。
原因为: 在非ollama平台,在“stop”消息之后,还会有一条“[done]”。由于目前每条消息都进行了send,在stop这条消息的时,finish reason已经为stop,后续的最后一条done消息也为stop。这造成了在您的代码中两次逻辑判断均为true。
您可以暂时添加一个临时变量,或者stop之后修改finish reason为null或其他即可。

后续我会修复这个问题。

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

2 participants