mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
fix(core): old ai messages not cleared before retrying (#13119)
Close [AI-258](https://linear.app/affine-design/issue/AI-258) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved the retry behavior in AI chat by ensuring previous streaming data is properly cleared before retrying, resulting in more accurate and consistent chat message handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -437,6 +437,7 @@ export class AIChatMessages extends WithDisposable(ShadowlessElement) {
|
||||
const last = messages[messages.length - 1];
|
||||
if ('content' in last) {
|
||||
last.content = '';
|
||||
last.streamObjects = [];
|
||||
last.createdAt = new Date().toISOString();
|
||||
}
|
||||
this.updateContext({
|
||||
|
||||
@@ -372,7 +372,7 @@ export class AIChatBlockPeekView extends LitElement {
|
||||
const last = messages[messages.length - 1];
|
||||
if ('content' in last) {
|
||||
last.content = '';
|
||||
last.id = '';
|
||||
last.streamObjects = [];
|
||||
last.createdAt = new Date().toISOString();
|
||||
}
|
||||
this.updateContext({
|
||||
|
||||
Reference in New Issue
Block a user