/* Copyright (C) 2023-2026 QuantumNous This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { ChannelAffinitySection } from '../general/channel-affinity' import { IoNetDeploymentSettingsSection } from '../integrations/ionet-deployment-settings-section' import type { ModelSettings } from '../types' import { createSectionRegistry } from '../utils/section-registry' import { ClaudeSettingsCard } from './claude-settings-card' import { GeminiSettingsCard } from './gemini-settings-card' import { GlobalSettingsCard } from './global-settings-card' import { GrokSettingsCard } from './grok-settings-card' import { RoutingReliabilitySection } from './routing-reliability-section' function formatJsonForEditor(value: string, fallback: string) { const raw = (value ?? '').toString().trim() if (!raw) return fallback try { return JSON.stringify(JSON.parse(raw), null, 2) } catch { return fallback } } const MODELS_SECTIONS = [ { id: 'global', titleKey: 'Global Model Configuration', build: (settings: ModelSettings) => ( ), }, { id: 'routing-reliability', titleKey: 'Routing Reliability', build: (settings: ModelSettings) => ( ), }, { id: 'gemini', titleKey: 'Gemini', build: (settings: ModelSettings) => ( ), }, { id: 'claude', titleKey: 'Claude', build: (settings: ModelSettings) => ( ), }, { id: 'grok', titleKey: 'Grok', build: (settings: ModelSettings) => ( ), }, { id: 'channel-affinity', titleKey: 'Channel Affinity', build: (settings: ModelSettings) => ( ), }, { id: 'model-deployment', titleKey: 'Model Deployment', build: (settings: ModelSettings) => ( ), }, ] as const export type ModelSectionId = (typeof MODELS_SECTIONS)[number]['id'] const modelsRegistry = createSectionRegistry({ sections: MODELS_SECTIONS, defaultSection: 'global', basePath: '/system-settings/models', urlStyle: 'path', }) export const MODELS_SECTION_IDS = modelsRegistry.sectionIds export const MODELS_DEFAULT_SECTION = modelsRegistry.defaultSection export const getModelsSectionNavItems = modelsRegistry.getSectionNavItems export const getModelsSectionContent = modelsRegistry.getSectionContent export const getModelsSectionMeta = modelsRegistry.getSectionMeta