@librechat/data-schemas 0.0.19 → 0.0.21
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 +67 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +67 -23
- package/dist/index.es.js.map +1 -1
- package/dist/types/methods/agentCategory.d.ts +3 -2
- package/dist/types/schema/agentCategory.d.ts +3 -3
- package/dist/types/schema/defaults.d.ts +3 -0
- package/dist/types/schema/preset.d.ts +1 -0
- package/dist/types/types/agentCategory.d.ts +2 -0
- package/dist/types/types/convo.d.ts +1 -0
- package/dist/types/types/user.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -217,6 +217,10 @@ const agentCategorySchema = new Schema({
|
|
|
217
217
|
default: true,
|
|
218
218
|
index: true,
|
|
219
219
|
},
|
|
220
|
+
custom: {
|
|
221
|
+
type: Boolean,
|
|
222
|
+
default: false,
|
|
223
|
+
},
|
|
220
224
|
}, {
|
|
221
225
|
timestamps: true,
|
|
222
226
|
});
|
|
@@ -499,6 +503,9 @@ const conversationPreset = {
|
|
|
499
503
|
disableStreaming: {
|
|
500
504
|
type: Boolean,
|
|
501
505
|
},
|
|
506
|
+
fileTokenLimit: {
|
|
507
|
+
type: Number,
|
|
508
|
+
},
|
|
502
509
|
/** Reasoning models only */
|
|
503
510
|
reasoning_effort: {
|
|
504
511
|
type: String,
|
|
@@ -1809,7 +1816,7 @@ const transports$1 = [
|
|
|
1809
1816
|
zippedArchive: true,
|
|
1810
1817
|
maxSize: '20m',
|
|
1811
1818
|
maxFiles: '14d',
|
|
1812
|
-
format: fileFormat$1,
|
|
1819
|
+
format: winston.format.combine(fileFormat$1, winston.format.json()),
|
|
1813
1820
|
}),
|
|
1814
1821
|
];
|
|
1815
1822
|
if (useDebugLogging$1) {
|
|
@@ -3543,6 +3550,7 @@ function createAgentCategoryMethods(mongoose) {
|
|
|
3543
3550
|
description: category.description || '',
|
|
3544
3551
|
order: category.order || index,
|
|
3545
3552
|
isActive: true,
|
|
3553
|
+
custom: category.custom || false,
|
|
3546
3554
|
},
|
|
3547
3555
|
},
|
|
3548
3556
|
upsert: true,
|
|
@@ -3607,60 +3615,96 @@ function createAgentCategoryMethods(mongoose) {
|
|
|
3607
3615
|
return await AgentCategory.find({}).sort({ order: 1, label: 1 }).lean();
|
|
3608
3616
|
}
|
|
3609
3617
|
/**
|
|
3610
|
-
* Ensure default categories exist
|
|
3611
|
-
* @returns Promise<boolean> - true if categories were
|
|
3618
|
+
* Ensure default categories exist and update them if they don't have localization keys
|
|
3619
|
+
* @returns Promise<boolean> - true if categories were created/updated, false if no changes
|
|
3612
3620
|
*/
|
|
3613
3621
|
async function ensureDefaultCategories() {
|
|
3614
|
-
const
|
|
3615
|
-
if (existingCategories.length > 0) {
|
|
3616
|
-
return false; // Categories already exist
|
|
3617
|
-
}
|
|
3622
|
+
const AgentCategory = mongoose.models.AgentCategory;
|
|
3618
3623
|
const defaultCategories = [
|
|
3619
3624
|
{
|
|
3620
3625
|
value: 'general',
|
|
3621
|
-
label: '
|
|
3622
|
-
description: '
|
|
3626
|
+
label: 'com_agents_category_general',
|
|
3627
|
+
description: 'com_agents_category_general_description',
|
|
3623
3628
|
order: 0,
|
|
3624
3629
|
},
|
|
3625
3630
|
{
|
|
3626
3631
|
value: 'hr',
|
|
3627
|
-
label: '
|
|
3628
|
-
description: '
|
|
3632
|
+
label: 'com_agents_category_hr',
|
|
3633
|
+
description: 'com_agents_category_hr_description',
|
|
3629
3634
|
order: 1,
|
|
3630
3635
|
},
|
|
3631
3636
|
{
|
|
3632
3637
|
value: 'rd',
|
|
3633
|
-
label: '
|
|
3634
|
-
description: '
|
|
3638
|
+
label: 'com_agents_category_rd',
|
|
3639
|
+
description: 'com_agents_category_rd_description',
|
|
3635
3640
|
order: 2,
|
|
3636
3641
|
},
|
|
3637
3642
|
{
|
|
3638
3643
|
value: 'finance',
|
|
3639
|
-
label: '
|
|
3640
|
-
description: '
|
|
3644
|
+
label: 'com_agents_category_finance',
|
|
3645
|
+
description: 'com_agents_category_finance_description',
|
|
3641
3646
|
order: 3,
|
|
3642
3647
|
},
|
|
3643
3648
|
{
|
|
3644
3649
|
value: 'it',
|
|
3645
|
-
label: '
|
|
3646
|
-
description: '
|
|
3650
|
+
label: 'com_agents_category_it',
|
|
3651
|
+
description: 'com_agents_category_it_description',
|
|
3647
3652
|
order: 4,
|
|
3648
3653
|
},
|
|
3649
3654
|
{
|
|
3650
3655
|
value: 'sales',
|
|
3651
|
-
label: '
|
|
3652
|
-
description: '
|
|
3656
|
+
label: 'com_agents_category_sales',
|
|
3657
|
+
description: 'com_agents_category_sales_description',
|
|
3653
3658
|
order: 5,
|
|
3654
3659
|
},
|
|
3655
3660
|
{
|
|
3656
3661
|
value: 'aftersales',
|
|
3657
|
-
label: '
|
|
3658
|
-
description: '
|
|
3662
|
+
label: 'com_agents_category_aftersales',
|
|
3663
|
+
description: 'com_agents_category_aftersales_description',
|
|
3659
3664
|
order: 6,
|
|
3660
3665
|
},
|
|
3661
3666
|
];
|
|
3662
|
-
await
|
|
3663
|
-
|
|
3667
|
+
const existingCategories = await getAllCategories();
|
|
3668
|
+
const existingCategoryMap = new Map(existingCategories.map((cat) => [cat.value, cat]));
|
|
3669
|
+
const updates = [];
|
|
3670
|
+
let created = 0;
|
|
3671
|
+
for (const defaultCategory of defaultCategories) {
|
|
3672
|
+
const existingCategory = existingCategoryMap.get(defaultCategory.value);
|
|
3673
|
+
if (existingCategory) {
|
|
3674
|
+
const isNotCustom = !existingCategory.custom;
|
|
3675
|
+
const needsLocalization = !existingCategory.label.startsWith('com_');
|
|
3676
|
+
if (isNotCustom && needsLocalization) {
|
|
3677
|
+
updates.push({
|
|
3678
|
+
value: defaultCategory.value,
|
|
3679
|
+
label: defaultCategory.label,
|
|
3680
|
+
description: defaultCategory.description,
|
|
3681
|
+
});
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
else {
|
|
3685
|
+
await createCategory({
|
|
3686
|
+
...defaultCategory,
|
|
3687
|
+
isActive: true,
|
|
3688
|
+
custom: false,
|
|
3689
|
+
});
|
|
3690
|
+
created++;
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
if (updates.length > 0) {
|
|
3694
|
+
const bulkOps = updates.map((update) => ({
|
|
3695
|
+
updateOne: {
|
|
3696
|
+
filter: { value: update.value, custom: { $ne: true } },
|
|
3697
|
+
update: {
|
|
3698
|
+
$set: {
|
|
3699
|
+
label: update.label,
|
|
3700
|
+
description: update.description,
|
|
3701
|
+
},
|
|
3702
|
+
},
|
|
3703
|
+
},
|
|
3704
|
+
}));
|
|
3705
|
+
await AgentCategory.bulkWrite(bulkOps, { ordered: false });
|
|
3706
|
+
}
|
|
3707
|
+
return updates.length > 0 || created > 0;
|
|
3664
3708
|
}
|
|
3665
3709
|
return {
|
|
3666
3710
|
getActiveCategories,
|