feat: allow sort and filter forked session (#7519)

This commit is contained in:
DarkSky
2024-07-18 11:08:47 +08:00
committed by GitHub
parent ccac7a883c
commit dcb9d75db7
10 changed files with 166 additions and 26 deletions

View File

@@ -564,15 +564,29 @@ test('should be able to list history', async t => {
promptName
);
const messageId = await createCopilotMessage(app, token, sessionId);
const messageId = await createCopilotMessage(app, token, sessionId, 'hello');
await chatWithText(app, token, sessionId, messageId);
const histories = await getHistories(app, token, { workspaceId });
t.deepEqual(
histories.map(h => h.messages.map(m => m.content)),
[['generate text to text']],
'should be able to list history'
);
{
const histories = await getHistories(app, token, { workspaceId });
t.deepEqual(
histories.map(h => h.messages.map(m => m.content)),
[['hello', 'generate text to text']],
'should be able to list history'
);
}
{
const histories = await getHistories(app, token, {
workspaceId,
options: { messageOrder: 'desc' },
});
t.deepEqual(
histories.map(h => h.messages.map(m => m.content)),
[['generate text to text', 'hello']],
'should be able to list history'
);
}
});
test('should reject request that user have not permission', async t => {