refactor(core): ai session create (#11539)

Close [BS-3079](https://linear.app/affine-design/issue/BS-3079).

- Separate the create session logic from the `createMessage function`.
- Ensure the session is created before executing any chat or actions.
- Convert the `AIActions` into asynchronous functions.
- Transfer the update prompt name logic to the chat action.
- Introduce a networkSearch field in `AITextActionOptions`.
- Eliminate the redundant `LAST_ROOT_SESSION_ID`.
This commit is contained in:
akumatus
2025-04-09 06:18:56 +00:00
parent 1e9561b46c
commit c9790ed854
14 changed files with 403 additions and 331 deletions

View File

@@ -743,7 +743,7 @@ export class MindmapElementModel extends GfxGroupLikeElementModel<MindmapElement
const targetPos =
typeof targetXYWH === 'string' ? deserializeXYWH(targetXYWH) : targetXYWH;
const offsetX = targetPos[0] - x;
const offsetY = targetPos[1] - y + targetPos[3];
const offsetY = targetPos[1] - y;
this.surface.doc.transact(() => {
this.childElements.forEach(el => {