feat: separate api key and upstream concurrency
This commit is contained in:
1 parent
281849ceb8
commit
f5f855c751
13 files changed
+74
-8
No files matched your search
@@ -108,7 +108,7 @@ async function toggle(kind: 'channel' | 'model' | 'group', item: CatalogProvider
|
||||
<section class="page-heading"><h1>{{ props.section === 'channels' ? '渠道管理' : '模型与分组' }}</h1><div class="heading-actions"><button class="icon-button" title="刷新" :disabled="loading" @click="refresh"><RefreshCcw :size="18" /></button><button class="button primary" @click="props.section === 'channels' ? editChannel() : editModel()"><Plus :size="16" />{{ props.section === 'channels' ? '添加渠道' : '添加模型' }}</button></div></section>
|
||||
<label class="search-input catalog-search"><Search :size="16" /><input v-model="query" :placeholder="props.section === 'channels' ? '搜索渠道名称或 Code' : '搜索模型名称或标识'" /></label>
|
||||
<p v-if="error" role="alert">{{ error }}</p>
|
||||
<p v-if="props.section === 'models'" class="catalog-secondary">启用模型后会显示在用户端模型广场。模型厂商表示模型的实际研发方,渠道表示请求经过的中转站或官方接口;分组与所属渠道也启用后,用户才能为 API Key 选择该分组。并发上限按分组生效,填 1 才是串行,填 4 表示同一分组最多同时处理 4 个请求。</p>
|
||||
<p v-if="props.section === 'models'" class="catalog-secondary">启用模型后会显示在用户端模型广场。模型厂商表示模型的实际研发方,渠道表示请求经过的中转站或官方接口;分组与所属渠道也启用后,用户才能为 API Key 选择该分组。平台 API Key 并发和上游渠道/模型并发是两层独立限制:前者限制同一个 Key 的同时请求数,后者在下方按分组填写,填 1 才是串行,填 4 表示同一渠道分组最多同时处理 4 个请求。</p>
|
||||
<p v-if="loading">加载中…</p>
|
||||
<div v-if="props.section === 'channels'" class="responsive-table"><table><thead><tr><th>渠道</th><th>来源 / 协议</th><th>Base URL</th><th>凭据</th><th>状态</th><th>操作</th></tr></thead><tbody><tr v-for="item in pagedChannels" :key="item.id"><td><strong>{{ item.name }}</strong><small class="catalog-secondary">{{ item.code }}</small></td><td>{{ item.sourceType }}<small class="catalog-secondary">{{ item.protocol }}</small></td><td class="catalog-url">{{ item.baseUrl || '未配置' }}</td><td>{{ item.credentialMasked || '未配置' }}</td><td><label class="catalog-toggle"><input type="checkbox" :checked="item.status === 'active'" :disabled="saving" :aria-label="`${item.name} 启用`" @change="toggle('channel', item)" />{{ item.status === 'active' ? '已启用' : '已停用' }}</label></td><td><button class="icon-button" :title="`编辑渠道 ${item.name}`" @click="editChannel(item)"><Pencil :size="16" /></button><button class="icon-button" :title="`删除渠道 ${item.name}`" :disabled="saving" @click="confirmDelete('channel', item.id, item.name)"><Trash2 :size="16" /></button></td></tr><tr v-if="!shownChannels.length && !loading"><td colspan="6">暂无渠道</td></tr></tbody></table></div>
|
||||
<ListPagination v-if="props.section === 'channels'" v-model:page="channelPage" v-model:page-size="channelPageSize" :total="shownChannels.length" label="渠道分页" />
|
||||
@@ -153,7 +153,7 @@ async function toggle(kind: 'channel' | 'model' | 'group', item: CatalogProvider
|
||||
<label class="form-label">缓存命中输入价格(留空按普通输入价格)<input v-model="group.cachedInput" class="text-input" type="number" min="0" step="any" /></label>
|
||||
<label class="form-label" for="group-unit">价格单位</label><input id="group-unit" v-model="group.unit" class="text-input" required />
|
||||
<small>文本聊天自动扣费仅支持 CNY / 1M tokens(元/百万 Token)。输入、输出均需填写;填 0 表示免费,留空则禁止调用。请填写平台对用户的售价。</small>
|
||||
<div class="modal-form-grid"><label><span class="form-label">优先级</span><input v-model="group.priority" class="text-input" type="number" min="0" step="1" required /></label><label><span class="form-label">并发上限</span><input v-model="group.maxConcurrency" class="text-input" type="number" min="1" step="1" required /><small>1 为串行;建议按该渠道限额填写,4 表示最多同时处理 4 个请求。</small></label></div>
|
||||
<div class="modal-form-grid"><label><span class="form-label">优先级</span><input v-model="group.priority" class="text-input" type="number" min="0" step="1" required /></label><label><span class="form-label">上游分组并发上限</span><input v-model="group.maxConcurrency" class="text-input" type="number" min="1" step="1" required /><small>这是中转站允许多个用户共享该模型的并发数。1 为串行;按渠道实际额度填写。</small></label></div>
|
||||
</template>
|
||||
</form>
|
||||
<template #footer><button class="button secondary" :disabled="saving" @click="editor = ''">取消</button><button class="button primary" form="catalog-editor" type="submit" :disabled="saving">{{ saving ? '保存中…' : '保存' }}</button></template>
|
||||
|
||||
Reference in new issue
Block a user