feat(server): allow chat session dangling & pin session support (#12849)

fix AI-181
fix AI-179
fix AI-178
fix PD-2682
fix PD-2683
This commit is contained in:
DarkSky
2025-06-19 13:17:01 +08:00
committed by GitHub
parent d80bfac1d2
commit bd04930560
28 changed files with 1422 additions and 394 deletions
@@ -275,7 +275,7 @@ test('should be able to manage chat session', async t => {
]);
const params = { word: 'world' };
const commonParams = { docId: 'test', workspaceId: 'test' };
const commonParams = { docId: 'test', workspaceId: 'test', pinned: false };
const sessionId = await session.create({
userId,
@@ -342,11 +342,12 @@ test('should be able to update chat session prompt', async t => {
docId: 'test',
workspaceId: 'test',
userId,
pinned: false,
});
t.truthy(sessionId, 'should create session');
// Update the session
const updatedSessionId = await session.updateSessionPrompt({
const updatedSessionId = await session.updateSession({
sessionId,
promptName: 'Search With AFFiNE AI',
userId,
@@ -371,7 +372,7 @@ test('should be able to fork chat session', async t => {
]);
const params = { word: 'world' };
const commonParams = { docId: 'test', workspaceId: 'test' };
const commonParams = { docId: 'test', workspaceId: 'test', pinned: false };
// create session
const sessionId = await session.create({
userId,
@@ -494,6 +495,7 @@ test('should be able to process message id', async t => {
workspaceId: 'test',
userId,
promptName: 'prompt',
pinned: false,
});
const s = (await session.get(sessionId))!;
@@ -537,6 +539,7 @@ test('should be able to generate with message id', async t => {
workspaceId: 'test',
userId,
promptName: 'prompt',
pinned: false,
});
const s = (await session.get(sessionId))!;
@@ -559,6 +562,7 @@ test('should be able to generate with message id', async t => {
workspaceId: 'test',
userId,
promptName: 'prompt',
pinned: false,
});
const s = (await session.get(sessionId))!;
@@ -586,6 +590,7 @@ test('should be able to generate with message id', async t => {
workspaceId: 'test',
userId,
promptName: 'prompt',
pinned: false,
});
const s = (await session.get(sessionId))!;
@@ -614,6 +619,7 @@ test('should save message correctly', async t => {
workspaceId: 'test',
userId,
promptName: 'prompt',
pinned: false,
});
const s = (await session.get(sessionId))!;
@@ -643,6 +649,7 @@ test('should revert message correctly', async t => {
workspaceId: 'test',
userId,
promptName: 'prompt',
pinned: false,
});
const s = (await session.get(sessionId))!;
@@ -742,6 +749,7 @@ test('should handle params correctly in chat session', async t => {
workspaceId: 'test',
userId,
promptName: 'prompt',
pinned: false,
});
const s = (await session.get(sessionId))!;
@@ -1506,6 +1514,7 @@ test('should be able to manage context', async t => {
workspaceId: 'test',
userId,
promptName: 'prompt',
pinned: false,
});
// use mocked embedding client
@@ -1729,6 +1738,7 @@ test('should be able to manage workspace embedding', async t => {
workspaceId: ws.id,
userId,
promptName: 'prompt',
pinned: false,
});
const contextSession = await context.create(sessionId);