mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-07 12:29:50 +08:00
fix(core): doc reference error in ai answer (#13141)
Close [AI-303](https://linear.app/affine-design/issue/AI-303) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced a new AI configuration hook to streamline AI-related features and integrations. * Integrated enhanced AI specifications into chat components for improved AI chat experiences. * **Refactor** * Updated chat panels to use the new AI configuration hook, simplifying extension management and improving maintainability. * **Chores** * Improved options handling in the editor view extension for more flexible configuration. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -44,6 +44,8 @@ const optionsSchema = z.object({
|
||||
.args(z.custom<ConfirmModalProps>().optional(), z.any().optional()),
|
||||
closeConfirmModal: z.function(),
|
||||
}),
|
||||
|
||||
scope: z.enum(['doc', 'workspace']).optional(),
|
||||
});
|
||||
|
||||
export type AffineEditorViewOptions = z.infer<typeof optionsSchema>;
|
||||
@@ -93,16 +95,7 @@ export class AffineEditorViewExtension extends ViewExtensionProvider<AffineEdito
|
||||
if (!options) {
|
||||
return;
|
||||
}
|
||||
const {
|
||||
framework,
|
||||
|
||||
reactToLit,
|
||||
confirmModal,
|
||||
} = options;
|
||||
|
||||
const docService = framework.get(DocService);
|
||||
const docsService = framework.get(DocsService);
|
||||
const editorService = framework.get(EditorService);
|
||||
const { framework, reactToLit, confirmModal, scope = 'doc' } = options;
|
||||
|
||||
const referenceRenderer = this._getCustomReferenceRenderer(framework);
|
||||
|
||||
@@ -112,12 +105,20 @@ export class AffineEditorViewExtension extends ViewExtensionProvider<AffineEdito
|
||||
patchNotificationService(confirmModal),
|
||||
patchOpenDocExtension(),
|
||||
patchSideBarService(framework),
|
||||
patchDocModeService(docService, docsService, editorService),
|
||||
patchFileSizeLimitExtension(framework),
|
||||
buildDocDisplayMetaExtension(framework),
|
||||
patchForAudioEmbedView(reactToLit),
|
||||
])
|
||||
.register(patchDocUrlExtensions(framework))
|
||||
.register(patchQuickSearchService(framework));
|
||||
|
||||
if (scope === 'doc') {
|
||||
const docService = framework.get(DocService);
|
||||
const docsService = framework.get(DocsService);
|
||||
const editorService = framework.get(EditorService);
|
||||
context.register([
|
||||
patchDocModeService(docService, docsService, editorService),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user