@librechat/data-schemas 0.0.2 → 0.0.4

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.
Files changed (61) hide show
  1. package/dist/index.cjs +41 -16
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.es.js +41 -16
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/types/index.d.ts +46 -0
  6. package/dist/types/schema/action.d.ts +62 -0
  7. package/dist/types/schema/agent.d.ts +64 -0
  8. package/dist/types/schema/assistant.d.ts +49 -0
  9. package/dist/types/schema/balance.d.ts +40 -0
  10. package/dist/types/schema/banner.d.ts +44 -0
  11. package/dist/types/schema/categories.d.ts +40 -0
  12. package/dist/types/schema/conversationTag.d.ts +43 -0
  13. package/dist/types/schema/convo.d.ts +76 -0
  14. package/dist/types/schema/defaults.d.ts +169 -0
  15. package/dist/types/schema/file.d.ts +53 -0
  16. package/dist/types/schema/key.d.ts +34 -0
  17. package/dist/types/schema/message.d.ts +63 -0
  18. package/dist/types/schema/pluginAuth.d.ts +36 -0
  19. package/dist/types/schema/preset.d.ts +73 -0
  20. package/dist/types/schema/project.d.ts +43 -0
  21. package/dist/types/schema/prompt.d.ts +36 -0
  22. package/dist/types/schema/promptGroup.d.ts +51 -0
  23. package/dist/types/schema/role.d.ts +31 -0
  24. package/dist/types/schema/session.d.ts +33 -0
  25. package/dist/types/schema/share.d.ts +38 -0
  26. package/dist/types/schema/token.d.ts +38 -0
  27. package/dist/types/schema/toolCall.d.ts +41 -0
  28. package/dist/types/schema/transaction.d.ts +44 -0
  29. package/dist/types/schema/user.d.ts +68 -0
  30. package/package.json +17 -8
  31. package/babel.config.cjs +0 -4
  32. package/jest.config.mjs +0 -19
  33. package/librechat-data-schemas-0.0.2.tgz +0 -0
  34. package/rollup.config.js +0 -25
  35. package/src/index.ts +0 -49
  36. package/src/schema/action.ts +0 -78
  37. package/src/schema/agent.ts +0 -120
  38. package/src/schema/assistant.ts +0 -52
  39. package/src/schema/balance.ts +0 -22
  40. package/src/schema/banner.ts +0 -43
  41. package/src/schema/categories.ts +0 -21
  42. package/src/schema/conversationTag.ts +0 -41
  43. package/src/schema/convo.ts +0 -101
  44. package/src/schema/defaults.ts +0 -138
  45. package/src/schema/file.ts +0 -107
  46. package/src/schema/key.ts +0 -31
  47. package/src/schema/message.ts +0 -185
  48. package/src/schema/pluginAuth.ts +0 -33
  49. package/src/schema/preset.ts +0 -85
  50. package/src/schema/project.ts +0 -34
  51. package/src/schema/prompt.ts +0 -42
  52. package/src/schema/promptGroup.ts +0 -85
  53. package/src/schema/role.ts +0 -91
  54. package/src/schema/session.ts +0 -26
  55. package/src/schema/share.ts +0 -41
  56. package/src/schema/token.ts +0 -50
  57. package/src/schema/toolCall.ts +0 -55
  58. package/src/schema/transaction.ts +0 -60
  59. package/src/schema/user.ts +0 -163
  60. package/tsconfig.json +0 -28
  61. package/tsconfig.spec.json +0 -10
