feat(channel-monitor): 增加监控协议选择界面

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
benjamin
2026-05-19 22:05:43 +08:00
co-authored by Sisyphus
parent b447ba6a0d
commit 89d4b0db54
3 changed files with 118 additions and 6 deletions
@@ -106,9 +106,15 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import type { BodyOverrideMode } from '@/api/admin/channelMonitor'
import type { APIMode, BodyOverrideMode, Provider } from '@/api/admin/channelMonitor'
import {
API_MODE_RESPONSES,
PROVIDER_OPENAI,
} from '@/constants/channelMonitor'
const props = defineProps<{
provider?: Provider
apiMode?: APIMode
extraHeaders: Record<string, string>
bodyOverrideMode: BodyOverrideMode
bodyOverride: Record<string, unknown> | null
@@ -293,6 +299,18 @@ const bodyModeHint = computed(() => {
})
const bodyPlaceholder = computed(() => {
if (props.provider === PROVIDER_OPENAI && props.apiMode === API_MODE_RESPONSES) {
if (props.bodyOverrideMode === 'merge') {
return '{\n "max_output_tokens": 20\n}'
}
return '{\n "model": "gpt-4o-mini",\n "instructions": "You are a health check endpoint. Reply briefly.",\n "input": "Reply with exactly: ok",\n "max_output_tokens": 20,\n "stream": false\n}'
}
if (props.provider === PROVIDER_OPENAI) {
if (props.bodyOverrideMode === 'merge') {
return '{\n "max_tokens": 20\n}'
}
return '{\n "model": "gpt-4o-mini",\n "messages": [{"role":"user","content":"Reply with exactly: ok"}],\n "max_tokens": 20,\n "stream": false\n}'
}
if (props.bodyOverrideMode === 'merge') {
return '{\n "system": "You are Claude Code..."\n}'
}