feat: 模型数据管理

feat: 模型数据导入

feat: redis 向量入库

feat: 向量索引

feat: 文件导入模型

perf: 交互

perf: prompt
This commit is contained in:
archer
2023-03-29 00:22:48 +08:00
parent 713332522f
commit 2099a87908
45 changed files with 1522 additions and 284 deletions

View File

@@ -1,9 +1,12 @@
import type { Mongoose } from 'mongoose';
import type { RedisClientType } from 'redis';
declare global {
var mongodb: Mongoose | string | null;
var redisClient: RedisClientType | null;
var generatingQA: boolean;
var generatingAbstract: boolean;
var generatingVector: boolean;
var QRCode: any;
interface Window {
['pdfjs-dist/build/pdf']: any;

View File

@@ -8,3 +8,12 @@ export interface ModelUpdateParams {
service: ModelSchema.service;
security: ModelSchema.security;
}
export interface ModelDataItemType {
id: string;
status: 0 | 1; // 1代表向量生成完毕
q: string; // 提问词
a: string; // 原文
modelId: string;
userId: string;
}

View File

@@ -51,12 +51,26 @@ export interface ModelPopulate extends ModelSchema {
userId: UserModelSchema;
}
export type ModelDataType = 0 | 1;
export interface ModelDataSchema {
_id: string;
q: string;
a: string;
status: 0 | 1 | 2;
createTime: Date;
modelId: string;
userId: string;
text: string;
q: {
id: string;
text: string;
}[];
status: ModelDataType;
}
export interface ModelSplitDataSchema {
_id: string;
userId: string;
modelId: string;
rawText: string;
errorText: string;
textList: string[];
}
export interface TrainingSchema {

6
src/types/redis.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
export interface RedisModelDataItemType {
id: string;
vector: number[];
dataId: string;
modelId: string;
}