Commit Graph

36 Commits

Author SHA1 Message Date
darkskygit 42e0563d2e feat: filter out session create request for root doc (#10187) 2025-02-14 11:14:57 +00:00
akumatus 1bf1832211 refactor(core): get copilot sessions api (#10168)
Fix issue [BS-2575](https://linear.app/affine-design/issue/BS-2575).

### What Changed?
- Refactor `getCopilotSessions` api.
  - Add `docId` parameter.
  - Add `action` parameter.
2025-02-14 06:57:58 +00:00
akumatus 79d5f55471 feat(core): move context docs to user prompt (#10162)
Fix issue [BS-2522](https://linear.app/affine-design/issue/BS-2522).

### Why make this change?
If the user data contains illegal content, carrying the user data in the system prompt will run the risk of having the account banned.

### What Changed?
- Move the `Context Documents` to the user prompt.
- Add `withPrompt` in `QueryChatHistoriesInput` options.
- Get chat histories without prompt messages.
- Omit document context when saving messages to the `aiSessionMessage` db.
2025-02-13 12:08:13 +00:00
darkskygit a725df6ebe feat(server): basic context api (#10056)
fix CLOUD-97
fix CLOUD-98
2025-02-11 10:45:01 +00:00
forehalo d3843d8f11 refactor(server): role actions definition (#9962) 2025-02-06 04:54:34 +00:00
Brooooooklyn abeff8bb1a feat(server): doc level permission (#9760)
close CLOUD-89 CLOUD-90 CLOUD-91 CLOUD-92
2025-02-05 07:06:57 +00:00
akumatus 95cf2e047f feat(core): cite source documents in the AI answer (#9863)
Support issue [BS-2424](https://linear.app/affine-design/issue/BS-2424).

### What changed?
- Add relevant document prompt templates.
- Add citation rules in system prompts.
- Change message `params` type to `Record<string, any>`
- Add unit test.

<div class='graphite__hidden'>
          <div>🎥 Video uploaded on Graphite:</div>
            <a href="https://app.graphite.dev/media/video/sJGviKxfE3Ap685cl5bj/ec24e664-039e-4fab-bd26-b3312f011daf.mov">
              <img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/sJGviKxfE3Ap685cl5bj/ec24e664-039e-4fab-bd26-b3312f011daf.mov">
            </a>
          </div>
<video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/ec24e664-039e-4fab-bd26-b3312f011daf.mov">录屏2025-01-23 10.40.38.mov</video>
2025-01-24 04:04:01 +00:00
akumatus 58ce86533e feat(core): support ai network search (#9357)
### What Changed?
- Add `PerplexityProvider` in backend.
- Update session prompt name if user toggle network search mode in chat panel.
- Add experimental flag for AI network search feature.
- Add unit tests and e2e tests.

Search results are streamed and appear word for word:

<div class='graphite__hidden'>
          <div>🎥 Video uploaded on Graphite:</div>
            <a href="https://app.graphite.dev/media/video/sJGviKxfE3Ap685cl5bj/56f6ec7b-4b21-405f-9612-43e083f6fb84.mov">
              <img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/sJGviKxfE3Ap685cl5bj/56f6ec7b-4b21-405f-9612-43e083f6fb84.mov">
            </a>
          </div>
<video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/56f6ec7b-4b21-405f-9612-43e083f6fb84.mov">录屏2024-12-27 18.58.40.mov</video>

Click the little globe icon to manually turn on/off Internet search:
<div class='graphite__hidden'>
          <div>🎥 Video uploaded on Graphite:</div>
            <a href="https://app.graphite.dev/media/video/sJGviKxfE3Ap685cl5bj/778f1406-bf29-498e-a90d-7dad813392d1.mov">
              <img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/sJGviKxfE3Ap685cl5bj/778f1406-bf29-498e-a90d-7dad813392d1.mov">
            </a>
          </div>
<video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/778f1406-bf29-498e-a90d-7dad813392d1.mov">录屏2024-12-27 19.01.16.mov</video>

When there is an image, it will automatically switch to the openai model:

<div class='graphite__hidden'>
          <div>🎥 Video uploaded on Graphite:</div>
            <a href="https://app.graphite.dev/media/video/sJGviKxfE3Ap685cl5bj/56431d8e-75e1-4d84-ab4a-b6636042cc6a.mov">
              <img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/sJGviKxfE3Ap685cl5bj/56431d8e-75e1-4d84-ab4a-b6636042cc6a.mov">
            </a>
          </div>
<video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/56431d8e-75e1-4d84-ab4a-b6636042cc6a.mov">录屏2024-12-27 19.02.13.mov</video>
2025-01-09 04:00:59 +00:00
forehalo 0e73737407 refactor(server): make redis required module (#9121) 2024-12-13 06:27:15 +00:00
forehalo 4c23991047 chore: rename fundamentals to base (#9119) 2024-12-13 06:27:13 +00:00
darkskygit fa554b1054 feat: add copilot metrics (#8455)
fix CLOUD-73
2024-10-18 03:30:02 +00:00
forehalo 682a01e441 feat(server): make a singleton global mutex service (#7900) 2024-08-21 05:30:19 +00:00
forehalo 624f3514fc feat(server): make permission a standalone module (#7880) 2024-08-15 10:01:52 +00:00
darkskygit 339c39c1ec feat: improve prompt management (#7853) 2024-08-14 08:38:36 +00:00
JimmFly b214003968 feat(admin): add prompt management page (#7611)
close AF-907

Supports online modification of prompt, but does not support custom ai key yet

![CleanShot 2024-07-29 at 22 12 39@2x](https://github.com/user-attachments/assets/c67ad0d0-3e5b-44ff-b7db-d07dd11c19e2)
2024-08-13 14:51:54 +08:00
DarkSky dcb9d75db7 feat: allow sort and filter forked session (#7519) 2024-07-18 11:08:47 +08:00
darkskygit bf6c9a5955 feat: add prompt level config (#7445) 2024-07-08 08:11:22 +00:00
darkskygit e8285289fe feat: improve histories query for forked session (#7414) 2024-07-03 04:49:19 +00:00
darkskygit 61870c04d0 feat: fork session support (#7367) 2024-07-03 03:10:09 +00:00
liuyi 54fc1197ad feat(server): introduce user friendly server errors (#7111) 2024-06-17 11:30:58 +08:00
darkskygit a5f9bfdda9 fix: gql result check for clean history (#7154) 2024-06-05 07:49:40 +00:00
forehalo 4b30fbc1e2 feat(server): add copilot prompts management api (#7082) 2024-05-28 13:14:17 +00:00
darkskygit 937b8bf166 feat: history cleanup (#7007)
fix AFF-1069
2024-05-24 08:00:05 +00:00
darkskygit 850bbee629 test: copilot unit & e2e test (#6649)
fix CLOUD-31
2024-04-26 09:43:35 +00:00
darkskygit 15c1e46680 chore: use default throttler replace strict throttler (#6698) 2024-04-26 02:18:20 +00:00
forehalo 94de6f5853 fix(server): always return created timestamp of chat messages (#6658) 2024-04-22 08:39:42 +00:00
darkskygit 657a5250ad feat: update chat prompt (#6639)
fix AFF-878
fix AFF-852 (maybe)
2024-04-19 12:34:02 +00:00
darkskygit 28f2ff24b9 fix: copilot blob process (#6612) 2024-04-18 15:36:30 +00:00
forehalo d9e6561762 feat(server): add created timestamp to history (#6607) 2024-04-18 07:06:47 +00:00
pengx17 5fc56a20ac feat: adopt createMessage upload api (#6596) 2024-04-18 06:55:29 +00:00
DarkSky ccb3bed91e feat: add blob upload support for copilot (#6584) 2024-04-17 14:05:38 +00:00
darkskygit 1b0864eb60 feat: check quota correctly (#6561) 2024-04-16 09:41:48 +00:00
darkskygit e77475aca5 feat: detailed copilot histories (#6523) 2024-04-12 08:39:32 +00:00
DarkSky db1206dbd5 fix: re-create session should skip rewrite messages (#6513) 2024-04-11 12:22:45 +08:00
darkskygit 9f349a2300 feat: text to image impl (#6437)
fix CLOUD-18
fix CLOUD-28
fix CLOUD-29
2024-04-10 12:13:39 +00:00
darkskygit 7c38a54f81 feat: copilot controller (#6272)
fix CLOUD-27
2024-04-10 11:58:40 +00:00