feat: pg引入

This commit is contained in:
archer
2023-04-18 22:35:55 +08:00
parent a540ee944a
commit 9e951fbc15
17 changed files with 260 additions and 150 deletions

View File

@@ -1,10 +1,12 @@
import type { Mongoose } from 'mongoose';
import type { RedisClientType } from 'redis';
import type { Agent } from 'http';
import type { Pool } from 'pg';
declare global {
var mongodb: Mongoose | string | null;
var redisClient: RedisClientType | null;
var pgClient: Pool | null;
var generatingQA: boolean;
var generatingAbstract: boolean;
var generatingVector: boolean;

View File

@@ -12,7 +12,7 @@ export interface ModelUpdateParams {
export interface ModelDataItemType {
id: string;
status: 0 | 1; // 1代表向量生成完毕
status: 'waiting' | 'ready';
q: string; // 提问词
a: string; // 原文
modelId: string;

View File

@@ -66,11 +66,8 @@ export interface ModelDataSchema {
_id: string;
modelId: string;
userId: string;
text: string;
q: {
id: string;
text: string;
};
a: string;
q: string;
status: ModelDataType;
}

10
src/types/pg.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
import { ModelDataStatusEnum } from '@/constants/model';
export interface PgModelDataItemType {
id: string;
q: string;
a: string;
status: `${ModelDataStatusEnum}`;
model_id: string;
user_id: string;
}

View File

@@ -1,7 +0,0 @@
import { ModelDataStatusEnum } from '@/constants/redis';
export interface RedisModelDataItemType {
id: string;
q: string;
text: string;
status: `${ModelDataStatusEnum}`;
}