mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 11:59:51 +08: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:
+7
-9
@@ -427,9 +427,9 @@ export class AIChatComposer extends SignalWatcher(
|
|||||||
html,
|
html,
|
||||||
state: 'finished',
|
state: 'finished',
|
||||||
};
|
};
|
||||||
await this.addChip(chip, true);
|
await Promise.all([
|
||||||
await Promise.all(
|
this.addChip(chip, true),
|
||||||
docs.map(docId =>
|
...docs.map(docId =>
|
||||||
this.addChip(
|
this.addChip(
|
||||||
{
|
{
|
||||||
docId,
|
docId,
|
||||||
@@ -437,10 +437,8 @@ export class AIChatComposer extends SignalWatcher(
|
|||||||
},
|
},
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
);
|
...attachments.map(attachment =>
|
||||||
await Promise.all(
|
|
||||||
attachments.map(attachment =>
|
|
||||||
this.addChip(
|
this.addChip(
|
||||||
{
|
{
|
||||||
sourceId: attachment.sourceId,
|
sourceId: attachment.sourceId,
|
||||||
@@ -449,8 +447,8 @@ export class AIChatComposer extends SignalWatcher(
|
|||||||
},
|
},
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly removeSelectedContextChip = async () => {
|
private readonly removeSelectedContextChip = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user