feat: implement message continuation and error handling improvements#65
Merged
Conversation
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复对话流式生成在中途失败或上游协议异常时的回复保留问题。现在如果错误发生前已经生成了部分 assistant 内容、工具调用记录或原生工具用量,会保留为本轮中断消息,并返回给前端展示,同时统一 run、消息用量和账单记录口径,避免“内容已展示但未计费/日志不一致”。
同时优化上游成功状态码但响应格式不兼容时的错误摘要,避免把原始 SSE
data:内容直接暴露在错误正文中,原始响应仍保留在调试信息里。Change type
Affected areas
Verification
cd backend && go test ./internal/application/conversationcd backend && go test ./internal/transport/http/conversationcd backend && go test ./...cd frontend && pnpm lintcd frontend && pnpm buildgit diff --checkScreenshots, API examples, or logs
No screenshots added.
Relevant behavior:
datain the final error event when partial content was persisted.Configuration, migration, and compatibility notes
Configuration changes: None.
Database migrations: None.
Deployment changes: None.
API compatibility: Existing send/stream endpoints remain unchanged. Stream error events may now include retained message
datawhen an interrupted assistant message was successfully persisted.Swagger: Not regenerated; no new route or request/response DTO schema was introduced.
Documentation
Security and privacy
Checklist
.pycfiles,.envfiles, and local storage data are not committed.