mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
- Move AgentCategory from api/models to @packages/data-schemas structure
- Add schema, types, methods, and model following codebase conventions - Implement auto-seeding of default categories during AppService startup - Update marketplace controller to use new data-schemas methods - Remove old model file and standalone seed script
This commit is contained in:
parent
02f639f00e
commit
04008bf862
11 changed files with 126 additions and 242 deletions
|
|
@ -1,6 +1,6 @@
|
|||
const AgentCategory = require('~/models/AgentCategory');
|
||||
const mongoose = require('mongoose');
|
||||
const { logger } = require('~/config');
|
||||
const { findCategoryByValue, getCategoriesWithCounts } = require('~/models');
|
||||
|
||||
// Get the Agent model
|
||||
const Agent = mongoose.model('Agent');
|
||||
|
|
@ -100,7 +100,7 @@ const getAgentsByCategory = async (req, res) => {
|
|||
const result = await paginateAgents(filter, page, limit);
|
||||
|
||||
// Get category description from database
|
||||
const categoryDoc = await AgentCategory.findOne({ value: category, isActive: true });
|
||||
const categoryDoc = await findCategoryByValue(category);
|
||||
const categoryInfo = {
|
||||
name: category,
|
||||
description: categoryDoc?.description || '',
|
||||
|
|
@ -183,7 +183,7 @@ const searchAgents = async (req, res) => {
|
|||
const getAgentCategories = async (_req, res) => {
|
||||
try {
|
||||
// Get categories with agent counts from database
|
||||
const categories = await AgentCategory.getCategoriesWithCounts();
|
||||
const categories = await getCategoriesWithCounts();
|
||||
|
||||
// Get count of promoted agents for Top Picks
|
||||
const promotedCount = await Agent.countDocuments({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue