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

监听messages时,发现发现用户已经切换了会话,如何打断呢? #436

Open
gehuama opened this issue Dec 30, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@gehuama
Copy link

gehuama commented Dec 30, 2024

重现步骤

在线示例链接:(必填)

步骤:
// XChat 钩子,处理消息发送
const { onRequest, messages, setMessages } = useXChat({
agent,
});
监听messages时,发现发现用户已经切换了会话,如何打断呢?否则新的会话里面,消息仍旧注入,就乱了

当前行为

message 直接在新的会话中添加

预期行为

切换会话,消息不乱串

上下文

No response

版本

1.0.4

您在哪些浏览器上遇到了这个问题?

No response

@gehuama gehuama added the bug Something isn't working label Dec 30, 2024
@YumoImer YumoImer removed the bug Something isn't working label Dec 30, 2024
@YumoImer
Copy link
Collaborator

这看起来不是个 bug,useXChat 设计上服务于单一会话。打断功能可以参考官网的示例:

https://x.ant.design/components/use-x-chat-cn#components-use-x-chat-demo-stream-cancel

@YumoImer YumoImer added the enhancement New feature or request label Dec 30, 2024
@YumoImer
Copy link
Collaborator

@gehuama 对于这个问题,我们统一在这里讨论吧。

对于你标题描述的问题,上面我已经回复了。

我看到你在其他地方的留言,我感觉这是一个新的功能请求:useXChat 以及 useXAgent 支持对预设的请求提供打断功能。

@gehuama
Copy link
Author

gehuama commented Dec 31, 2024

是的,模型本身就已经封装成stream,隐藏直接的时候,再用xstrem进行一次转换其实没有必要的,在实际的需求中

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

No branches or pull requests

2 participants