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:
Wu Yue
2025-07-10 11:20:30 +08:00
committed by GitHub
parent 1fe07410c0
commit 899585ba7f
2 changed files with 2 additions and 1 deletions

View File

@@ -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({

View File

@@ -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({