mirror of
https://github.com/labring/FastGPT.git
synced 2026-02-27 01:02:22 +08:00
optimize app update time (#6127)
* feat: add chat visibility controls and improve quote reader permissions (#6102) * feat: add chat visibility controls and improve quote reader permissions * fix test * zod * fix * test & openapi * frontend filter * update name * fix * fix * rename variables * fix * test * fix build * fix * fix --------- Co-authored-by: archer <545436317@qq.com> * app update time * recent app * fix * type * fix * context * perf: update app usingtime code * fix: ts * update parent * doc * perf: code per * unauth refresh --------- Co-authored-by: archer <545436317@qq.com>
This commit is contained in:
@@ -31,7 +31,6 @@ const createMockProps = (
|
||||
outputs: []
|
||||
}
|
||||
],
|
||||
isUpdateUseTime: true,
|
||||
newTitle: 'Test Chat',
|
||||
source: 'online' as any,
|
||||
userContent: {
|
||||
@@ -228,7 +227,7 @@ describe('saveChat', () => {
|
||||
collectionId: 'collection-1',
|
||||
sourceId: 'source-1',
|
||||
sourceName: 'doc.pdf',
|
||||
score: [{ type: 'embedding', value: 0.95, index: 0 }],
|
||||
score: [{ type: 'embedding' as const, value: 0.95, index: 0 }],
|
||||
q: 'What is AI?',
|
||||
a: 'AI stands for Artificial Intelligence...',
|
||||
updateTime: new Date()
|
||||
@@ -283,36 +282,6 @@ describe('saveChat', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('should update app use time when isUpdateUseTime is true', async () => {
|
||||
const beforeTime = new Date();
|
||||
|
||||
const props = createMockProps(
|
||||
{ isUpdateUseTime: true },
|
||||
{ appId: testAppId, teamId: testTeamId, tmbId: testTmbId }
|
||||
);
|
||||
|
||||
await saveChat(props);
|
||||
|
||||
const app = await MongoApp.findById(testAppId);
|
||||
expect(app?.updateTime).toBeDefined();
|
||||
expect(app!.updateTime.getTime()).toBeGreaterThanOrEqual(beforeTime.getTime());
|
||||
});
|
||||
|
||||
it('should not update app use time when isUpdateUseTime is false', async () => {
|
||||
const app = await MongoApp.findById(testAppId);
|
||||
const originalUpdateTime = app!.updateTime;
|
||||
|
||||
const props = createMockProps(
|
||||
{ isUpdateUseTime: false },
|
||||
{ appId: testAppId, teamId: testTeamId, tmbId: testTmbId }
|
||||
);
|
||||
|
||||
await saveChat(props);
|
||||
|
||||
const updatedApp = await MongoApp.findById(testAppId);
|
||||
expect(updatedApp!.updateTime.getTime()).toBe(originalUpdateTime.getTime());
|
||||
});
|
||||
|
||||
it('should create chat data log with error count when response has error', async () => {
|
||||
const props = createMockProps(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user