refactor(core): add selected chip synchronously (#13469)

> CLOSE PD-2698

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Optimized context chip handling in the AI chat composer to process
additions concurrently.
- Improves responsiveness when adding multiple documents or attachments
as context, reducing wait times and making the composing experience
smoother.
- No changes to visible functionality; users should notice faster
updates when selecting several items at once.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
德布劳外 · 贾贵
2025-08-11 17:42:18 +08:00
committed by GitHub
parent 0d9f6770bf
commit 01e8458075

View File

@@ -427,9 +427,9 @@ export class AIChatComposer extends SignalWatcher(
html,
state: 'finished',
};
await this.addChip(chip, true);
await Promise.all(
docs.map(docId =>
await Promise.all([
this.addChip(chip, true),
...docs.map(docId =>
this.addChip(
{
docId,
@@ -437,10 +437,8 @@ export class AIChatComposer extends SignalWatcher(
},
true
)
)
);
await Promise.all(
attachments.map(attachment =>
),
...attachments.map(attachment =>
this.addChip(
{
sourceId: attachment.sourceId,
@@ -449,8 +447,8 @@ export class AIChatComposer extends SignalWatcher(
},
true
)
)
);
),
]);
};
private readonly removeSelectedContextChip = async () => {