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