feat: новая функция

This commit is contained in:
2025-11-06 16:24:50 +03:00
parent b3620b264b
commit 714a3f55c7
34 changed files with 5436 additions and 2433 deletions

View File

@@ -482,6 +482,35 @@ router.put('/ai-assistant-rules/:id', requireAdmin, async (req, res, next) => {
}
});
// ============================================
// AI CONFIG (централизованные настройки)
// ============================================
// Получить все настройки AI Config
router.get('/ai-config', requireAdmin, async (req, res, next) => {
try {
const aiConfigService = require('../services/aiConfigService');
const config = await aiConfigService.getConfig();
res.json({ success: true, config });
} catch (error) {
logger.error('Ошибка при получении AI Config:', error);
next(error);
}
});
// Обновить настройки AI Config
router.put('/ai-config', requireAdmin, async (req, res, next) => {
try {
const aiConfigService = require('../services/aiConfigService');
const userId = req.session.userId || null;
const updated = await aiConfigService.updateConfig(req.body, userId);
res.json({ success: true, config: updated });
} catch (error) {
logger.error('Ошибка при обновлении AI Config:', error);
next(error);
}
});
// Удалить набор правил
router.delete('/ai-assistant-rules/:id', requireAdmin, async (req, res, next) => {
try {