mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
fix(core): show actions only if docId equals session.docId (#13080)
Close [AI-240](https://linear.app/affine-design/issue/AI-240) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Improved logic for displaying actions in AI chat content, ensuring actions are shown only when appropriate based on session and document context. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -197,6 +197,17 @@ export class AIChatContent extends SignalWatcher(
|
||||
});
|
||||
}
|
||||
|
||||
get showActions() {
|
||||
if (this.docId) {
|
||||
if (!this.session) {
|
||||
return true;
|
||||
}
|
||||
return this.session.docId === this.docId;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly updateHistory = async () => {
|
||||
const currentRequest = ++this.updateHistoryCounter;
|
||||
if (!AIProvider.histories) {
|
||||
@@ -208,7 +219,7 @@ export class AIChatContent extends SignalWatcher(
|
||||
sessionId
|
||||
? AIProvider.histories.chats(this.workspaceId, sessionId)
|
||||
: Promise.resolve([]),
|
||||
this.docId
|
||||
this.docId && this.showActions
|
||||
? AIProvider.histories.actions(this.workspaceId, this.docId)
|
||||
: Promise.resolve([]),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user