feat: extend enterprise gateway policies billing protocols and operations
This commit is contained in:
1 parent
1528b71882
commit
af43947b5d
67 files changed
+1822
-69
No files matched your search
@@ -39,6 +39,9 @@ import SlidePanel from '../components/SlidePanel.vue'
|
||||
import UiModal from '../components/UiModal.vue'
|
||||
import CatalogAdmin from '../components/CatalogAdmin.vue'
|
||||
import AccountAdmin from '../components/AccountAdmin.vue'
|
||||
import EnterprisePolicies from '../components/EnterprisePolicies.vue'
|
||||
import EnterpriseFinance from '../components/EnterpriseFinance.vue'
|
||||
import EnterpriseOperations from '../components/EnterpriseOperations.vue'
|
||||
import { providerCapabilityLabel, summarizeModelCatalog } from '../services/model-catalog'
|
||||
import { usePagination } from '../composables/usePagination'
|
||||
import ListPagination from '../components/ListPagination.vue'
|
||||
@@ -282,7 +285,10 @@ function mapModels(items: CatalogModel[], providersList: CatalogProvider[]): Mod
|
||||
|
||||
<template>
|
||||
<div class="page-stack admin-pages">
|
||||
<template v-if="view === 'admin-overview'">
|
||||
<EnterprisePolicies v-if="view === 'admin-policies'" admin />
|
||||
<EnterpriseFinance v-else-if="view === 'admin-finance'" />
|
||||
<EnterpriseOperations v-else-if="view === 'admin-operations'" />
|
||||
<template v-else-if="view === 'admin-overview'">
|
||||
<section class="page-heading compact"><div><span>ADMIN OVERVIEW</span><h1>管理总览</h1><p>掌握平台供给、用户、容量和风险状态。</p></div><div class="heading-actions"><span class="health-badge"><i></i>目录数据已读取</span><button class="button secondary" :disabled="overviewRefreshing" @click="refreshOverviewData(true)"><Activity :size="16" />{{ overviewRefreshing ? '刷新中…' : '刷新数据' }}</button></div></section>
|
||||
<section class="metric-grid"><article class="metric-card"><span class="icon-tile violet"><Users :size="18" /></span><div><small>用户总数</small><strong>{{ users.length }}</strong><em>来自认证服务</em></div></article><article class="metric-card"><span class="icon-tile cyan"><Cloud :size="18" /></span><div><small>已完成接入配置的模型</small><strong>{{ publicModelCount }}</strong><em>模型广场显示 {{ publishedModelCount }} 个 · {{ publicRouteCount }} 个就绪分组 · 待定价 {{ unpricedRouteCount }} 个</em></div></article><article class="metric-card"><span class="icon-tile orange"><Gauge :size="18" /></span><div><small>等待 / 执行任务</small><strong>{{ adminSummary?.waiting ?? '—' }} / {{ adminSummary?.running ?? '—' }}</strong><em>Redis 租约与异步任务实时状态</em></div></article><article class="metric-card"><span class="icon-tile green"><CircleDollarSign :size="18" /></span><div><small>今日额度消耗</small><strong>{{ adminSummary ? `¥${Number(adminSummary.costToday || 0).toFixed(4)}` : '—' }}</strong><em>成功调用实际扣费</em></div></article></section>
|
||||
<section class="two-column equal"><article class="panel chart-panel"><header class="panel-header"><div><span>PLATFORM TRAFFIC</span><h3>平台请求趋势</h3></div><span class="select-button static">最近 7 天</span></header><div v-if="adminSummary" class="traffic-list"><div v-for="point in adminSummary.series" :key="point.date"><span>{{ point.date }}</span><strong>{{ point.count }} 次</strong></div></div><div v-else class="empty-state compact"><BarChart3 :size="22" /><strong>正在加载平台流量</strong><span>刷新后显示最近 7 天调用量</span></div></article><article class="panel health-panel"><header class="panel-header"><div><span>GATEWAY STATUS</span><h3>模型供给状态</h3></div><button class="text-link" @click="emit('navigate', 'admin-routing')">管理渠道<ArrowRight :size="14" /></button></header><div v-if="providers.length" class="health-list"><div v-for="provider in providers.slice(0, 3)" :key="provider.id"><span class="provider-mark">{{ provider.name.slice(0, 1) }}</span><p><strong>{{ provider.name }}</strong><small>{{ provider.capability }} · {{ provider.latency }}</small></p><b>{{ provider.successRate }}</b><span class="status-chip" :class="provider.status === '已启用' ? 'success' : 'warning'"><i></i>{{ provider.status }}</span></div></div><div v-else class="empty-state compact"><Cloud :size="22" /><strong>暂无供应商</strong><span>由管理员登记上游渠道后显示</span></div></article></section>
|
||||
|
||||
@@ -28,6 +28,8 @@ const mode = ref<AuthMode>('login')
|
||||
const registerChannel = ref<RegisterChannel>('email')
|
||||
const account = ref('')
|
||||
const password = ref('')
|
||||
const otp = ref('')
|
||||
const mfaRequired = ref(false)
|
||||
const confirmPassword = ref('')
|
||||
const invitationCode = ref('')
|
||||
const verificationCode = ref('')
|
||||
@@ -89,10 +91,11 @@ async function submitLogin() {
|
||||
if (!account.value.trim() || !password.value) return emit('notify', '请输入账号和密码')
|
||||
loading.value = true
|
||||
try {
|
||||
const user = await authClient.login({ account: account.value, password: password.value })
|
||||
const user = await authClient.login({ account: account.value, password: password.value, otp: otp.value || undefined })
|
||||
loading.value = false
|
||||
emit('success', user)
|
||||
} catch (error) {
|
||||
if (error instanceof AuthApiError && error.code === 'MFA_REQUIRED') mfaRequired.value = true
|
||||
loading.value = false
|
||||
emit('notify', error instanceof AuthApiError ? error.message : '登录失败,请稍后重试')
|
||||
}
|
||||
@@ -200,6 +203,7 @@ onMounted(async () => {
|
||||
<form v-if="mode === 'login'" class="auth-form" @submit.prevent="submitLogin">
|
||||
<label><span>账号</span><div class="auth-input"><Mail :size="17" /><input v-model="account" autocomplete="username" placeholder="请输入用户名、邮箱或手机号" /></div></label>
|
||||
<label><span>登录密码</span><div class="auth-input"><LockKeyhole :size="17" /><input v-model="password" :type="showPassword ? 'text' : 'password'" autocomplete="current-password" placeholder="请输入密码" /><button type="button" aria-label="显示或隐藏密码" @click="showPassword = !showPassword"><EyeOff v-if="showPassword" :size="17" /><Eye v-else :size="17" /></button></div></label>
|
||||
<label v-if="mfaRequired"><span>认证器验证码或一次性恢复码</span><div class="auth-input"><ShieldCheck :size="17" /><input v-model="otp" autocomplete="one-time-code" maxlength="24" placeholder="输入验证码或恢复码" /></div></label>
|
||||
<div class="auth-form-options login-help"><span>账号密码登录</span><button type="button" @click="switchMode('forgot')">忘记密码?</button></div>
|
||||
<button class="auth-submit" type="submit" :disabled="loading"><span v-if="loading" class="spinner"></span><template v-else>进入工作台<ArrowRight :size="17" /></template></button>
|
||||
</form>
|
||||
|
||||
@@ -42,6 +42,9 @@ import { buildModelCatalog } from '../services/model-catalog'
|
||||
import { groupDiscountLabel as formatGroupDiscountLabel, modelStandardPriceLabel, platformPriceLabel } from '../services/pricing'
|
||||
import { usePagination } from '../composables/usePagination'
|
||||
import ListPagination from '../components/ListPagination.vue'
|
||||
import EnterprisePolicies from '../components/EnterprisePolicies.vue'
|
||||
import NativeApiGuide from '../components/NativeApiGuide.vue'
|
||||
import { enterprise } from '../services/enterprise'
|
||||
import { copyText, type CopyResult } from '../services/clipboard'
|
||||
import SlidePanel from '../components/SlidePanel.vue'
|
||||
import UiModal from '../components/UiModal.vue'
|
||||
@@ -152,6 +155,7 @@ const activeMediaKind = computed<AsyncMediaType | undefined>(() => {
|
||||
return undefined
|
||||
})
|
||||
const activeInputTypes = computed(() => activeModel.value.inputTypes || [])
|
||||
const activeEmbedding = computed(() => catalogRoutes.value.find(m => m.id === activeModel.value.id)?.type === 'embedding')
|
||||
const activeOutputTypes = computed(() => activeModel.value.outputTypes || [])
|
||||
const activeAsyncSupported = computed(() => activeModel.value.mode !== '异步' || (!!activeMediaKind.value && activeModel.value.executionReady !== false))
|
||||
const supportsMediaInput = computed(() => activeInputTypes.value.some(input => /image|audio|video|url|media/i.test(input)))
|
||||
@@ -427,7 +431,10 @@ async function runModel() {
|
||||
finishReason.value = ''
|
||||
const selectedMode = callMode.value
|
||||
try {
|
||||
if (callMode.value === '异步') {
|
||||
if (activeEmbedding.value) {
|
||||
const result = await enterprise(`/api/playground/keys/${encodeURIComponent(apiKey)}/embeddings`, { model: gatewayModelId(activeModel.value), input: prompt.value }, 'POST')
|
||||
response.value = JSON.stringify(result, null, 2)
|
||||
} else if (callMode.value === '异步') {
|
||||
const task = await catalogClient.playgroundCreateMediaTask(apiKey, { model: gatewayModelId(activeModel.value), prompt: prompt.value, mediaUrl: mediaUrl.value.trim() || undefined, mediaType: activeMediaKind.value! })
|
||||
const taskItem = mapAsyncTask(task, activeModel.value, prompt.value)
|
||||
tasks.value.unshift(taskItem)
|
||||
@@ -768,7 +775,9 @@ async function createProject() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-stack">
|
||||
<EnterprisePolicies v-if="view === 'key-policies'" />
|
||||
<NativeApiGuide v-if="view === 'docs'" />
|
||||
<div v-if="view !== 'key-policies'" class="page-stack">
|
||||
<template v-if="view === 'overview'">
|
||||
<section class="page-heading compact"><div><span>WORKSPACE OVERVIEW</span><h1>你好,{{ displayName || 'MOYI 用户' }}</h1><p>从统一入口开始使用每一种模型能力。</p></div><div class="heading-actions"><span class="health-badge" :class="{ offline: !catalogConnected }"><i></i>{{ catalogConnected ? 'Control Plane 已连接' : 'Control Plane 未连接' }}</span><button class="button secondary" @click="emit('navigate', 'docs')"><BookOpen :size="16" />快速开始</button></div></section>
|
||||
|
||||
|
||||
Reference in new issue
Block a user