@librechat/data-schemas 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +58 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +58 -16
- package/dist/index.es.js.map +1 -1
- package/dist/types/index.d.ts +46 -0
- package/dist/types/schema/action.d.ts +62 -0
- package/dist/types/schema/agent.d.ts +64 -0
- package/dist/types/schema/assistant.d.ts +49 -0
- package/dist/types/schema/balance.d.ts +45 -0
- package/dist/types/schema/banner.d.ts +44 -0
- package/dist/types/schema/categories.d.ts +40 -0
- package/dist/types/schema/conversationTag.d.ts +43 -0
- package/dist/types/schema/convo.d.ts +76 -0
- package/dist/types/schema/defaults.d.ts +169 -0
- package/dist/types/schema/file.d.ts +53 -0
- package/dist/types/schema/key.d.ts +34 -0
- package/dist/types/schema/message.d.ts +63 -0
- package/dist/types/schema/pluginAuth.d.ts +36 -0
- package/dist/types/schema/preset.d.ts +73 -0
- package/dist/types/schema/project.d.ts +43 -0
- package/dist/types/schema/prompt.d.ts +36 -0
- package/dist/types/schema/promptGroup.d.ts +51 -0
- package/dist/types/schema/role.d.ts +31 -0
- package/dist/types/schema/session.d.ts +33 -0
- package/dist/types/schema/share.d.ts +38 -0
- package/dist/types/schema/token.d.ts +38 -0
- package/dist/types/schema/toolCall.d.ts +41 -0
- package/dist/types/schema/transaction.d.ts +44 -0
- package/dist/types/schema/user.d.ts +68 -0
- package/package.json +16 -7
- package/babel.config.cjs +0 -4
- package/jest.config.mjs +0 -19
- package/librechat-data-schemas-0.0.3.tgz +0 -0
- package/rollup.config.js +0 -25
- package/src/index.ts +0 -49
- package/src/schema/action.ts +0 -78
- package/src/schema/agent.ts +0 -124
- package/src/schema/assistant.ts +0 -52
- package/src/schema/balance.ts +0 -22
- package/src/schema/banner.ts +0 -43
- package/src/schema/categories.ts +0 -21
- package/src/schema/conversationTag.ts +0 -41
- package/src/schema/convo.ts +0 -101
- package/src/schema/defaults.ts +0 -138
- package/src/schema/file.ts +0 -111
- package/src/schema/key.ts +0 -31
- package/src/schema/message.ts +0 -185
- package/src/schema/pluginAuth.ts +0 -33
- package/src/schema/preset.ts +0 -85
- package/src/schema/project.ts +0 -34
- package/src/schema/prompt.ts +0 -42
- package/src/schema/promptGroup.ts +0 -85
- package/src/schema/role.ts +0 -91
- package/src/schema/session.ts +0 -26
- package/src/schema/share.ts +0 -41
- package/src/schema/token.ts +0 -50
- package/src/schema/toolCall.ts +0 -55
- package/src/schema/transaction.ts +0 -60
- package/src/schema/user.ts +0 -163
- package/tsconfig.json +0 -28
- package/tsconfig.spec.json +0 -10
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@librechat/data-schemas",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "0.0.5",
|
|
5
4
|
"description": "Mongoose schemas and models for LibreChat",
|
|
5
|
+
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
8
8
|
"types": "./dist/types/index.d.ts",
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"types": "./dist/types/index.d.ts"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
16
19
|
"scripts": {
|
|
17
20
|
"clean": "rimraf dist",
|
|
18
21
|
"build": "npm run clean && rollup -c --silent --bundleConfigAsCjs",
|
|
@@ -55,14 +58,20 @@
|
|
|
55
58
|
"ts-node": "^10.9.2",
|
|
56
59
|
"typescript": "^5.0.4"
|
|
57
60
|
},
|
|
58
|
-
"publishConfig": {
|
|
59
|
-
"registry": "https://registry.npmjs.org/",
|
|
60
|
-
"access": "public"
|
|
61
|
-
},
|
|
62
61
|
"dependencies": {
|
|
63
62
|
"mongoose": "^8.12.1"
|
|
64
63
|
},
|
|
65
64
|
"peerDependencies": {
|
|
66
65
|
"keyv": "^4.5.4"
|
|
67
|
-
}
|
|
66
|
+
},
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"registry": "https://registry.npmjs.org/",
|
|
69
|
+
"access": "public"
|
|
70
|
+
},
|
|
71
|
+
"keywords": [
|
|
72
|
+
"mongoose",
|
|
73
|
+
"schema",
|
|
74
|
+
"typescript",
|
|
75
|
+
"librechat"
|
|
76
|
+
]
|
|
68
77
|
}
|
package/babel.config.cjs
DELETED
package/jest.config.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!<rootDir>/node_modules/'],
|
|
3
|
-
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
|
|
4
|
-
coverageReporters: ['text', 'cobertura'],
|
|
5
|
-
testResultsProcessor: 'jest-junit',
|
|
6
|
-
moduleNameMapper: {
|
|
7
|
-
'^@src/(.*)$': '<rootDir>/src/$1',
|
|
8
|
-
},
|
|
9
|
-
// coverageThreshold: {
|
|
10
|
-
// global: {
|
|
11
|
-
// statements: 58,
|
|
12
|
-
// branches: 49,
|
|
13
|
-
// functions: 50,
|
|
14
|
-
// lines: 57,
|
|
15
|
-
// },
|
|
16
|
-
// },
|
|
17
|
-
restoreMocks: true,
|
|
18
|
-
testTimeout: 15000,
|
|
19
|
-
};
|
|
Binary file
|
package/rollup.config.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import json from '@rollup/plugin-json';
|
|
2
|
-
import typescript from '@rollup/plugin-typescript';
|
|
3
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
input: 'src/index.ts',
|
|
7
|
-
output: [
|
|
8
|
-
{
|
|
9
|
-
file: 'dist/index.cjs', // Changed from index.js to index.cjs
|
|
10
|
-
format: 'cjs',
|
|
11
|
-
sourcemap: true,
|
|
12
|
-
exports: 'named',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
file: 'dist/index.es.js',
|
|
16
|
-
format: 'esm',
|
|
17
|
-
sourcemap: true,
|
|
18
|
-
exports: 'named',
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
plugins: [json(), commonjs(), typescript({ tsconfig: './tsconfig.json' })],
|
|
22
|
-
external: [
|
|
23
|
-
// list your external dependencies
|
|
24
|
-
],
|
|
25
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import actionSchema from './schema/action';
|
|
2
|
-
import agentSchema from './schema/agent';
|
|
3
|
-
import assistantSchema from './schema/assistant';
|
|
4
|
-
import balanceSchema from './schema/balance';
|
|
5
|
-
import bannerSchema from './schema/banner';
|
|
6
|
-
import categoriesSchema from './schema/categories';
|
|
7
|
-
import conversationTagSchema from './schema/conversationTag';
|
|
8
|
-
import convoSchema from './schema/convo';
|
|
9
|
-
import fileSchema from './schema/file';
|
|
10
|
-
import keySchema from './schema/key';
|
|
11
|
-
import messageSchema from './schema/message';
|
|
12
|
-
import pluginAuthSchema from './schema/pluginAuth';
|
|
13
|
-
import presetSchema from './schema/preset';
|
|
14
|
-
import projectSchema from './schema/project';
|
|
15
|
-
import promptSchema from './schema/prompt';
|
|
16
|
-
import promptGroupSchema from './schema/promptGroup';
|
|
17
|
-
import roleSchema from './schema/role';
|
|
18
|
-
import sessionSchema from './schema/session';
|
|
19
|
-
import shareSchema from './schema/share';
|
|
20
|
-
import tokenSchema from './schema/token';
|
|
21
|
-
import toolCallSchema from './schema/toolCall';
|
|
22
|
-
import transactionSchema from './schema/transaction';
|
|
23
|
-
import userSchema from './schema/user';
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
actionSchema,
|
|
27
|
-
agentSchema,
|
|
28
|
-
assistantSchema,
|
|
29
|
-
balanceSchema,
|
|
30
|
-
bannerSchema,
|
|
31
|
-
categoriesSchema,
|
|
32
|
-
conversationTagSchema,
|
|
33
|
-
convoSchema,
|
|
34
|
-
fileSchema,
|
|
35
|
-
keySchema,
|
|
36
|
-
messageSchema,
|
|
37
|
-
pluginAuthSchema,
|
|
38
|
-
presetSchema,
|
|
39
|
-
projectSchema,
|
|
40
|
-
promptSchema,
|
|
41
|
-
promptGroupSchema,
|
|
42
|
-
roleSchema,
|
|
43
|
-
sessionSchema,
|
|
44
|
-
shareSchema,
|
|
45
|
-
tokenSchema,
|
|
46
|
-
toolCallSchema,
|
|
47
|
-
transactionSchema,
|
|
48
|
-
userSchema,
|
|
49
|
-
};
|
package/src/schema/action.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import mongoose, { Schema, Document } from 'mongoose';
|
|
2
|
-
|
|
3
|
-
export interface IAction extends Document {
|
|
4
|
-
user: mongoose.Types.ObjectId;
|
|
5
|
-
action_id: string;
|
|
6
|
-
type: string;
|
|
7
|
-
settings?: unknown;
|
|
8
|
-
agent_id?: string;
|
|
9
|
-
assistant_id?: string;
|
|
10
|
-
metadata: {
|
|
11
|
-
api_key?: string;
|
|
12
|
-
auth: {
|
|
13
|
-
authorization_type?: string;
|
|
14
|
-
custom_auth_header?: string;
|
|
15
|
-
type: 'service_http' | 'oauth' | 'none';
|
|
16
|
-
authorization_content_type?: string;
|
|
17
|
-
authorization_url?: string;
|
|
18
|
-
client_url?: string;
|
|
19
|
-
scope?: string;
|
|
20
|
-
token_exchange_method: 'default_post' | 'basic_auth_header' | null;
|
|
21
|
-
};
|
|
22
|
-
domain: string;
|
|
23
|
-
privacy_policy_url?: string;
|
|
24
|
-
raw_spec?: string;
|
|
25
|
-
oauth_client_id?: string;
|
|
26
|
-
oauth_client_secret?: string;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Define the Auth sub-schema with type-safety.
|
|
31
|
-
const AuthSchema = new Schema(
|
|
32
|
-
{
|
|
33
|
-
authorization_type: { type: String },
|
|
34
|
-
custom_auth_header: { type: String },
|
|
35
|
-
type: { type: String, enum: ['service_http', 'oauth', 'none'] },
|
|
36
|
-
authorization_content_type: { type: String },
|
|
37
|
-
authorization_url: { type: String },
|
|
38
|
-
client_url: { type: String },
|
|
39
|
-
scope: { type: String },
|
|
40
|
-
token_exchange_method: { type: String, enum: ['default_post', 'basic_auth_header', null] },
|
|
41
|
-
},
|
|
42
|
-
{ _id: false },
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const Action = new Schema<IAction>({
|
|
46
|
-
user: {
|
|
47
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
48
|
-
ref: 'User',
|
|
49
|
-
index: true,
|
|
50
|
-
required: true,
|
|
51
|
-
},
|
|
52
|
-
action_id: {
|
|
53
|
-
type: String,
|
|
54
|
-
index: true,
|
|
55
|
-
required: true,
|
|
56
|
-
},
|
|
57
|
-
type: {
|
|
58
|
-
type: String,
|
|
59
|
-
default: 'action_prototype',
|
|
60
|
-
},
|
|
61
|
-
settings: Schema.Types.Mixed,
|
|
62
|
-
agent_id: String,
|
|
63
|
-
assistant_id: String,
|
|
64
|
-
metadata: {
|
|
65
|
-
api_key: String,
|
|
66
|
-
auth: AuthSchema,
|
|
67
|
-
domain: {
|
|
68
|
-
type: String,
|
|
69
|
-
required: true,
|
|
70
|
-
},
|
|
71
|
-
privacy_policy_url: String,
|
|
72
|
-
raw_spec: String,
|
|
73
|
-
oauth_client_id: String,
|
|
74
|
-
oauth_client_secret: String,
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
export default Action;
|
package/src/schema/agent.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { Schema, Document, Types } from 'mongoose';
|
|
2
|
-
export interface IAgent extends Omit<Document, 'model'> {
|
|
3
|
-
id: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
instructions?: string;
|
|
7
|
-
avatar?: {
|
|
8
|
-
filepath: string;
|
|
9
|
-
source: string;
|
|
10
|
-
};
|
|
11
|
-
provider: string;
|
|
12
|
-
model: string;
|
|
13
|
-
model_parameters?: Record<string, unknown>;
|
|
14
|
-
artifacts?: string;
|
|
15
|
-
access_level?: number;
|
|
16
|
-
recursion_limit?: number;
|
|
17
|
-
tools?: string[];
|
|
18
|
-
tool_kwargs?: Array<unknown>;
|
|
19
|
-
actions?: string[];
|
|
20
|
-
author: Types.ObjectId;
|
|
21
|
-
authorName?: string;
|
|
22
|
-
hide_sequential_outputs?: boolean;
|
|
23
|
-
end_after_tools?: boolean;
|
|
24
|
-
agent_ids?: string[];
|
|
25
|
-
isCollaborative?: boolean;
|
|
26
|
-
conversation_starters?: string[];
|
|
27
|
-
tool_resources?: unknown;
|
|
28
|
-
projectIds?: Types.ObjectId[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const agentSchema = new Schema<IAgent>(
|
|
32
|
-
{
|
|
33
|
-
id: {
|
|
34
|
-
type: String,
|
|
35
|
-
index: true,
|
|
36
|
-
unique: true,
|
|
37
|
-
required: true,
|
|
38
|
-
},
|
|
39
|
-
name: {
|
|
40
|
-
type: String,
|
|
41
|
-
},
|
|
42
|
-
description: {
|
|
43
|
-
type: String,
|
|
44
|
-
},
|
|
45
|
-
instructions: {
|
|
46
|
-
type: String,
|
|
47
|
-
},
|
|
48
|
-
avatar: {
|
|
49
|
-
type: Schema.Types.Mixed,
|
|
50
|
-
default: undefined,
|
|
51
|
-
},
|
|
52
|
-
provider: {
|
|
53
|
-
type: String,
|
|
54
|
-
required: true,
|
|
55
|
-
},
|
|
56
|
-
model: {
|
|
57
|
-
type: String,
|
|
58
|
-
required: true,
|
|
59
|
-
},
|
|
60
|
-
model_parameters: {
|
|
61
|
-
type: Object,
|
|
62
|
-
},
|
|
63
|
-
artifacts: {
|
|
64
|
-
type: String,
|
|
65
|
-
},
|
|
66
|
-
access_level: {
|
|
67
|
-
type: Number,
|
|
68
|
-
},
|
|
69
|
-
recursion_limit: {
|
|
70
|
-
type: Number,
|
|
71
|
-
},
|
|
72
|
-
tools: {
|
|
73
|
-
type: [String],
|
|
74
|
-
default: undefined,
|
|
75
|
-
},
|
|
76
|
-
tool_kwargs: {
|
|
77
|
-
type: [{ type: Schema.Types.Mixed }],
|
|
78
|
-
},
|
|
79
|
-
actions: {
|
|
80
|
-
type: [String],
|
|
81
|
-
default: undefined,
|
|
82
|
-
},
|
|
83
|
-
author: {
|
|
84
|
-
type: Schema.Types.ObjectId,
|
|
85
|
-
ref: 'User',
|
|
86
|
-
required: true,
|
|
87
|
-
},
|
|
88
|
-
authorName: {
|
|
89
|
-
type: String,
|
|
90
|
-
default: undefined,
|
|
91
|
-
},
|
|
92
|
-
hide_sequential_outputs: {
|
|
93
|
-
type: Boolean,
|
|
94
|
-
},
|
|
95
|
-
end_after_tools: {
|
|
96
|
-
type: Boolean,
|
|
97
|
-
},
|
|
98
|
-
agent_ids: {
|
|
99
|
-
type: [String],
|
|
100
|
-
},
|
|
101
|
-
isCollaborative: {
|
|
102
|
-
type: Boolean,
|
|
103
|
-
default: undefined,
|
|
104
|
-
},
|
|
105
|
-
conversation_starters: {
|
|
106
|
-
type: [String],
|
|
107
|
-
default: [],
|
|
108
|
-
},
|
|
109
|
-
tool_resources: {
|
|
110
|
-
type: Schema.Types.Mixed,
|
|
111
|
-
default: {},
|
|
112
|
-
},
|
|
113
|
-
projectIds: {
|
|
114
|
-
type: [Schema.Types.ObjectId],
|
|
115
|
-
ref: 'Project',
|
|
116
|
-
index: true,
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
timestamps: true,
|
|
121
|
-
},
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
export default agentSchema;
|
package/src/schema/assistant.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Schema, Document, Types } from 'mongoose';
|
|
2
|
-
|
|
3
|
-
export interface IAssistant extends Document {
|
|
4
|
-
user: Types.ObjectId;
|
|
5
|
-
assistant_id: string;
|
|
6
|
-
avatar?: {
|
|
7
|
-
filepath: string;
|
|
8
|
-
source: string;
|
|
9
|
-
};
|
|
10
|
-
conversation_starters?: string[];
|
|
11
|
-
access_level?: number;
|
|
12
|
-
file_ids?: string[];
|
|
13
|
-
actions?: string[];
|
|
14
|
-
append_current_datetime?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const assistantSchema = new Schema<IAssistant>(
|
|
18
|
-
{
|
|
19
|
-
user: {
|
|
20
|
-
type: Schema.Types.ObjectId,
|
|
21
|
-
ref: 'User',
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
assistant_id: {
|
|
25
|
-
type: String,
|
|
26
|
-
index: true,
|
|
27
|
-
required: true,
|
|
28
|
-
},
|
|
29
|
-
avatar: {
|
|
30
|
-
type: Schema.Types.Mixed,
|
|
31
|
-
default: undefined,
|
|
32
|
-
},
|
|
33
|
-
conversation_starters: {
|
|
34
|
-
type: [String],
|
|
35
|
-
default: [],
|
|
36
|
-
},
|
|
37
|
-
access_level: {
|
|
38
|
-
type: Number,
|
|
39
|
-
},
|
|
40
|
-
file_ids: { type: [String], default: undefined },
|
|
41
|
-
actions: { type: [String], default: undefined },
|
|
42
|
-
append_current_datetime: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
default: false,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
timestamps: true,
|
|
49
|
-
},
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
export default assistantSchema;
|
package/src/schema/balance.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Schema, Document, Types } from 'mongoose';
|
|
2
|
-
|
|
3
|
-
export interface IBalance extends Document {
|
|
4
|
-
user: Types.ObjectId;
|
|
5
|
-
tokenCredits: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const balanceSchema = new Schema<IBalance>({
|
|
9
|
-
user: {
|
|
10
|
-
type: Schema.Types.ObjectId,
|
|
11
|
-
ref: 'User',
|
|
12
|
-
index: true,
|
|
13
|
-
required: true,
|
|
14
|
-
},
|
|
15
|
-
// 1000 tokenCredits = 1 mill ($0.001 USD)
|
|
16
|
-
tokenCredits: {
|
|
17
|
-
type: Number,
|
|
18
|
-
default: 0,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export default balanceSchema;
|
package/src/schema/banner.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Schema, Document } from 'mongoose';
|
|
2
|
-
|
|
3
|
-
export interface IBanner extends Document {
|
|
4
|
-
bannerId: string;
|
|
5
|
-
message: string;
|
|
6
|
-
displayFrom: Date;
|
|
7
|
-
displayTo?: Date;
|
|
8
|
-
type: 'banner' | 'popup';
|
|
9
|
-
isPublic: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const bannerSchema = new Schema<IBanner>(
|
|
13
|
-
{
|
|
14
|
-
bannerId: {
|
|
15
|
-
type: String,
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
message: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: true,
|
|
21
|
-
},
|
|
22
|
-
displayFrom: {
|
|
23
|
-
type: Date,
|
|
24
|
-
required: true,
|
|
25
|
-
default: Date.now,
|
|
26
|
-
},
|
|
27
|
-
displayTo: {
|
|
28
|
-
type: Date,
|
|
29
|
-
},
|
|
30
|
-
type: {
|
|
31
|
-
type: String,
|
|
32
|
-
enum: ['banner', 'popup'],
|
|
33
|
-
default: 'banner',
|
|
34
|
-
},
|
|
35
|
-
isPublic: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: false,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
{ timestamps: true },
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
export default bannerSchema;
|
package/src/schema/categories.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Schema, Document } from 'mongoose';
|
|
2
|
-
|
|
3
|
-
export interface ICategory extends Document {
|
|
4
|
-
label: string;
|
|
5
|
-
value: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const categoriesSchema = new Schema<ICategory>({
|
|
9
|
-
label: {
|
|
10
|
-
type: String,
|
|
11
|
-
required: true,
|
|
12
|
-
unique: true,
|
|
13
|
-
},
|
|
14
|
-
value: {
|
|
15
|
-
type: String,
|
|
16
|
-
required: true,
|
|
17
|
-
unique: true,
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export default categoriesSchema;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Schema, Document } from 'mongoose';
|
|
2
|
-
|
|
3
|
-
export interface IConversationTag extends Document {
|
|
4
|
-
tag?: string;
|
|
5
|
-
user?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
count?: number;
|
|
8
|
-
position?: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const conversationTag = new Schema<IConversationTag>(
|
|
12
|
-
{
|
|
13
|
-
tag: {
|
|
14
|
-
type: String,
|
|
15
|
-
index: true,
|
|
16
|
-
},
|
|
17
|
-
user: {
|
|
18
|
-
type: String,
|
|
19
|
-
index: true,
|
|
20
|
-
},
|
|
21
|
-
description: {
|
|
22
|
-
type: String,
|
|
23
|
-
index: true,
|
|
24
|
-
},
|
|
25
|
-
count: {
|
|
26
|
-
type: Number,
|
|
27
|
-
default: 0,
|
|
28
|
-
},
|
|
29
|
-
position: {
|
|
30
|
-
type: Number,
|
|
31
|
-
default: 0,
|
|
32
|
-
index: true,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{ timestamps: true },
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
// Create a compound index on tag and user with unique constraint.
|
|
39
|
-
conversationTag.index({ tag: 1, user: 1 }, { unique: true });
|
|
40
|
-
|
|
41
|
-
export default conversationTag;
|
package/src/schema/convo.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import mongoose, { Schema, Document, Types } from 'mongoose';
|
|
2
|
-
import { conversationPreset } from './defaults';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
export interface IConversation extends Document {
|
|
6
|
-
conversationId: string;
|
|
7
|
-
title?: string;
|
|
8
|
-
user?: string;
|
|
9
|
-
messages?: Types.ObjectId[];
|
|
10
|
-
agentOptions?: unknown;
|
|
11
|
-
// Fields provided by conversationPreset (adjust types as needed)
|
|
12
|
-
endpoint?: string;
|
|
13
|
-
endpointType?: string;
|
|
14
|
-
model?: string;
|
|
15
|
-
region?: string;
|
|
16
|
-
chatGptLabel?: string;
|
|
17
|
-
examples?: unknown[];
|
|
18
|
-
modelLabel?: string;
|
|
19
|
-
promptPrefix?: string;
|
|
20
|
-
temperature?: number;
|
|
21
|
-
top_p?: number;
|
|
22
|
-
topP?: number;
|
|
23
|
-
topK?: number;
|
|
24
|
-
maxOutputTokens?: number;
|
|
25
|
-
maxTokens?: number;
|
|
26
|
-
presence_penalty?: number;
|
|
27
|
-
frequency_penalty?: number;
|
|
28
|
-
file_ids?: string[];
|
|
29
|
-
resendImages?: boolean;
|
|
30
|
-
promptCache?: boolean;
|
|
31
|
-
thinking?: boolean;
|
|
32
|
-
thinkingBudget?: number;
|
|
33
|
-
system?: string;
|
|
34
|
-
resendFiles?: boolean;
|
|
35
|
-
imageDetail?: string;
|
|
36
|
-
agent_id?: string;
|
|
37
|
-
assistant_id?: string;
|
|
38
|
-
instructions?: string;
|
|
39
|
-
stop?: string[];
|
|
40
|
-
isArchived?: boolean;
|
|
41
|
-
iconURL?: string;
|
|
42
|
-
greeting?: string;
|
|
43
|
-
spec?: string;
|
|
44
|
-
tags?: string[];
|
|
45
|
-
tools?: string[];
|
|
46
|
-
maxContextTokens?: number;
|
|
47
|
-
max_tokens?: number;
|
|
48
|
-
reasoning_effort?: string;
|
|
49
|
-
// Additional fields
|
|
50
|
-
files?: string[];
|
|
51
|
-
expiredAt?: Date;
|
|
52
|
-
createdAt?: Date;
|
|
53
|
-
updatedAt?: Date;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const convoSchema: Schema<IConversation> = new Schema(
|
|
57
|
-
{
|
|
58
|
-
conversationId: {
|
|
59
|
-
type: String,
|
|
60
|
-
unique: true,
|
|
61
|
-
required: true,
|
|
62
|
-
index: true,
|
|
63
|
-
meiliIndex: true,
|
|
64
|
-
},
|
|
65
|
-
title: {
|
|
66
|
-
type: String,
|
|
67
|
-
default: 'New Chat',
|
|
68
|
-
meiliIndex: true,
|
|
69
|
-
},
|
|
70
|
-
user: {
|
|
71
|
-
type: String,
|
|
72
|
-
index: true,
|
|
73
|
-
},
|
|
74
|
-
messages: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Message' }],
|
|
75
|
-
agentOptions: {
|
|
76
|
-
type: mongoose.Schema.Types.Mixed,
|
|
77
|
-
},
|
|
78
|
-
...conversationPreset,
|
|
79
|
-
agent_id: {
|
|
80
|
-
type: String,
|
|
81
|
-
},
|
|
82
|
-
tags: {
|
|
83
|
-
type: [String],
|
|
84
|
-
default: [],
|
|
85
|
-
meiliIndex: true,
|
|
86
|
-
},
|
|
87
|
-
files: {
|
|
88
|
-
type: [String],
|
|
89
|
-
},
|
|
90
|
-
expiredAt: {
|
|
91
|
-
type: Date,
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
{ timestamps: true },
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
convoSchema.index({ expiredAt: 1 }, { expireAfterSeconds: 0 });
|
|
98
|
-
convoSchema.index({ createdAt: 1, updatedAt: 1 });
|
|
99
|
-
convoSchema.index({ conversationId: 1, user: 1 }, { unique: true });
|
|
100
|
-
|
|
101
|
-
export default convoSchema;
|