sub2api/frontend/src/constants/channelMonitor.ts
benjamin b447ba6a0d feat(channel-monitor): 补全前端 API 模式类型
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-19 22:05:43 +08:00

44 lines
1.3 KiB
TypeScript

/**
* Channel monitor shared constants.
*
* Single source of truth for provider/status string values used by both the
* admin (`views/admin/ChannelMonitorView.vue`) and user-facing
* (`views/user/ChannelStatusView.vue`) screens, plus the shared composable
* `useChannelMonitorFormat`.
*/
import type { APIMode, Provider, MonitorStatus } from '@/api/admin/channelMonitor'
export const PROVIDER_OPENAI: Provider = 'openai'
export const PROVIDER_ANTHROPIC: Provider = 'anthropic'
export const PROVIDER_GEMINI: Provider = 'gemini'
export const API_MODE_CHAT_COMPLETIONS: APIMode = 'chat_completions'
export const API_MODE_RESPONSES: APIMode = 'responses'
export const PROVIDERS: readonly Provider[] = [
PROVIDER_OPENAI,
PROVIDER_ANTHROPIC,
PROVIDER_GEMINI,
]
export const API_MODES: readonly APIMode[] = [
API_MODE_CHAT_COMPLETIONS,
API_MODE_RESPONSES,
]
export const STATUS_OPERATIONAL: MonitorStatus = 'operational'
export const STATUS_DEGRADED: MonitorStatus = 'degraded'
export const STATUS_FAILED: MonitorStatus = 'failed'
export const STATUS_ERROR: MonitorStatus = 'error'
export const MONITOR_STATUSES: readonly MonitorStatus[] = [
STATUS_OPERATIONAL,
STATUS_DEGRADED,
STATUS_FAILED,
STATUS_ERROR,
]
/** Default polling interval (seconds) for new monitors. */
export const DEFAULT_INTERVAL_SECONDS = 60