mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-04 08:38:34 +00:00
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:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user