Commit Graph

8920 Commits

Author SHA1 Message Date
akumatus
a648edafc0 feat(core): display embedding progress (#10871)
Close [BS-2791](https://linear.app/affine-design/issue/BS-2791).
2025-03-14 11:58:29 +00:00
fundon
99fdfe821a fix(editor): improve type declaration definition (#10866)
Closes: [BS-2809](https://linear.app/affine-design/issue/BS-2809/改进继承自抽象类的类型后-createidentifier-类型定义)

### What's Changed!

* Improved type declaration definition
2025-03-14 10:38:17 +00:00
doodlewind
d8dfea6ccf fix(editor): type import in vite worker env (#10856)
The dependencies of `@blocksuite/affine-gfx-turbo-renderer` in work is now all type imports.
2025-03-14 10:22:58 +00:00
darkskygit
17d4fef721 chore(server): enable r2 in doc service (#10865) 2025-03-14 10:06:26 +00:00
EYHN
05200ad7b7 feat(nbstore): add blob sync storage (#10752) 2025-03-14 18:05:54 +08:00
EYHN
a2eb3fe1b2 feat(core): add notification service (#10855) 2025-03-14 09:32:10 +00:00
yoyoyohamapi
4a1a557a9e refactor(web): save as doc & save as block action (#10833)
### TL;DR

Added "Save as doc" option to Edgeless editor actions.

### What changed?

- Renamed `SAVE_CHAT_TO_BLOCK_ACTION` to `SAVE_AS_BLOCK` and updated its title from "Save chat to block" to "Save as block"
- Renamed `CREATE_AS_DOC` to `SAVE_AS_DOC` and updated its title from "Create as a doc" to "Save as doc"
- Added `SAVE_AS_DOC` to the `EdgelessEditorActions` array, making this option available in the Edgeless editor
2025-03-14 09:01:31 +00:00
yoyoyohamapi
1258f47d70 refactor(web): insert blew action (#10722)
### TL;DR
Refactor the insert below functionality to work with page mode and edgeless mode
* Page Mode
  - Insert content below the current selection
  - If nothing selected, insert content below the last block
* EdgeLess Mode
  - If no note block is currently selected, create the content as a new note block.
  - Otherwise, insert content into the selected note

Close BS-2760

### What changed?
- Created separate insert handlers for page and edgeless modes with context-aware behavior
  - Added support for inserting content when nothing is selected by targeting the last content block
  - Added special handling for edgeless mode to support inserting below selected note blocks
- Removed the "Replace selection" action and consolidated insert functionality
- Optimized the clickable area of the action button
2025-03-14 09:01:31 +00:00
akumatus
1546b76337 feat(core): poll context docs and files embedding status (#10843)
Close [BS-2791](https://linear.app/affine-design/issue/BS-2791).

### What Changed?
- Add status filed to `CopilotContextDoc` to querying document embedding processing progress.
- Change `ChipState` from `success` to `finished` to better align with backend server status.
- Add `pollContextDocsAndFiles` API for embedding status polling.

### About Polling
- Set the minimum interval to 1 second and the maximum interval to 30 seconds
- Use exponential backoff and increase the interval by 50% after each poll
- Make sure the interval does not exceed the maximum
2025-03-14 08:44:55 +00:00
fengmk2
114e89961f fix(server): add mode property on mention doc input (#10853) 2025-03-14 08:23:28 +00:00
darkskygit
c31d01b2c2 chore(server): merge duplicate queries (#10857) 2025-03-14 08:02:12 +00:00
fengmk2
f61b166e61 fix(server): handle graphql bad input error (#10854) 2025-03-14 07:37:29 +00:00
darkskygit
95cbdc7900 chore(server): enable copilot in doc service (#10850) 2025-03-14 07:07:28 +00:00
doodlewind
d1c10f5401 chore(editor): hide tweakpane for turbo renderer (#10846) 2025-03-14 06:47:15 +00:00
EYHN
f3ef9c4415 feat(nbstore): rename SyncStorage to DocSyncStorage (#10751) 2025-03-14 06:25:26 +00:00
darkskygit
92effd9b51 feat: improve context api (#10812) 2025-03-14 05:57:40 +00:00
Saul-Mirone
b8452f56a8 feat(editor): block painter extension (#10847) 2025-03-14 05:26:58 +00:00
doodlewind
be9f44fc4f fix(editor): worker loading in webpack env (#10832)
### TL;DR

Created dedicated worker entry points to avoid dynamic imports.

### What changed?

- Painters are provided during worker initialization
- Removed `ParagraphPaintConfigExtension` and the associated configuration system
- Created dedicated worker entry points in both the integration test and frontend packages
- Modified `ViewportLayoutPainter` to accept painters in its constructor
- Updated the `TurboRendererConfig` interface to require a `painterWorkerEntry` function

### Why make this change?

Webpack support. Extension objects in main thread are not available to be passed into workers. Dynamic painter path import is hard to support in webpack environment. With the [webpack-ignore](https://webpack.js.org/api/module-methods/#webpackignore) rule, there are still build errors in webpack.
2025-03-14 05:26:57 +00:00
darkskygit
8af0526a22 chore(infra): update dev env template (#10845) 2025-03-14 04:55:27 +00:00
akumatus
daccb2c865 feat(core): add ai file context api (#10842)
Close [BS-2349](https://linear.app/affine-design/issue/BS-2349).

### What Changed?
- Add file context graphql apis
- Pass matched file chunks to LLM

[录屏2025-02-19 23.27.47.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/sJGviKxfE3Ap685cl5bj/8e8a98ca-6959-4bb6-9759-b51d97cede49.mov" />](https://app.graphite.dev/media/video/sJGviKxfE3Ap685cl5bj/8e8a98ca-6959-4bb6-9759-b51d97cede49.mov)
2025-03-14 04:29:54 +00:00
fengmk2
8880cef20b test(infra): add check job to verify committed changes (#10829) 2025-03-14 02:58:27 +00:00
yoyoyohamapi
e086fd2a43 refactor(editor): getFirstContentBlock -> getFirstBlock & getLastContentBlock -> getLastBlock (#10809) 2025-03-14 02:35:22 +00:00
yoyoyohamapi
d3aae962bc test(editor): getFirstContentBlock & getLastContentBlock & isNothingSelected command (#10757)
### TL;DR

Added unit tests for block and selection commands, along with a new test helper system for creating test documents.

### What changed?

- Added unit tests for several commands:
  - `getFirstContentBlockCommand`
  - `getLastContentBlockCommand`
  - `isNothingSelectedCommand`
- Created a new test helpers make it easier to create structured test documents with a html-like syntax:

```typescript
import { describe, expect, it } from 'vitest';
import { affine } from '../__tests__/utils/affine-template';
describe('My Test', () => {
  it('should correctly handle document structure', () => {
    const doc = affine`
      <affine-page>
        <affine-note>
          <affine-paragraph>Test content</affine-paragraph>
        </affine-note>
      </affine-page>
    `;
    // Get blocks
    const pages = doc.getBlocksByFlavour('affine:page');
    const notes = doc.getBlocksByFlavour('affine:note');
    const paragraphs = doc.getBlocksByFlavour('affine:paragraph');
    expect(pages.length).toBe(1);
    expect(notes.length).toBe(1);
    expect(paragraphs.length).toBe(1);
    // Perform more tests here...
  });
});
```
2025-03-14 02:35:21 +00:00
yoyoyohamapi
04efca362e feat(editor): is nothing selected command (#10721)
### TL;DR
Added a new command to check if nothing is currently selected in the editor.

### What changed?
- Created new `isNothingSelectedCommand` to determine if there are no active selections
2025-03-14 02:35:21 +00:00
yoyoyohamapi
aa15b106d9 feat(editor): content block getter command (#10720)
### TL;DR
Added new commands to retrieve the first and last content blocks in a document.

### What changed?
- Created `getFirstContentBlockCommand` to find the first content block in a document
- Created `getLastContentBlockCommand` to find the last content block in a document
- Added `getFirstNoteBlock` utility function to find the first note block in a document
2025-03-14 02:35:20 +00:00
forehalo
d936553047 chore: auto assign feature reqeusts (#10819) 2025-03-14 02:20:14 +00:00
fundon
b238aa3182 fix(editor): clamp method in color picker (#10840)
Related to https://github.com/toeverything/AFFiNE/pull/10577
2025-03-13 19:37:37 +00:00
fundon
341321284e fix(core): should not invert label when its shape text (#10765)
Closes: [BS-2797](https://linear.app/affine-design/issue/BS-2797/在-settings-preview-中,无需对-shape-text-颜色-label-进行反转)

Releated: https://github.com/toeverything/AFFiNE/pull/10546
2025-03-13 13:15:41 +00:00
Boshen
8783859dd1 chore: bump oxlint to v0.15.15; enable import/named (#10836) 2025-03-13 20:59:59 +08:00
darkskygit
d8373f66e7 feat(server): context awareness for copilot (#9611)
fix PD-2167
fix PD-2169
fix PD-2190
2025-03-13 11:44:55 +00:00
Saul-Mirone
05f3069efd feat(editor): add i18n support for block meta display (#10831) 2025-03-13 11:28:56 +00:00
JimmFly
0c9591f08e feat(core): add an entry for admin panel (#10813)
![CleanShot 2025-03-13 at 13 02 25@2x](https://github.com/user-attachments/assets/82f50a5b-f079-4c64-a3fa-6554735bea82)
2025-03-13 10:46:26 +00:00
JimmFly
7df06ea98b feat(admin): add server version check (#10816) 2025-03-13 18:45:56 +08:00
JimmFly
bed4074bdb feat(admin): add import and export users to admin panel (#10810) 2025-03-13 18:45:17 +08:00
JimmFly
e96302ccb2 feat(admin): add ban user to admin panel (#10780) 2025-03-13 18:44:13 +08:00
pengx17
d24ced3dbd fix(electron): electron fallback container should not contain tabs header (#10826)
![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/T2klNLEk0wxLh4NRDzhk/3e8e4838-7f28-453d-bd7f-32bfa96f09ae.png)

fix double tabs header issue when loading from external url
2025-03-13 10:14:26 +00:00
JimmFly
21aa47c094 feat(admin): make the left navigation bar collapsable (#10774) 2025-03-13 09:57:10 +00:00
zzj3720
a4608b52f2 fix(editor): database block e2e test flaky (#10828) 2025-03-13 09:40:24 +00:00
fengmk2
9518ebee95 chore(server): add pro user for testing with extended workspace member limit (#10827) 2025-03-13 09:11:59 +00:00
EYHN
a903f8685b fix(infra): use framework stack provider (#10825)
Move the stack logic from react hook to FrameworkStackProvider,

now `frameworkProvider.get(ServerService)` is equal with `useService(ServerService)`
2025-03-13 08:56:05 +00:00
forehalo
7100d87efe chore(core): doc role telemetry (#10822) 2025-03-13 08:15:46 +00:00
L-Sun
7ba1c1b271 chore(editor): use at menu to insert linked doc (#10808)
Close [BS-2799](https://linear.app/affine-design/issue/BS-2799/区分linked-doc入口)

This PR removes the patch for `Linked Doc` action in the slash menu via the `QuickSearch`, reverting it to use the at menu for inserting.
2025-03-13 08:01:59 +00:00
doodlewind
0f062b7157 refactor(editor): make turbo renderer a gfx extension (#10818)
This allows for easier debugging via `gfx.turboRenderer`
2025-03-13 07:45:05 +00:00
pengx17
a6fd0a135b fix(electron): add back updater (#10814) 2025-03-13 07:29:49 +00:00
Saul-Mirone
7f45993fdb feat(editor): add ui for display block meta in toolbar (#10817) 2025-03-13 07:06:27 +00:00
Saul-Mirone
5148e67891 feat(editor): improve block meta updated event handler (#10815) 2025-03-13 06:34:03 +00:00
L-Sun
8ac687628c chore(editor): at menu stays open when left right arrow keys are pressed (#10806)
Close [BS-2644](https://linear.app/affine-design/issue/BS-2644/menu-support)
2025-03-13 06:14:35 +00:00
forehalo
3db3db0bbc chore(server): revert doc write restriction (#10807) 2025-03-13 05:51:19 +00:00
Saul-Mirone
250f3f1efd feat(editor): add isLocal flag in blockUpdated subject (#10799) 2025-03-13 05:33:06 +00:00
doodlewind
c023b724d0 refactor(editor): generic layout type support for turbo renderer (#10766)
This PR refactored the turbo renderer architecture to support multiple block layout types.

- New base class `BlockLayoutPainter` and `BlockLayoutProvider` are introduced for writing extendable per-block layout querying and painting logic.
- Paragraph-specific lines are all moved into dedicated classes (`ParagraphLayoutProvider` and `ParagraphLayoutPainter`) under the `/variants/paragraph` dir.
- The `renderer-utils.ts` doesn't contain paragraph-specific logic now.
- The `text-utils.ts` is also now scoped for paragraph only.
- Worker messages are now strongly typed.

Upcoming PR should further implement the block registration system using extension API. The `variants` dir could still exist, since there will be similar rendering logic that can be reused among block types (i.e., between paragraph block and list block).
2025-03-13 05:18:12 +00:00