feat(admin): 예전/최신 어드민 통합 — 실데이터 복원 + 인증 아키텍처 정리
예전 배포본(HEAD)의 상세 기능을 새 아키텍처(인증=.NET 백엔드, 데이터=Supabase) 위에 실데이터로 복원. 예전 HEAD는 서명 쿠키를 거부하고 위조 쿠키는 통과시키는 인증 결함이 있었고, 삭제된 페이지 다수는 백엔드 호출 0인 하드코딩 목업이었음. 인증/세션 - 로그인 이메일 전용화(username 폐지), 에러 키별 안내 메시지 - ADMIN_COOKIE_SECURE 옵션: TLS 없는 LAN HTTP 배포에서 Secure 쿠키 유실로 로그인이 유지되지 않던 문제 해결 (login/logout route, admin-session, compose, .env.example) - Supabase 미설정 시 우아한 저하: isSupabaseAdminConfigured + UnavailableAdminPanel 기능 복원 (실데이터) - Release Hub: Forgejo API 실데이터(다운로드 수/SHA-256 체크섬/릴리스 이력) - Ad Monetization: 데스크톱 미디에이션 10개 어댑터 로스터(fail-closed) + ad_reward_claims 통계 - License Issuer: 서버사이드 Ed25519 서명(/api/admin/license, super_admin 전용), 개인키는 ADMIN_LICENSE_PRIVATE_KEY env로만, 발급 감사를 .NET AdminAuditEntries에 기록 - Service Models: STT 7종/LLM 5종 프리셋 드롭다운 + 자동채움 - 대시보드 ARR/MRR KPI: Supabase 구독 실집계(티어 월단가 기반) - 사용자 상세 티어별 기능 배지(pro_plus 조건부) .NET - SuperAdminOnly 정책 추가, /api/admin/license-audit 엔드포인트, LicenseAuditDto
This commit is contained in:
parent
a9c9a1ca6e
commit
5a34f66981
66 changed files with 4471 additions and 3501 deletions
|
|
@ -24,18 +24,22 @@ import {
|
|||
} from '@mui/material'
|
||||
import { C, FONT_SANS, FONT_MONO, panelSx, tableSx, statusBadgeSx, primaryButtonSx } from '@/lib/console-theme'
|
||||
import { DoubleBezelCard, TactileBadge } from '@d3ro/ui/components/ds'
|
||||
import {
|
||||
fetchModelEndpoints,
|
||||
fetchSttEndpoints,
|
||||
createSttEndpoint,
|
||||
updateSttEndpoint,
|
||||
deleteSttEndpoint,
|
||||
setDefaultSttEndpoint,
|
||||
testSttEndpoint,
|
||||
type ModelEndpoint,
|
||||
type SttProviderEndpoint,
|
||||
type STTProviderCategory,
|
||||
import type {
|
||||
ModelEndpoint,
|
||||
SttProviderEndpoint,
|
||||
STTProviderCategory,
|
||||
} from '@/lib/api-server'
|
||||
import {
|
||||
createModelEndpointClient,
|
||||
createSttEndpointClient,
|
||||
deleteModelEndpointClient,
|
||||
deleteSttEndpointClient,
|
||||
fetchModelEndpointsClient,
|
||||
fetchSttEndpointsClient,
|
||||
setDefaultSttEndpointClient,
|
||||
testSttEndpointClient,
|
||||
updateSttEndpointClient,
|
||||
} from '@/lib/backend-admin-client'
|
||||
|
||||
const PRESET_LLM_MODELS = [
|
||||
{ modelId: 'whisper-large-v3-turbo', modelName: 'Faster-Whisper Large-v3 Turbo (Local)', provider: 'Local Sidecar', endpointUrl: 'http://localhost:8971/stt/transcribe', promptCost: '0.000000', completionCost: '0.000000' },
|
||||
|
|
@ -50,82 +54,19 @@ const PRESET_STT_PROVIDERS: Array<{
|
|||
providerType: STTProviderCategory
|
||||
endpointUrl: string
|
||||
modelId: string
|
||||
method: string
|
||||
method: 'multipart' | 'binary-stream' | 'json-base64' | 'custom-rest'
|
||||
costPerMinute: number
|
||||
language: string
|
||||
prompt?: string
|
||||
description: string
|
||||
}> = [
|
||||
{
|
||||
name: 'Groq Whisper LPU Turbo (Ultra Fast)',
|
||||
providerType: 'groq',
|
||||
endpointUrl: 'https://api.groq.com/openai/v1/audio/transcriptions',
|
||||
modelId: 'whisper-large-v3-turbo',
|
||||
method: 'multipart',
|
||||
costPerMinute: 0.0005,
|
||||
language: 'ko',
|
||||
description: 'LPU 가속 기반 초저지연(~140ms) 고속 전사, 극저비용',
|
||||
},
|
||||
{
|
||||
name: 'OpenAI Whisper Official',
|
||||
providerType: 'openai',
|
||||
endpointUrl: 'https://api.openai.com/v1/audio/transcriptions',
|
||||
modelId: 'whisper-1',
|
||||
method: 'multipart',
|
||||
costPerMinute: 0.006,
|
||||
language: 'ko',
|
||||
description: 'OpenAI 공식 Whisper-1 모델, 표준 고품질 다국어 인식',
|
||||
},
|
||||
{
|
||||
name: 'Deepgram Nova-3 Industry Standard',
|
||||
providerType: 'deepgram',
|
||||
endpointUrl: 'https://api.deepgram.com/v1/listen',
|
||||
modelId: 'nova-3',
|
||||
method: 'binary-stream',
|
||||
costPerMinute: 0.0043,
|
||||
language: 'ko',
|
||||
description: 'Nova-3 스마트 구두점, 실시간 스트리밍 최적화 및 고정밀 전사',
|
||||
},
|
||||
{
|
||||
name: 'Google Gemini 2.0 Flash / Cloud STT',
|
||||
providerType: 'google',
|
||||
endpointUrl: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent',
|
||||
modelId: 'gemini-2.0-flash',
|
||||
method: 'json-base64',
|
||||
costPerMinute: 0.001,
|
||||
language: 'ko',
|
||||
description: 'Gemini 2.0 Flash 기반 다국어 및 문맥 인식 오디오 전사',
|
||||
},
|
||||
{
|
||||
name: 'AssemblyAI Universal-2',
|
||||
providerType: 'assemblyai',
|
||||
endpointUrl: 'https://api.assemblyai.com/v2/transcript',
|
||||
modelId: 'best',
|
||||
method: 'multipart',
|
||||
costPerMinute: 0.0025,
|
||||
language: 'ko',
|
||||
description: '문맥 인식 음향 모델 및 자동 단락 구분 STT',
|
||||
},
|
||||
{
|
||||
name: 'Microsoft Azure Speech Service',
|
||||
providerType: 'azure',
|
||||
endpointUrl: 'https://koreacentral.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1',
|
||||
modelId: 'azure-speech',
|
||||
method: 'binary-stream',
|
||||
costPerMinute: 0.005,
|
||||
language: 'ko-KR',
|
||||
description: 'Azure Cognitive Speech API 엔터프라이즈 음성 인식',
|
||||
},
|
||||
{
|
||||
name: 'Self-Hosted / Local Faster-Whisper Sidecar',
|
||||
providerType: 'local-sidecar',
|
||||
endpointUrl: 'http://localhost:8971/stt/transcribe',
|
||||
modelId: 'whisper-large-v3-turbo',
|
||||
method: 'multipart',
|
||||
costPerMinute: 0.0,
|
||||
language: 'ko',
|
||||
description: '사내 프라이빗 서버 또는 로컬 Whisper 사이드카 (완전 무료/오프라인)',
|
||||
},
|
||||
{ name: 'Groq Whisper LPU Turbo (Ultra Fast)', providerType: 'groq', endpointUrl: 'https://api.groq.com/openai/v1/audio/transcriptions', modelId: 'whisper-large-v3-turbo', method: 'multipart', costPerMinute: 0.0005, language: 'ko', description: 'LPU 가속 기반 초저지연(~140ms) 고속 전사, 극저비용' },
|
||||
{ name: 'OpenAI Whisper Official', providerType: 'openai', endpointUrl: 'https://api.openai.com/v1/audio/transcriptions', modelId: 'whisper-1', method: 'multipart', costPerMinute: 0.006, language: 'ko', description: 'OpenAI 공식 Whisper-1 모델, 표준 고품질 다국어 인식' },
|
||||
{ name: 'Deepgram Nova-3 Industry Standard', providerType: 'deepgram', endpointUrl: 'https://api.deepgram.com/v1/listen', modelId: 'nova-3', method: 'binary-stream', costPerMinute: 0.0043, language: 'ko', description: 'Nova-3 스마트 구두점, 실시간 스트리밍 최적화 및 고정밀 전사' },
|
||||
{ name: 'Google Gemini 2.0 Flash / Cloud STT', providerType: 'google', endpointUrl: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent', modelId: 'gemini-2.0-flash', method: 'json-base64', costPerMinute: 0.001, language: 'ko', description: 'Gemini 2.0 Flash 기반 다국어 및 문맥 인식 오디오 전사' },
|
||||
{ name: 'AssemblyAI Universal-2', providerType: 'assemblyai', endpointUrl: 'https://api.assemblyai.com/v2/transcript', modelId: 'best', method: 'multipart', costPerMinute: 0.0025, language: 'ko', description: '문맥 인식 음향 모델 및 자동 단락 구분 STT' },
|
||||
{ name: 'Microsoft Azure Speech Service', providerType: 'azure', endpointUrl: 'https://koreacentral.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1', modelId: 'azure-speech', method: 'binary-stream', costPerMinute: 0.005, language: 'ko-KR', description: 'Azure Cognitive Speech API 엔터프라이즈 음성 인식' },
|
||||
{ name: 'Self-Hosted / Local Faster-Whisper Sidecar', providerType: 'local-sidecar', endpointUrl: 'http://localhost:8971/stt/transcribe', modelId: 'whisper-large-v3-turbo', method: 'multipart', costPerMinute: 0.0, language: 'ko', description: '사내 프라이빗 서버 또는 로컬 Whisper 사이드카 (완전 무료/오프라인)' },
|
||||
]
|
||||
|
||||
export default function ServiceModelsPage(): React.ReactElement {
|
||||
|
|
@ -142,39 +83,42 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
|
||||
// STT Form State
|
||||
const [sttName, setSttName] = useState('')
|
||||
const [sttProviderType, setSttProviderType] = useState<STTProviderCategory>('groq')
|
||||
const [sttProviderType, setSttProviderType] = useState<STTProviderCategory>('custom')
|
||||
const [sttEndpointUrl, setSttEndpointUrl] = useState('')
|
||||
const [sttApiKey, setSttApiKey] = useState('')
|
||||
const [sttModelId, setSttModelId] = useState('whisper-large-v3-turbo')
|
||||
const [sttModelId, setSttModelId] = useState('')
|
||||
const [sttMethod, setSttMethod] = useState<'multipart' | 'binary-stream' | 'json-base64' | 'custom-rest'>('multipart')
|
||||
const [sttLanguage, setSttLanguage] = useState('ko')
|
||||
const [sttPrompt, setSttPrompt] = useState('')
|
||||
const [sttCostPerMinute, setSttCostPerMinute] = useState('0.000500')
|
||||
const [sttCostPerMinute, setSttCostPerMinute] = useState('0')
|
||||
const [sttFallbackPriority, setSttFallbackPriority] = useState(1)
|
||||
const [sttIsDefault, setSttIsDefault] = useState(false)
|
||||
const [sttMemo, setSttMemo] = useState('')
|
||||
|
||||
// LLM Endpoints State
|
||||
const [llmEndpoints, setLlmEndpoints] = useState<ModelEndpoint[]>([])
|
||||
const [llmModalOpen, setLlmModalOpen] = useState(false)
|
||||
const [llmLoading, setLlmLoading] = useState(false)
|
||||
const [llmPingStatus, setLlmPingStatus] = useState<Record<string, string>>({})
|
||||
const [dataError, setDataError] = useState<string | null>(null)
|
||||
|
||||
// LLM Form State
|
||||
const [llmModelId, setLlmModelId] = useState('')
|
||||
const [llmModelName, setLlmModelName] = useState('')
|
||||
const [llmProvider, setLlmProvider] = useState<string>('OpenAI')
|
||||
const [llmProvider, setLlmProvider] = useState<string>('Custom')
|
||||
const [llmEndpointUrl, setLlmEndpointUrl] = useState('')
|
||||
const [llmApiKey, setLlmApiKey] = useState('')
|
||||
const [llmPromptCost, setLlmPromptCost] = useState('0.000150')
|
||||
const [llmCompletionCost, setLlmCompletionCost] = useState('0.000600')
|
||||
const [llmPromptCost, setLlmPromptCost] = useState('0')
|
||||
const [llmCompletionCost, setLlmCompletionCost] = useState('0')
|
||||
const [llmMemo, setLlmMemo] = useState('')
|
||||
|
||||
const loadData = async () => {
|
||||
setDataError(null)
|
||||
try {
|
||||
const [sttData, llmData] = await Promise.all([fetchSttEndpoints(), fetchModelEndpoints()])
|
||||
const [sttData, llmData] = await Promise.all([fetchSttEndpointsClient(), fetchModelEndpointsClient()])
|
||||
setSttEndpoints(sttData)
|
||||
setLlmEndpoints(llmData)
|
||||
} catch {
|
||||
// Fallbacks handled in fetch functions
|
||||
} catch (error) {
|
||||
setDataError(error instanceof Error ? error.message : '관리자 백엔드에서 엔드포인트를 불러오지 못했습니다.')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -184,34 +128,21 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
|
||||
// ── STT Handlers ──────────────────────────────────────────────────────────
|
||||
|
||||
const applySttPreset = (presetName: string) => {
|
||||
const p = PRESET_STT_PROVIDERS.find((x) => x.name === presetName)
|
||||
if (!p) return
|
||||
setSttName(p.name)
|
||||
setSttProviderType(p.providerType)
|
||||
setSttEndpointUrl(p.endpointUrl)
|
||||
setSttModelId(p.modelId)
|
||||
setSttMethod(p.method as SttProviderEndpoint['method'])
|
||||
setSttCostPerMinute(p.costPerMinute.toFixed(6))
|
||||
setSttLanguage(p.language)
|
||||
if (p.prompt) setSttPrompt(p.prompt)
|
||||
setSttTestModalResult(null)
|
||||
}
|
||||
|
||||
const openAddSttModal = () => {
|
||||
setSttEditingId(null)
|
||||
setSttName('')
|
||||
setSttProviderType('groq')
|
||||
setSttEndpointUrl('https://api.groq.com/openai/v1/audio/transcriptions')
|
||||
setSttProviderType('custom')
|
||||
setSttEndpointUrl('')
|
||||
setSttApiKey('')
|
||||
setSttModelId('whisper-large-v3-turbo')
|
||||
setSttModelId('')
|
||||
setSttMethod('multipart')
|
||||
setSttLanguage('ko')
|
||||
setSttPrompt('')
|
||||
setSttCostPerMinute('0.000500')
|
||||
setSttCostPerMinute('0')
|
||||
setSttFallbackPriority(sttEndpoints.length + 1)
|
||||
setSttIsDefault(sttEndpoints.length === 0)
|
||||
setSttTestModalResult(null)
|
||||
setSttMemo('')
|
||||
setSttModalOpen(true)
|
||||
}
|
||||
|
||||
|
|
@ -252,12 +183,13 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
isDefault: sttIsDefault,
|
||||
isActive: true,
|
||||
fallbackPriority: sttFallbackPriority,
|
||||
memo: sttMemo.trim(),
|
||||
}
|
||||
|
||||
if (sttEditingId) {
|
||||
await updateSttEndpoint(sttEditingId, payload)
|
||||
await updateSttEndpointClient(sttEditingId, payload)
|
||||
} else {
|
||||
await createSttEndpoint(payload)
|
||||
await createSttEndpointClient(payload)
|
||||
}
|
||||
|
||||
await loadData()
|
||||
|
|
@ -270,8 +202,10 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
}
|
||||
|
||||
const handleSetDefaultStt = async (id: number) => {
|
||||
const memo = prompt('기본 STT 공급자 변경 사유를 입력하세요.')?.trim() ?? ''
|
||||
if (memo.length < 3) return
|
||||
try {
|
||||
await setDefaultSttEndpoint(id)
|
||||
await setDefaultSttEndpointClient(id, memo)
|
||||
setSttEndpoints((prev) =>
|
||||
prev.map((ep) => ({
|
||||
...ep,
|
||||
|
|
@ -285,11 +219,17 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
|
||||
const handlePingStt = async (id: number) => {
|
||||
setSttPingStatus((prev) => ({ ...prev, [id]: 'Testing...' }))
|
||||
const result = await testSttEndpoint(id)
|
||||
if (result.success) {
|
||||
setSttPingStatus((prev) => ({ ...prev, [id]: `⚡ OK • ${result.latencyMs}ms` }))
|
||||
} else {
|
||||
setSttPingStatus((prev) => ({ ...prev, [id]: `❌ Failed` }))
|
||||
try {
|
||||
const result = await testSttEndpointClient(id)
|
||||
setSttPingStatus((prev) => ({
|
||||
...prev,
|
||||
[id]: result.success ? `⚡ OK • ${result.latencyMs}ms` : `❌ ${result.message}`
|
||||
}))
|
||||
} catch (error) {
|
||||
setSttPingStatus((prev) => ({
|
||||
...prev,
|
||||
[id]: `❌ ${error instanceof Error ? error.message : 'Test failed'}`
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +237,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
setTestingInModal(true)
|
||||
setSttTestModalResult(null)
|
||||
try {
|
||||
const result = await testSttEndpoint(sttEditingId ?? 0, sttApiKey, sttEndpointUrl)
|
||||
const result = await testSttEndpointClient(sttEditingId ?? 0, sttApiKey, sttEndpointUrl)
|
||||
setSttTestModalResult({
|
||||
success: result.success,
|
||||
message: result.message,
|
||||
|
|
@ -316,8 +256,10 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
|
||||
const handleDeleteStt = async (id: number) => {
|
||||
if (!confirm('이 STT 프로바이더 엔드포인트를 삭제하시겠습니까?')) return
|
||||
const memo = prompt('삭제 사유를 입력하세요.')?.trim() ?? ''
|
||||
if (memo.length < 3) return
|
||||
try {
|
||||
await deleteSttEndpoint(id)
|
||||
await deleteSttEndpointClient(id, memo)
|
||||
setSttEndpoints((prev) => prev.filter((ep) => ep.id !== id))
|
||||
} catch (err) {
|
||||
alert('Error: ' + (err instanceof Error ? err.message : String(err)))
|
||||
|
|
@ -326,15 +268,16 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
|
||||
// ── LLM Handlers ──────────────────────────────────────────────────────────
|
||||
|
||||
const applyLlmPreset = (presetKey: string) => {
|
||||
const p = PRESET_LLM_MODELS.find((m) => m.modelId === presetKey)
|
||||
if (!p) return
|
||||
setLlmModelId(p.modelId)
|
||||
setLlmModelName(p.modelName)
|
||||
setLlmProvider(p.provider)
|
||||
setLlmEndpointUrl(p.endpointUrl)
|
||||
setLlmPromptCost(p.promptCost)
|
||||
setLlmCompletionCost(p.completionCost)
|
||||
const openAddLlmModal = () => {
|
||||
setLlmModelId('')
|
||||
setLlmModelName('')
|
||||
setLlmProvider('Custom')
|
||||
setLlmEndpointUrl('')
|
||||
setLlmApiKey('')
|
||||
setLlmPromptCost('0')
|
||||
setLlmCompletionCost('0')
|
||||
setLlmMemo('')
|
||||
setLlmModalOpen(true)
|
||||
}
|
||||
|
||||
const handleAddLlmEndpoint = async (e: React.FormEvent) => {
|
||||
|
|
@ -342,26 +285,23 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
setLlmLoading(true)
|
||||
|
||||
try {
|
||||
const newEp: ModelEndpoint = {
|
||||
id: Date.now(),
|
||||
await createModelEndpointClient({
|
||||
modelId: llmModelId,
|
||||
modelName: llmModelName,
|
||||
provider: llmProvider as ModelEndpoint['provider'],
|
||||
provider: llmProvider,
|
||||
endpointUrl: llmEndpointUrl,
|
||||
apiKey: llmApiKey ? '••••••••' : '',
|
||||
apiKey: llmApiKey,
|
||||
costPer1kPromptTokens: parseFloat(llmPromptCost),
|
||||
costPer1kCompletionTokens: parseFloat(llmCompletionCost),
|
||||
latencyMs: 150,
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
createdAt: new Date().toISOString(),
|
||||
}
|
||||
setLlmEndpoints((prev) => [...prev, newEp])
|
||||
memo: llmMemo.trim(),
|
||||
})
|
||||
await loadData()
|
||||
setLlmModalOpen(false)
|
||||
setLlmModelId('')
|
||||
setLlmModelName('')
|
||||
setLlmEndpointUrl('')
|
||||
setLlmApiKey('')
|
||||
setLlmMemo('')
|
||||
} catch (err) {
|
||||
alert('Error: ' + (err instanceof Error ? err.message : String(err)))
|
||||
} finally {
|
||||
|
|
@ -369,12 +309,16 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
}
|
||||
}
|
||||
|
||||
const handlePingLlm = (_id: number, modelKey: string) => {
|
||||
setLlmPingStatus((prev) => ({ ...prev, [modelKey]: 'Testing...' }))
|
||||
setTimeout(() => {
|
||||
const lat = Math.floor(Math.random() * 80 + 40)
|
||||
setLlmPingStatus((prev) => ({ ...prev, [modelKey]: `OK • ${lat}ms` }))
|
||||
}, 500)
|
||||
const handleDeleteLlm = async (id: number) => {
|
||||
if (!confirm('이 LLM 엔드포인트를 삭제하시겠습니까?')) return
|
||||
const memo = prompt('삭제 사유를 입력하세요.')?.trim() ?? ''
|
||||
if (memo.length < 3) return
|
||||
try {
|
||||
await deleteModelEndpointClient(id, memo)
|
||||
setLlmEndpoints((current) => current.filter((endpoint) => endpoint.id !== id))
|
||||
} catch (error) {
|
||||
alert('Error: ' + (error instanceof Error ? error.message : String(error)))
|
||||
}
|
||||
}
|
||||
|
||||
const defaultStt = sttEndpoints.find((e) => e.isDefault) || sttEndpoints[0]
|
||||
|
|
@ -411,7 +355,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
sx={{
|
||||
fontFamily: FONT_SANS,
|
||||
fontSize: '20px',
|
||||
fontWeight: 700,
|
||||
fontWeight: 500,
|
||||
color: C.bright,
|
||||
letterSpacing: '-0.02em',
|
||||
m: 0,
|
||||
|
|
@ -432,7 +376,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
mt: 0.25,
|
||||
}}
|
||||
>
|
||||
DYNAMIC ROUTING • AUTO FAILOVER • TOKEN & PER-MINUTE BILLING • INSTANT DEFAULT SWITCH
|
||||
Dynamic routing, auto failover, token and per-minute billing, instant default switch
|
||||
</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
|
|
@ -443,13 +387,19 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
+ Add STT Provider Endpoint
|
||||
</Button>
|
||||
) : (
|
||||
<Button variant="contained" onClick={() => setLlmModalOpen(true)} sx={primaryButtonSx}>
|
||||
<Button variant="contained" onClick={openAddLlmModal} sx={primaryButtonSx}>
|
||||
+ Add LLM Model Endpoint
|
||||
</Button>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
{dataError && (
|
||||
<Alert severity="error" sx={{ mb: 3 }}>
|
||||
{dataError}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{/* Tabs Navigation */}
|
||||
<Box sx={{ borderBottom: `1px solid ${C.border}`, mb: 3 }}>
|
||||
<Tabs
|
||||
|
|
@ -469,7 +419,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
sx={{
|
||||
fontFamily: FONT_SANS,
|
||||
fontSize: '14px',
|
||||
fontWeight: 700,
|
||||
fontWeight: 500,
|
||||
color: activeTab === 'stt' ? C.bright : C.dim,
|
||||
textTransform: 'none',
|
||||
px: 3,
|
||||
|
|
@ -483,7 +433,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
sx={{
|
||||
fontFamily: FONT_SANS,
|
||||
fontSize: '14px',
|
||||
fontWeight: 700,
|
||||
fontWeight: 500,
|
||||
color: activeTab === 'llm' ? C.bright : C.dim,
|
||||
textTransform: 'none',
|
||||
px: 3,
|
||||
|
|
@ -519,7 +469,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
</Box>
|
||||
<Box>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
||||
<Typography sx={{ fontFamily: FONT_SANS, fontSize: '15px', fontWeight: 700, color: C.bright }}>
|
||||
<Typography sx={{ fontFamily: FONT_SANS, fontSize: '15px', fontWeight: 500, color: C.bright }}>
|
||||
Active Default Cloud STT: {defaultStt.name}
|
||||
</Typography>
|
||||
<Box component="span" sx={statusBadgeSx('green')}>
|
||||
|
|
@ -545,7 +495,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
<DoubleBezelCard bezelPadding="6px" innerPadding="24px">
|
||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2.5 }}>
|
||||
<Box>
|
||||
<Typography sx={{ fontFamily: FONT_SANS, fontSize: '16px', fontWeight: 700, color: C.bright }}>
|
||||
<Typography sx={{ fontFamily: FONT_SANS, fontSize: '16px', fontWeight: 500, color: C.bright }}>
|
||||
Configured Cloud Transcription Providers
|
||||
</Typography>
|
||||
<Typography sx={{ fontFamily: FONT_SANS, fontSize: '12px', color: C.dim }}>
|
||||
|
|
@ -581,7 +531,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
) : (
|
||||
sttEndpoints.map((ep) => (
|
||||
<Box component="tr" key={ep.id} sx={{ bgcolor: ep.isDefault ? 'rgba(59, 130, 246, 0.05)' : 'transparent' }}>
|
||||
<Box component="td" sx={{ fontFamily: FONT_MONO, fontSize: '12px', color: C.cyanLight, fontWeight: 700 }}>
|
||||
<Box component="td" sx={{ fontFamily: FONT_MONO, fontSize: '12px', color: C.cyanLight, fontWeight: 500 }}>
|
||||
#{ep.fallbackPriority}
|
||||
</Box>
|
||||
<Box component="td" sx={{ fontWeight: 600, color: C.bright }}>
|
||||
|
|
@ -606,7 +556,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
</Box>
|
||||
<Box component="td">
|
||||
{ep.isDefault ? (
|
||||
<Box component="span" sx={{ px: 1, py: 0.3, borderRadius: '4px', bgcolor: 'rgba(34, 197, 94, 0.2)', color: C.green400, fontSize: '10px', fontWeight: 700 }}>
|
||||
<Box component="span" sx={{ px: 1, py: 0.3, borderRadius: '4px', bgcolor: 'rgba(34, 197, 94, 0.2)', color: C.green400, fontSize: '10px', fontWeight: 500 }}>
|
||||
⭐ DEFAULT
|
||||
</Box>
|
||||
) : (
|
||||
|
|
@ -691,7 +641,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
{activeTab === 'llm' && (
|
||||
<DoubleBezelCard bezelPadding="6px" innerPadding="24px">
|
||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2.5 }}>
|
||||
<Typography sx={{ fontFamily: FONT_SANS, fontSize: '16px', fontWeight: 700, color: C.bright }}>
|
||||
<Typography sx={{ fontFamily: FONT_SANS, fontSize: '16px', fontWeight: 500, color: C.bright }}>
|
||||
Active AI Reasoning & Action Endpoints
|
||||
</Typography>
|
||||
<Typography sx={{ fontFamily: FONT_MONO, fontSize: '11px', color: C.dim }}>
|
||||
|
|
@ -757,8 +707,8 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
<Box sx={{ display: 'inline-flex', gap: 1 }}>
|
||||
<Button
|
||||
size="small"
|
||||
variant="outlined"
|
||||
onClick={() => handlePingLlm(ep.id, ep.modelId)}
|
||||
color="error"
|
||||
onClick={() => handleDeleteLlm(ep.id)}
|
||||
sx={{
|
||||
fontFamily: FONT_MONO,
|
||||
fontSize: '10px',
|
||||
|
|
@ -769,7 +719,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
'&:hover': { bgcolor: 'rgba(59, 130, 246, 0.15)', borderColor: C.accentLight },
|
||||
}}
|
||||
>
|
||||
{llmPingStatus[ep.modelId] || '⚡ Ping'}
|
||||
Delete
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
|
|
@ -798,35 +748,44 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
},
|
||||
}}
|
||||
>
|
||||
<DialogTitle sx={{ fontFamily: FONT_SANS, fontWeight: 700, color: C.bright, borderBottom: `1px solid ${C.border}`, px: 3, py: 2.5 }}>
|
||||
<DialogTitle sx={{ fontFamily: FONT_SANS, fontWeight: 500, color: C.bright, borderBottom: `1px solid ${C.border}`, px: 3, py: 2.5 }}>
|
||||
{sttEditingId ? 'Edit STT Provider Endpoint' : 'Add Cloud STT Provider Endpoint'}
|
||||
</DialogTitle>
|
||||
<Box component="form" onSubmit={handleSaveSttEndpoint}>
|
||||
<DialogContent sx={{ px: 3, py: 3, display: 'flex', flexDirection: 'column', gap: 2.5 }}>
|
||||
{/* Quick Preset Selector */}
|
||||
<FormControl fullWidth size="small">
|
||||
<InputLabel sx={{ color: C.dim, fontFamily: FONT_SANS }}>Load Preset Template</InputLabel>
|
||||
<Select
|
||||
label="Load Preset Template"
|
||||
defaultValue=""
|
||||
onChange={(e) => applySttPreset(e.target.value)}
|
||||
sx={{
|
||||
bgcolor: 'rgba(10, 17, 31, 0.7)',
|
||||
color: C.bright,
|
||||
borderRadius: '10px',
|
||||
fontFamily: FONT_SANS,
|
||||
'& fieldset': { borderColor: C.border },
|
||||
'&:hover fieldset': { borderColor: C.borderHl },
|
||||
}}
|
||||
>
|
||||
{PRESET_STT_PROVIDERS.map((p) => (
|
||||
<MenuItem key={p.name} value={p.name} sx={{ fontFamily: FONT_SANS, fontSize: '13px' }}>
|
||||
{p.name} ({p.providerType.toUpperCase()}) — ${p.costPerMinute}/min
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
|
||||
{sttEditingId === null && (
|
||||
<FormControl fullWidth size="small">
|
||||
<InputLabel sx={{ color: C.dim }}>⚡ Load Preset Template (optional)</InputLabel>
|
||||
<Select
|
||||
value=""
|
||||
label="⚡ Load Preset Template (optional)"
|
||||
onChange={(e) => {
|
||||
const preset = PRESET_STT_PROVIDERS.find((p) => p.name === e.target.value)
|
||||
if (!preset) return
|
||||
setSttName(preset.name)
|
||||
setSttProviderType(preset.providerType)
|
||||
setSttEndpointUrl(preset.endpointUrl)
|
||||
setSttModelId(preset.modelId)
|
||||
setSttMethod(preset.method)
|
||||
setSttLanguage(preset.language)
|
||||
setSttCostPerMinute(String(preset.costPerMinute))
|
||||
if (preset.prompt) setSttPrompt(preset.prompt)
|
||||
}}
|
||||
sx={{
|
||||
bgcolor: 'rgba(10, 17, 31, 0.7)',
|
||||
color: C.bright,
|
||||
borderRadius: '10px',
|
||||
'& fieldset': { borderColor: C.border },
|
||||
}}
|
||||
>
|
||||
{PRESET_STT_PROVIDERS.map((preset) => (
|
||||
<MenuItem key={preset.name} value={preset.name}>
|
||||
{preset.name}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
)}
|
||||
<Box sx={{ display: 'grid', gridTemplateColumns: { xs: '1fr', md: '1.2fr 0.8fr' }, gap: 2 }}>
|
||||
<TextField
|
||||
label="Provider Name"
|
||||
|
|
@ -984,6 +943,16 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
/>
|
||||
</Box>
|
||||
|
||||
<TextField
|
||||
label="Audit memo"
|
||||
value={sttMemo}
|
||||
onChange={(event) => setSttMemo(event.target.value)}
|
||||
required
|
||||
helperText="변경 사유를 3자 이상 입력하세요."
|
||||
size="small"
|
||||
sx={{ '& .MuiOutlinedInput-root': { bgcolor: 'rgba(10, 17, 31, 0.7)', color: C.bright, borderRadius: '10px' } }}
|
||||
/>
|
||||
|
||||
{/* Test Connection Inside Modal */}
|
||||
<Box sx={{ p: 2, borderRadius: '12px', bgcolor: 'rgba(10, 17, 31, 0.6)', border: `1px solid ${C.border}`, display: 'flex', flexDirection: 'column', gap: 1.5 }}>
|
||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
|
|
@ -1029,7 +998,7 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
<Button onClick={() => setSttModalOpen(false)} sx={{ color: C.dim, textTransform: 'none' }}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button type="submit" variant="contained" disabled={sttLoading} sx={primaryButtonSx}>
|
||||
<Button type="submit" variant="contained" disabled={sttLoading || sttMemo.trim().length < 3} sx={primaryButtonSx}>
|
||||
{sttLoading ? 'Saving...' : 'Save STT Provider'}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
|
@ -1052,33 +1021,40 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
},
|
||||
}}
|
||||
>
|
||||
<DialogTitle sx={{ fontFamily: FONT_SANS, fontWeight: 700, color: C.bright, borderBottom: `1px solid ${C.border}`, px: 3, py: 2.5 }}>
|
||||
<DialogTitle sx={{ fontFamily: FONT_SANS, fontWeight: 500, color: C.bright, borderBottom: `1px solid ${C.border}`, px: 3, py: 2.5 }}>
|
||||
Add Reasoning Model Endpoint
|
||||
</DialogTitle>
|
||||
<Box component="form" onSubmit={handleAddLlmEndpoint}>
|
||||
<DialogContent sx={{ px: 3, py: 3, display: 'flex', flexDirection: 'column', gap: 2.5 }}>
|
||||
<FormControl fullWidth size="small">
|
||||
<InputLabel sx={{ color: C.dim, fontFamily: FONT_SANS }}>Load Preset Template</InputLabel>
|
||||
<InputLabel sx={{ color: C.dim }}>⚡ Load Preset Template (optional)</InputLabel>
|
||||
<Select
|
||||
label="Load Preset Template"
|
||||
defaultValue=""
|
||||
onChange={(e) => applyLlmPreset(e.target.value)}
|
||||
value=""
|
||||
label="⚡ Load Preset Template (optional)"
|
||||
onChange={(e) => {
|
||||
const preset = PRESET_LLM_MODELS.find((p) => p.modelId === e.target.value)
|
||||
if (!preset) return
|
||||
setLlmModelId(preset.modelId)
|
||||
setLlmModelName(preset.modelName)
|
||||
setLlmProvider(preset.provider)
|
||||
setLlmEndpointUrl(preset.endpointUrl)
|
||||
setLlmPromptCost(preset.promptCost)
|
||||
setLlmCompletionCost(preset.completionCost)
|
||||
}}
|
||||
sx={{
|
||||
bgcolor: 'rgba(10, 17, 31, 0.7)',
|
||||
color: C.bright,
|
||||
borderRadius: '10px',
|
||||
fontFamily: FONT_SANS,
|
||||
'& fieldset': { borderColor: C.border },
|
||||
}}
|
||||
>
|
||||
{PRESET_LLM_MODELS.map((p) => (
|
||||
<MenuItem key={p.modelId} value={p.modelId} sx={{ fontFamily: FONT_SANS, fontSize: '13px' }}>
|
||||
{p.modelName} ({p.provider})
|
||||
{PRESET_LLM_MODELS.map((preset) => (
|
||||
<MenuItem key={preset.modelId} value={preset.modelId}>
|
||||
{preset.modelName}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
|
||||
<TextField
|
||||
label="Model ID"
|
||||
value={llmModelId}
|
||||
|
|
@ -1152,12 +1128,21 @@ export default function ServiceModelsPage(): React.ReactElement {
|
|||
sx={{ '& .MuiOutlinedInput-root': { bgcolor: 'rgba(10, 17, 31, 0.7)', color: C.bright, borderRadius: '10px', fontFamily: FONT_MONO } }}
|
||||
/>
|
||||
</Box>
|
||||
<TextField
|
||||
label="Audit memo"
|
||||
value={llmMemo}
|
||||
onChange={(event) => setLlmMemo(event.target.value)}
|
||||
required
|
||||
helperText="생성 사유를 3자 이상 입력하세요."
|
||||
size="small"
|
||||
sx={{ '& .MuiOutlinedInput-root': { bgcolor: 'rgba(10, 17, 31, 0.7)', color: C.bright, borderRadius: '10px' } }}
|
||||
/>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{ px: 3, pb: 3, pt: 1, borderTop: `1px solid ${C.border}` }}>
|
||||
<Button onClick={() => setLlmModalOpen(false)} sx={{ color: C.dim, textTransform: 'none' }}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button type="submit" variant="contained" disabled={llmLoading} sx={primaryButtonSx}>
|
||||
<Button type="submit" variant="contained" disabled={llmLoading || llmMemo.trim().length < 3} sx={primaryButtonSx}>
|
||||
{llmLoading ? 'Saving...' : 'Save Endpoint'}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue