mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 10:06:17 +08:00
refactor: move chat block to affine (#8368)
[BS-898](https://linear.app/affine-design/issue/BS-898/move-ai-chat-block-to-affine) Should be merged after https://github.com/toeverything/blocksuite/pull/8420 merged and bumped.
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { Unreachable } from '@affine/env/constant';
|
||||
import { type DocMode } from '@blocksuite/affine/blocks';
|
||||
import {
|
||||
type AffineTextAttributes,
|
||||
type DocMode,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type { DeltaInsert } from '@blocksuite/affine/inline';
|
||||
|
||||
import { Service } from '../../../framework';
|
||||
import { type DocProps, initDocFromProps } from '../../../initialization';
|
||||
@@ -77,7 +81,7 @@ export class DocsService extends Service {
|
||||
const { doc, release } = this.open(targetDocId);
|
||||
doc.setPriorityLoad(10);
|
||||
await doc.waitForSyncReady();
|
||||
const text = doc.blockSuiteDoc.Text.fromDelta([
|
||||
const text = new doc.blockSuiteDoc.Text([
|
||||
{
|
||||
insert: ' ',
|
||||
attributes: {
|
||||
@@ -87,7 +91,7 @@ export class DocsService extends Service {
|
||||
},
|
||||
},
|
||||
},
|
||||
]);
|
||||
] as DeltaInsert<AffineTextAttributes>[]);
|
||||
const [frame] = doc.blockSuiteDoc.getBlocksByFlavour('affine:note');
|
||||
frame &&
|
||||
doc.blockSuiteDoc.addBlock(
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { AffineSchemas } from '@blocksuite/affine/blocks/schemas';
|
||||
import { AIChatBlockSchema } from '@blocksuite/affine/presets';
|
||||
import { Schema } from '@blocksuite/affine/store';
|
||||
|
||||
import { AIChatBlockSchema } from '../../blocksuite/blocks/ai-chat-block/ai-chat-model';
|
||||
|
||||
let _schema: Schema | null = null;
|
||||
export function getAFFiNEWorkspaceSchema() {
|
||||
if (!_schema) {
|
||||
|
||||
Reference in New Issue
Block a user