'use client' import { useState } from 'react' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/Card' import { Button } from '@/components/ui/Button' import { Input } from '@/components/ui/Input' import { Select } from '@/components/ui/Select' import { SuccessTag, ErrorTag, PendingTag } from '@/components/ui/Tag' import { Bot, Eye, Mic, Settings, CheckCircle, XCircle, Loader2, Info, Shield, AlertTriangle } from 'lucide-react' // AI 提供商选项 const providerOptions = [ { value: 'oneapi', label: 'OneAPI 中转服务' }, { value: 'anthropic', label: 'Anthropic Claude' }, { value: 'openai', label: 'OpenAI' }, { value: 'deepseek', label: 'DeepSeek' }, { value: 'custom', label: '自定义' }, ] // 模拟可用模型列表 const availableModels = { llm: [ { value: 'claude-opus-4-5-20251101', label: 'Claude Opus 4.5', tags: ['推荐', '高性能'] }, { value: 'claude-sonnet-4-20250514', label: 'Claude Sonnet 4', tags: ['性价比'] }, { value: 'gpt-4o', label: 'GPT-4o', tags: ['文字', '视觉'] }, { value: 'deepseek-chat', label: 'DeepSeek Chat', tags: ['高性价比'] }, ], vision: [ { value: 'claude-opus-4-5-20251101', label: 'Claude Opus 4.5', tags: ['推荐'] }, { value: 'gpt-4o', label: 'GPT-4o', tags: ['视觉'] }, { value: 'doubao-seed-1.6-thinking-vision', label: '豆包 Vision', tags: ['中文优化'] }, ], asr: [ { value: 'whisper-large-v3', label: 'Whisper Large V3', tags: ['推荐'] }, { value: 'whisper-medium', label: 'Whisper Medium', tags: ['快速'] }, { value: 'paraformer-zh', label: '达摩院 Paraformer', tags: ['中文优化'] }, ], } type TestResult = { llm: 'idle' | 'testing' | 'success' | 'failed' vision: 'idle' | 'testing' | 'success' | 'failed' asr: 'idle' | 'testing' | 'success' | 'failed' } export default function AIConfigPage() { const [provider, setProvider] = useState('oneapi') const [baseUrl, setBaseUrl] = useState('https://oneapi.intelligrow.cn') const [apiKey, setApiKey] = useState('') const [showApiKey, setShowApiKey] = useState(false) const [llmModel, setLlmModel] = useState('claude-opus-4-5-20251101') const [visionModel, setVisionModel] = useState('claude-opus-4-5-20251101') const [asrModel, setAsrModel] = useState('whisper-large-v3') const [temperature, setTemperature] = useState(0.7) const [maxTokens, setMaxTokens] = useState(2000) const [testResults, setTestResults] = useState({ llm: 'idle', vision: 'idle', asr: 'idle', }) const handleTestConnection = async () => { // 模拟测试连接 setTestResults({ llm: 'testing', vision: 'testing', asr: 'testing' }) // 模拟延迟 await new Promise(resolve => setTimeout(resolve, 1500)) setTestResults(prev => ({ ...prev, llm: 'success' })) await new Promise(resolve => setTimeout(resolve, 1000)) setTestResults(prev => ({ ...prev, vision: 'success' })) await new Promise(resolve => setTimeout(resolve, 800)) setTestResults(prev => ({ ...prev, asr: 'success' })) } const handleSave = () => { alert('配置已保存') } const getTestStatusIcon = (status: string) => { switch (status) { case 'testing': return case 'success': return case 'failed': return default: return null } } return (

AI 服务配置

配置 AI 服务提供商和模型参数

{/* 配置继承提示 */}

配置继承说明

品牌方配置后,所属代理商和达人将自动使用此配置。代理商和达人端不可见此配置项。

{/* AI 提供商 */} AI 提供商

支持 OneAPI、Anthropic Claude、OpenAI、DeepSeek 等提供商

{/* 模型配置 */} 模型配置 {/* 文字处理模型 */}
文字处理模型 (LLM) {getTestStatusIcon(testResults.llm)}

用于 Brief 解析、语义分析、报告生成

{/* 视频分析模型 */}
视频分析模型 (Vision) {getTestStatusIcon(testResults.vision)}

用于画面语义分析、场景/风险识别(Logo 检测由系统内置 CV 完成)

{/* 音频解析模型 */}
音频解析模型 (ASR) {getTestStatusIcon(testResults.asr)}

用于语音转文字、口播内容提取

{/* 连接配置 */} 连接配置
setBaseUrl(e.target.value)} placeholder="https://api.openai.com/v1" />
setApiKey(e.target.value)} placeholder="sk-..." />
{/* 生成参数 */} 生成参数
{temperature}
setTemperature(parseFloat(e.target.value))} className="w-full h-2 bg-bg-elevated rounded-lg appearance-none cursor-pointer accent-accent-indigo" />
精确 (0) 创意 (1)
setMaxTokens(parseInt(e.target.value))} min="100" max="8000" />
{/* 安全说明 */}

安全说明

  • • API Key 使用 AES-256-GCM 加密存储
  • • 所有 API 请求强制使用 HTTPS
  • • 仅品牌方管理员可查看/修改此配置
  • • 配置变更将记录到审计日志
{/* 操作按钮 */}
) }