mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-05 01:02:59 +08:00
feat: custom domain (#6067)
* perf: faq * index * delete dataset * delete dataset * perf: delete dataset * init * fix: faq * doc * fix: share link auth (#6063) * standard plan add custom domain config (#6061) * standard plan add custom domain config * bill detail modal * perf: vector count api * feat: custom domain & wecom bot SaaS integration (#6047) * feat: custom Domain type define * feat: custom domain * feat: wecom custom domain * chore: i18n * chore: i18n; team auth * feat: wecom multi-model message support * chore: wecom edit modal * chore(doc): custom domain && wecom bot * fix: type * fix: type * fix: file detect * feat: fe * fix: img name * fix: test * compress img * rename * editor initial status * fix: chat url * perf: s3 upload by buffer * img * refresh * fix: custom domain selector (#6069) * empty tip * perf: s3 init * sort provider * fix: extend * perf: extract filename --------- Co-authored-by: Roy <whoeverimf5@gmail.com> Co-authored-by: heheer <heheer@sealos.io> Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
This commit is contained in:
@@ -6,8 +6,7 @@ import {
|
||||
mockVectorInit,
|
||||
mockGetVectorDataByTime,
|
||||
mockGetVectorCountByTeamId,
|
||||
mockGetVectorCountByDatasetId,
|
||||
mockGetVectorCountByCollectionId,
|
||||
mockGetVectorCount,
|
||||
resetVectorMocks
|
||||
} from '@test/mocks/common/vector';
|
||||
import { mockGetVectorsByText } from '@test/mocks/core/ai/embedding';
|
||||
@@ -18,8 +17,7 @@ import {
|
||||
recallFromVectorStore,
|
||||
getVectorDataByTime,
|
||||
getVectorCountByTeamId,
|
||||
getVectorCountByDatasetId,
|
||||
getVectorCountByCollectionId,
|
||||
getVectorCount,
|
||||
insertDatasetDataVector,
|
||||
deleteDatasetDataVector
|
||||
} from '@fastgpt/service/common/vectorDB/controller';
|
||||
@@ -123,48 +121,42 @@ describe('VectorDB Controller', () => {
|
||||
const result = await getVectorCountByTeamId('team_123');
|
||||
|
||||
expect(result).toBe(150);
|
||||
expect(mockGetVectorCountByTeamId).not.toHaveBeenCalled();
|
||||
expect(mockGetVectorCount).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should fetch from Vector and cache if no cache exists', async () => {
|
||||
mockGetRedisCache.mockResolvedValue(null);
|
||||
mockGetVectorCountByTeamId.mockResolvedValue(200);
|
||||
mockGetVectorCount.mockResolvedValue(200);
|
||||
|
||||
const result = await getVectorCountByTeamId('team_456');
|
||||
|
||||
expect(result).toBe(200);
|
||||
expect(mockGetVectorCountByTeamId).toHaveBeenCalledWith('team_456');
|
||||
expect(mockGetVectorCount).toHaveBeenCalledWith({ teamId: 'team_456' });
|
||||
});
|
||||
|
||||
it('should handle undefined cache value', async () => {
|
||||
mockGetRedisCache.mockResolvedValue(undefined);
|
||||
mockGetVectorCountByTeamId.mockResolvedValue(50);
|
||||
mockGetVectorCount.mockResolvedValue(50);
|
||||
|
||||
const result = await getVectorCountByTeamId('team_789');
|
||||
|
||||
expect(result).toBe(50);
|
||||
expect(mockGetVectorCountByTeamId).toHaveBeenCalled();
|
||||
expect(mockGetVectorCount).toHaveBeenCalledWith({ teamId: 'team_789' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('getVectorCountByDatasetId', () => {
|
||||
it('should call Vector.getVectorCountByDatasetId', async () => {
|
||||
const result = await getVectorCountByDatasetId('team_1', 'dataset_1');
|
||||
describe('getVectorCount', () => {
|
||||
it('should call Vector.getVectorCount', async () => {
|
||||
const result = await getVectorCount({ teamId: 'team_1', datasetId: 'dataset_1' });
|
||||
|
||||
expect(mockGetVectorCountByDatasetId).toHaveBeenCalledWith('team_1', 'dataset_1');
|
||||
expect(mockGetVectorCount).toHaveBeenCalledWith({
|
||||
teamId: 'team_1',
|
||||
datasetId: 'dataset_1'
|
||||
});
|
||||
expect(result).toBe(50);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getVectorCountByCollectionId', () => {
|
||||
it('should call Vector.getVectorCountByCollectionId', async () => {
|
||||
const result = await getVectorCountByCollectionId('team_1', 'dataset_1', 'col_1');
|
||||
|
||||
expect(mockGetVectorCountByCollectionId).toHaveBeenCalledWith('team_1', 'dataset_1', 'col_1');
|
||||
expect(result).toBe(25);
|
||||
});
|
||||
});
|
||||
|
||||
describe('insertDatasetDataVector', () => {
|
||||
const mockModel = {
|
||||
model: 'text-embedding-ada-002',
|
||||
|
||||
Reference in New Issue
Block a user