feat(channel-monitor): 补全前端 API 模式类型
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
917bd877ae
commit
b447ba6a0d
@ -8,11 +8,13 @@ import { apiClient } from '../client'
|
||||
export type Provider = 'openai' | 'anthropic' | 'gemini'
|
||||
export type MonitorStatus = 'operational' | 'degraded' | 'failed' | 'error'
|
||||
export type BodyOverrideMode = 'off' | 'merge' | 'replace'
|
||||
export type APIMode = 'chat_completions' | 'responses'
|
||||
|
||||
export interface ChannelMonitor {
|
||||
id: number
|
||||
name: string
|
||||
provider: Provider
|
||||
api_mode: APIMode
|
||||
endpoint: string
|
||||
api_key_masked: string
|
||||
/**
|
||||
@ -70,6 +72,7 @@ export interface ListResponse {
|
||||
export interface CreateParams {
|
||||
name: string
|
||||
provider: Provider
|
||||
api_mode?: APIMode
|
||||
endpoint: string
|
||||
api_key: string
|
||||
primary_model: string
|
||||
|
||||
@ -6,12 +6,13 @@
|
||||
*/
|
||||
|
||||
import { apiClient } from '../client'
|
||||
import type { BodyOverrideMode, Provider } from './channelMonitor'
|
||||
import type { APIMode, BodyOverrideMode, Provider } from './channelMonitor'
|
||||
|
||||
export interface ChannelMonitorTemplate {
|
||||
id: number
|
||||
name: string
|
||||
provider: Provider
|
||||
api_mode: APIMode
|
||||
description: string
|
||||
extra_headers: Record<string, string>
|
||||
body_override_mode: BodyOverrideMode
|
||||
@ -24,6 +25,7 @@ export interface ChannelMonitorTemplate {
|
||||
|
||||
export interface ListParams {
|
||||
provider?: Provider
|
||||
api_mode?: APIMode
|
||||
}
|
||||
|
||||
export interface ListResponse {
|
||||
@ -33,6 +35,7 @@ export interface ListResponse {
|
||||
export interface CreateParams {
|
||||
name: string
|
||||
provider: Provider
|
||||
api_mode?: APIMode
|
||||
description?: string
|
||||
extra_headers?: Record<string, string>
|
||||
body_override_mode?: BodyOverrideMode
|
||||
@ -41,6 +44,7 @@ export interface CreateParams {
|
||||
|
||||
export interface UpdateParams {
|
||||
name?: string
|
||||
api_mode?: APIMode
|
||||
description?: string
|
||||
extra_headers?: Record<string, string>
|
||||
body_override_mode?: BodyOverrideMode
|
||||
@ -55,6 +59,7 @@ export interface AssociatedMonitorBrief {
|
||||
id: number
|
||||
name: string
|
||||
provider: Provider
|
||||
api_mode: APIMode
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
|
||||
@ -7,18 +7,26 @@
|
||||
* `useChannelMonitorFormat`.
|
||||
*/
|
||||
|
||||
import type { Provider, MonitorStatus } from '@/api/admin/channelMonitor'
|
||||
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'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user