There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix: use correct user id in forked session (#7710)
darkskygit73a6723d15b9
diff --git a/packages/backend/server/src/plugins/copilot/session.ts b/packages/backend/server/src/plugins/copilot/session.tsindex 34a41e34d9..a7f4424657 100644--- a/packages/backend/server/src/plugins/copilot/session.ts+++ b/packages/backend/server/src/plugins/copilot/session.ts@@ -571,6 +571,7 @@ export class ChatSessionService {const forkedState = {...state,+ userId: options.userId,sessionId: randomUUID(),messages: [],parentSessionId: options.sessionId,diff --git a/packages/backend/server/tests/copilot.spec.ts b/packages/backend/server/tests/copilot.spec.tsindex e7883edb24..1f488ec887 100644--- a/packages/backend/server/tests/copilot.spec.ts+++ b/packages/backend/server/tests/copilot.spec.ts@@ -273,7 +273,7 @@ test('should be able to manage chat session', async t => {});test('should be able to fork chat session', async t => {- const { prompt, session } = t.context;+ const { auth, prompt, session } = t.context;await prompt.set('prompt', 'model', [{ role: 'system', content: 'hello {{word}}' },@@ -305,8 +305,10 @@ test('should be able to fork chat session', async t => {...commonParams,});t.not(sessionId, forkedSessionId1, 'should fork a new session');++ const newUser = await auth.signUp('test', '[email protected]', '123456');const forkedSessionId2 = await session.fork({- userId,+ userId: newUser.id,sessionId,latestMessageId,...commonParams,@@ -335,10 +337,13 @@ test('should be able to fork chat session', async t => {);}- // check second times forked session messages+ // check second times forked session{const s2 = (await session.get(forkedSessionId2))!;+ // should overwrite user id+ t.is(s2.config.userId, newUser.id, 'should have same user id');+const finalMessages = s2.finish(params) // @ts-expect-error.map(({ id: _, createdAt: __, ...m }) => m);