@@ -1,138 +0,0 @@
1
- import { Schema } from 'mongoose';
2
-
3
- // @ts-ignore
4
- export const conversationPreset = {
5
- // endpoint: [azureOpenAI, openAI, anthropic, chatGPTBrowser]
6
- endpoint: {
7
- type: String,
8
- default: null,
9
- required: true,
10
- },
11
- endpointType: {
12
- type: String,
13
- },
14
- // for azureOpenAI, openAI, chatGPTBrowser only
15
- model: {
16
- type: String,
17
- required: false,
18
- },
19
- // for bedrock only
20
- region: {
21
- type: String,
22
- required: false,
23
- },
24
- // for azureOpenAI, openAI only
25
- chatGptLabel: {
26
- type: String,
27
- required: false,
28
- },
29
- // for google only
30
- examples: { type: [{ type: Schema.Types.Mixed }], default: undefined },
31
- modelLabel: {
32
- type: String,
33
- required: false,
34
- },
35
- promptPrefix: {
36
- type: String,
37
- required: false,
38
- },
39
- temperature: {
40
- type: Number,
41
- required: false,
42
- },
43
- top_p: {
44
- type: Number,
45
- required: false,
46
- },
47
- // for google only
48
- topP: {
49
- type: Number,
50
- required: false,
51
- },
52
- topK: {
53
- type: Number,
54
- required: false,
55
- },
56
- maxOutputTokens: {
57
- type: Number,
58
- required: false,
59
- },
60
- maxTokens: {
61
- type: Number,
62
- required: false,
63
- },
64
- presence_penalty: {
65
- type: Number,
66
- required: false,
67
- },
68
- frequency_penalty: {
69
- type: Number,
70
- required: false,
71
- },
72
- file_ids: { type: [{ type: String }], default: undefined },
73
- // deprecated
74
- resendImages: {
75
- type: Boolean,
76
- },
77
- /* Anthropic only */
78
- promptCache: {
79
- type: Boolean,
80
- },
81
- thinking: {
82
- type: Boolean,
83
- },
84
- thinkingBudget: {
85
- type: Number,
86
- },
87
- system: {
88
- type: String,
89
- },
90
- // files
91
- resendFiles: {
92
- type: Boolean,
93
- },
94
- imageDetail: {
95
- type: String,
96
- },
97
- /* agents */
98
- agent_id: {
99
- type: String,
100
- },
101
- /* assistants */
102
- assistant_id: {
103
- type: String,
104
- },
105
- instructions: {
106
- type: String,
107
- },
108
- stop: { type: [{ type: String }], default: undefined },
109
- isArchived: {
110
- type: Boolean,
111
- default: false,
112
- },
113
- /* UI Components */
114
- iconURL: {
115
- type: String,
116
- },
117
- greeting: {
118
- type: String,
119
- },
120
- spec: {
121
- type: String,
122
- },
123
- tags: {
124
- type: [String],
125
- default: [],
126
- },
127
- tools: { type: [{ type: String }], default: undefined },
128
- maxContextTokens: {
129
- type: Number,
130
- },
131
- max_tokens: {
132
- type: Number,
133
- },
134
- /** omni models only */
135
- reasoning_effort: {
136
- type: String,
137
- },
138
- };
@@ -1,107 +0,0 @@
1
- import mongoose, { Schema, Document, Types } from 'mongoose';
2
- import { FileSources } from 'librechat-data-provider';
3
-
4
- // @ts-ignore
5
- export interface IMongoFile extends Document {
6
- user: Types.ObjectId;
7
- conversationId?: string;
8
- file_id: string;
9
- temp_file_id?: string;
10
- bytes: number;
11
- filename: string;
12
- filepath: string;
13
- object: 'file';
14
- embedded?: boolean;
15
- type: string;
16
- context?: string;
17
- usage: number;
18
- source: string;
19
- model?: string;
20
- width?: number;
21
- height?: number;
22
- metadata?: {
23
- fileIdentifier?: string;
24
- };
25
- expiresAt?: Date;
26
- createdAt?: Date;
27
- updatedAt?: Date;
28
- }
29
-
30
- const file: Schema<IMongoFile> = new Schema(
31
- {
32
- user: {
33
- type: mongoose.Schema.Types.ObjectId,
34
- ref: 'User',
35
- index: true,
36
- required: true,
37
- },
38
- conversationId: {
39
- type: String,
40
- ref: 'Conversation',
41
- index: true,
42
- },
43
- file_id: {
44
- type: String,
45
- index: true,
46
- required: true,
47
- },
48
- temp_file_id: {
49
- type: String,
50
- },
51
- bytes: {
52
- type: Number,
53
- required: true,
54
- },
55
- filename: {
56
- type: String,
57
- required: true,
58
- },
59
- filepath: {
60
- type: String,
61
- required: true,
62
- },
63
- object: {
64
- type: String,
65
- required: true,
66
- default: 'file',
67
- },
68
- embedded: {
69
- type: Boolean,
70
- },
71
- type: {
72
- type: String,
73
- required: true,
74
- },
75
- context: {
76
- type: String,
77
- },
78
- usage: {
79
- type: Number,
80
- required: true,
81
- default: 0,
82
- },
83
- source: {
84
- type: String,
85
- default: FileSources.local,
86
- },
87
- model: {
88
- type: String,
89
- },
90
- width: Number,
91
- height: Number,
92
- metadata: {
93
- fileIdentifier: String,
94
- },
95
- expiresAt: {
96
- type: Date,
97
- expires: 3600, // 1 hour in seconds
98
- },
99
- },
100
- {
101
- timestamps: true,
102
- },
103
- );
104
-
105
- file.index({ createdAt: 1, updatedAt: 1 });
106
-
107
- export default file;
package/src/schema/key.ts DELETED
@@ -1,31 +0,0 @@
1
- import mongoose, { Schema, Document, Types } from 'mongoose';
2
-
3
- export interface IKey extends Document {
4
- userId: Types.ObjectId;
5
- name: string;
6
- value: string;
7
- expiresAt?: Date;
8
- }
9
-
10
- const keySchema: Schema<IKey> = new Schema({
11
- userId: {
12
- type: mongoose.Schema.Types.ObjectId,
13
- ref: 'User',
14
- required: true,
15
- },
16
- name: {
17
- type: String,
18
- required: true,
19
- },
20
- value: {
21
- type: String,
22
- required: true,
23
- },
24
- expiresAt: {
25
- type: Date,
26
- },
27
- });
28
-
29
- keySchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
30
-
31
- export default keySchema;
@@ -1,185 +0,0 @@
1
- import mongoose, { Schema, Document } from 'mongoose';
2
-
3
- // @ts-ignore
4
- export interface IMessage extends Document {
5
- messageId: string;
6
- conversationId: string;
7
- user: string;
8
- model?: string;
9
- endpoint?: string;
10
- conversationSignature?: string;
11
- clientId?: string;
12
- invocationId?: number;
13
- parentMessageId?: string;
14
- tokenCount?: number;
15
- summaryTokenCount?: number;
16
- sender?: string;
17
- text?: string;
18
- summary?: string;
19
- isCreatedByUser: boolean;
20
- unfinished?: boolean;
21
- error?: boolean;
22
- finish_reason?: string;
23
- _meiliIndex?: boolean;
24
- files?: unknown[];
25
- plugin?: {
26
- latest?: string;
27
- inputs?: unknown[];
28
- outputs?: string;
29
- };
30
- plugins?: unknown[];
31
- content?: unknown[];
32
- thread_id?: string;
33
- iconURL?: string;
34
- attachments?: unknown[];
35
- expiredAt?: Date;
36
- createdAt?: Date;
37
- updatedAt?: Date;
38
- }
39
-
40
- const messageSchema: Schema<IMessage> = new Schema(
41
- {
42
- messageId: {
43
- type: String,
44
- unique: true,
45
- required: true,
46
- index: true,
47
- meiliIndex: true,
48
- },
49
- conversationId: {
50
- type: String,
51
- index: true,
52
- required: true,
53
- meiliIndex: true,
54
- },
55
- user: {
56
- type: String,
57
- index: true,
58
- required: true,
59
- default: null,
60
- },
61
- model: {
62
- type: String,
63
- default: null,
64
- },
65
- endpoint: {
66
- type: String,
67
- },
68
- conversationSignature: {
69
- type: String,
70
- },
71
- clientId: {
72
- type: String,
73
- },
74
- invocationId: {
75
- type: Number,
76
- },
77
- parentMessageId: {
78
- type: String,
79
- },
80
- tokenCount: {
81
- type: Number,
82
- },
83
- summaryTokenCount: {
84
- type: Number,
85
- },
86
- sender: {
87
- type: String,
88
- meiliIndex: true,
89
- },
90
- text: {
91
- type: String,
92
- meiliIndex: true,
93
- },
94
- summary: {
95
- type: String,
96
- },
97
- isCreatedByUser: {
98
- type: Boolean,
99
- required: true,
100
- default: false,
101
- },
102
- unfinished: {
103
- type: Boolean,
104
- default: false,
105
- },
106
- error: {
107
- type: Boolean,
108
- default: false,
109
- },
110
- finish_reason: {
111
- type: String,
112
- },
113
- _meiliIndex: {
114
- type: Boolean,
115
- required: false,
116
- select: false,
117
- default: false,
118
- },
119
- files: { type: [{ type: mongoose.Schema.Types.Mixed }], default: undefined },
120
- plugin: {
121
- type: {
122
- latest: {
123
- type: String,
124
- required: false,
125
- },
126
- inputs: {
127
- type: [mongoose.Schema.Types.Mixed],
128
- required: false,
129
- default: undefined,
130
- },
131
- outputs: {
132
- type: String,
133
- required: false,
134
- },
135
- },
136
- default: undefined,
137
- },
138
- plugins: { type: [{ type: mongoose.Schema.Types.Mixed }], default: undefined },
139
- content: {
140
- type: [{ type: mongoose.Schema.Types.Mixed }],
141
- default: undefined,
142
- meiliIndex: true,
143
- },
144
- thread_id: {
145
- type: String,
146
- },
147
- /* frontend components */
148
- iconURL: {
149
- type: String,
150
- },
151
- attachments: { type: [{ type: mongoose.Schema.Types.Mixed }], default: undefined },
152
- /*
153
- attachments: {
154
- type: [
155
- {
156
- file_id: String,
157
- filename: String,
158
- filepath: String,
159
- expiresAt: Date,
160
- width: Number,
161
- height: Number,
162
- type: String,
163
- conversationId: String,
164
- messageId: {
165
- type: String,
166
- required: true,
167
- },
168
- toolCallId: String,
169
- },
170
- ],
171
- default: undefined,
172
- },
173
- */
174
- expiredAt: {
175
- type: Date,
176
- },
177
- },
178
- { timestamps: true },
179
- );
180
-
181
- messageSchema.index({ expiredAt: 1 }, { expireAfterSeconds: 0 });
182
- messageSchema.index({ createdAt: 1 });
183
- messageSchema.index({ messageId: 1, user: 1 }, { unique: true });
184
-
185
- export default messageSchema;
@@ -1,33 +0,0 @@
1
- import { Schema, Document } from 'mongoose';
2
-
3
- export interface IPluginAuth extends Document {
4
- authField: string;
5
- value: string;
6
- userId: string;
7
- pluginKey?: string;
8
- createdAt?: Date;
9
- updatedAt?: Date;
10
- }
11
-
12
- const pluginAuthSchema: Schema<IPluginAuth> = new Schema(
13
- {
14
- authField: {
15
- type: String,
16
- required: true,
17
- },
18
- value: {
19
- type: String,
20
- required: true,
21
- },
22
- userId: {
23
- type: String,
24
- required: true,
25
- },
26
- pluginKey: {
27
- type: String,
28
- },
29
- },
30
- { timestamps: true },
31
- );
32
-
33
- export default pluginAuthSchema;
@@ -1,85 +0,0 @@
1
- import mongoose, { Schema, Document } from 'mongoose';
2
- import { conversationPreset } from './defaults';
3
-
4
- // @ts-ignore
5
- export interface IPreset extends Document {
6
- presetId: string;
7
- title: string;
8
- user: string | null;
9
- defaultPreset?: boolean;
10
- order?: number;
11
- // Additional fields from conversationPreset and others will be available via an index signature.
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
- // end of additional fields
50
- agentOptions?: unknown;
51
- }
52
-
53
- const presetSchema: Schema<IPreset> = new Schema(
54
- {
55
- presetId: {
56
- type: String,
57
- unique: true,
58
- required: true,
59
- index: true,
60
- },
61
- title: {
62
- type: String,
63
- default: 'New Chat',
64
- meiliIndex: true,
65
- },
66
- user: {
67
- type: String,
68
- default: null,
69
- },
70
- defaultPreset: {
71
- type: Boolean,
72
- },
73
- order: {
74
- type: Number,
75
- },
76
- ...conversationPreset,
77
- agentOptions: {
78
- type: mongoose.Schema.Types.Mixed,
79
- default: null,
80
- },
81
- },
82
- { timestamps: true },
83
- );
84
-
85
- export default presetSchema;
@@ -1,34 +0,0 @@
1
- import { Schema, Document, Types } from 'mongoose';
2
-
3
- export interface IMongoProject extends Document {
4
- name: string;
5
- promptGroupIds: Types.ObjectId[];
6
- agentIds: string[];
7
- createdAt?: Date;
8
- updatedAt?: Date;
9
- }
10
-
11
- const projectSchema = new Schema<IMongoProject>(
12
- {
13
- name: {
14
- type: String,
15
- required: true,
16
- index: true,
17
- },
18
- promptGroupIds: {
19
- type: [Schema.Types.ObjectId],
20
- ref: 'PromptGroup',
21
- default: [],
22
- },
23
- agentIds: {
24
- type: [String],
25
- ref: 'Agent',
26
- default: [],
27
- },
28
- },
29
- {
30
- timestamps: true,
31
- },
32
- );
33
-
34
- export default projectSchema;
@@ -1,42 +0,0 @@
1
- import { Schema, Document, Types } from 'mongoose';
2
-
3
- export interface IPrompt extends Document {
4
- groupId: Types.ObjectId;
5
- author: Types.ObjectId;
6
- prompt: string;
7
- type: 'text' | 'chat';
8
- createdAt?: Date;
9
- updatedAt?: Date;
10
- }
11
-
12
- const promptSchema: Schema<IPrompt> = new Schema(
13
- {
14
- groupId: {
15
- type: Schema.Types.ObjectId,
16
- ref: 'PromptGroup',
17
- required: true,
18
- index: true,
19
- },
20
- author: {
21
- type: Schema.Types.ObjectId,
22
- ref: 'User',
23
- required: true,
24
- },
25
- prompt: {
26
- type: String,
27
- required: true,
28
- },
29
- type: {
30
- type: String,
31
- enum: ['text', 'chat'],
32
- required: true,
33
- },
34
- },
35
- {
36
- timestamps: true,
37
- },
38
- );
39
-
40
- promptSchema.index({ createdAt: 1, updatedAt: 1 });
41
-
42
- export default promptSchema;