Skip to content

Commit 48d4ae8

Browse files
committed
feat(codex): move provider preset to config panel
1 parent 4d3c619 commit 48d4ae8

4 files changed

Lines changed: 40 additions & 26 deletions

File tree

web-ui/logic.codex.mjs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const HOST_RULES = Object.freeze([
2020
{ match: (u) => /api\.moonshot\.cn|api\.kimi\.com/i.test(u), models: ['moonshot-v1-32k', 'moonshot-v1-128k', 'kimi-latest'] },
2121
{ match: (u) => /api\.minimax/i.test(u), models: ['MiniMax-M2', 'abab6.5s-chat', 'abab6.5-chat'] },
2222
{ match: (u) => /api-inference\.modelscope\.cn/i.test(u), models: ['Qwen/Qwen3-Coder-480B-A35B-Instruct', 'ZhipuAI/GLM-4.5'] },
23-
{ match: (u) => /xiaomimimo\.com/i.test(u), models: ['mimo-v2-pro', 'mimo-v2'] }
23+
{ match: (u) => /xiaomimimo\.com/i.test(u), models: ['mimo-v2-pro', 'mimo-v2'] },
24+
{ match: (u) => /ai\.muapi\.cn/i.test(u), models: ['mimo-v2-pro'] }
2425
]);
2526

2627
function normalizeUrl(url) {
@@ -41,14 +42,15 @@ export function getCodexModelCatalogForProvider(provider) {
4142
return [];
4243
}
4344

44-
// 服务模板表:供新增 provider modal 的一行模板按钮使用。
45-
// model 字段为可选首选项(添加后由前端触发 set-provider 落到 currentModels[name])。
45+
// 服务模板表:供面板上的预设按钮使用。
46+
// model 字段为可选首选项(添加后由前端写入内存字典 currentModels[name])。
47+
// useTransform=true 表示该服务需通过内建 OpenAI bridge 转发。
4648
export const CODEX_PROVIDER_TEMPLATES = Object.freeze([
47-
{ label: 'OpenAI', name: 'openai', url: 'https://api.openai.com/v1', model: 'gpt-5-codex' },
48-
{ label: 'DeepSeek', name: 'deepseek', url: 'https://api.deepseek.com/v1', model: 'deepseek-chat' },
49-
{ label: 'Qwen Coder', name: 'qwen', url: 'https://dashscope.aliyuncs.com/compatible-mode/v1', model: 'qwen3-coder-plus' },
50-
{ label: 'Doubao', name: 'doubao', url: 'https://ark.cn-beijing.volces.com/api/v3', model: 'doubao-seed-1-6-thinking' },
51-
{ label: 'Zhipu GLM', name: 'glm', url: 'https://open.bigmodel.cn/api/paas/v4', model: 'glm-4.6' },
52-
{ label: 'Kimi', name: 'kimi', url: 'https://api.moonshot.cn/v1', model: 'moonshot-v1-32k' },
53-
{ label: 'ModelScope', name: 'modelscope', url: 'https://api-inference.modelscope.cn/v1', model: 'Qwen/Qwen3-Coder-480B-A35B-Instruct' }
49+
{
50+
label: 'MuAPI',
51+
name: 'muapi',
52+
url: 'https://ai.muapi.cn/v1',
53+
model: 'mimo-v2-pro',
54+
useTransform: true
55+
}
5456
]);

web-ui/modules/i18n.dict.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,6 @@ const DICT = Object.freeze({
386386

387387
// Basic modals
388388
'modal.providerAdd.title': '添加提供商',
389-
'modal.providerAdd.template': '快速模板',
390389
'modal.providerEdit.title': '编辑提供商',
391390
'modal.modelAdd.title': '添加模型',
392391
'modal.modelManage.title': '管理模型',
@@ -704,6 +703,8 @@ const DICT = Object.freeze({
704703

705704
// Config panel (Codex)
706705
'config.addProvider': '新增提供商',
706+
'config.providerTemplate.title': '预设服务',
707+
'config.providerTemplate.hint': '点击预设将打开新增提供商弹窗并预填字段,确认后可继续微调。',
707708
'config.models': '模型',
708709
'config.modelLoading': '加载中...',
709710
'config.models.unlimited': '当前无模型列表,可手填。',
@@ -1443,7 +1444,6 @@ const DICT = Object.freeze({
14431444

14441445
// Basic modals
14451446
'modal.providerAdd.title': 'Add provider',
1446-
'modal.providerAdd.template': 'Quick templates',
14471447
'modal.providerEdit.title': 'Edit provider',
14481448
'modal.modelAdd.title': 'Add model',
14491449
'modal.modelManage.title': 'Manage models',
@@ -1761,6 +1761,8 @@ const DICT = Object.freeze({
17611761

17621762
// Config panel (Codex)
17631763
'config.addProvider': 'Add provider',
1764+
'config.providerTemplate.title': 'Quick presets',
1765+
'config.providerTemplate.hint': 'Click a preset to open the add dialog with fields pre-filled; you can still tweak before submitting.',
17641766
'config.models': 'Model',
17651767
'config.modelLoading': 'Loading...',
17661768
'config.models.unlimited': 'No model list available. Enter manually.',

web-ui/partials/index/modals-basic.html

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,6 @@
33
<div class="modal" role="dialog" aria-modal="true" aria-labelledby="add-provider-modal-title">
44
<div class="modal-title" id="add-provider-modal-title">{{ t('modal.providerAdd.title') }}</div>
55

6-
<div class="form-group">
7-
<label class="form-label">{{ t('modal.providerAdd.template') }}</label>
8-
<div class="btn-group" style="flex-wrap: wrap; gap: 8px;">
9-
<button
10-
v-for="tpl in codexProviderTemplates"
11-
:key="tpl.name"
12-
type="button"
13-
class="btn-mini"
14-
@click="newProvider.name = tpl.name; newProvider.url = tpl.url; newProvider._suggestedModel = tpl.model || ''">
15-
{{ tpl.label }}
16-
</button>
17-
</div>
18-
</div>
19-
206
<div class="form-group">
217
<label class="form-label">{{ t('field.name') }}</label>
228
<input

web-ui/partials/index/panel-config-codex.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,30 @@
3838
{{ t('config.addProvider') }}
3939
</button>
4040

41+
<!-- 服务预设 -->
42+
<div class="selector-section" v-if="isCodexConfigMode && codexProviderTemplates.length">
43+
<div class="selector-header">
44+
<span class="selector-title">{{ t('config.providerTemplate.title') }}</span>
45+
</div>
46+
<div class="btn-group" style="flex-wrap: wrap; gap: 8px;">
47+
<button
48+
v-for="tpl in codexProviderTemplates"
49+
:key="tpl.name"
50+
type="button"
51+
class="btn-mini"
52+
@click="newProvider.name = tpl.name;
53+
newProvider.url = tpl.url;
54+
newProvider._suggestedModel = tpl.model || '';
55+
newProvider.useTransform = !!tpl.useTransform;
56+
showAddModal = true">
57+
{{ tpl.label }}
58+
</button>
59+
</div>
60+
<div class="config-template-hint">
61+
{{ t('config.providerTemplate.hint') }}
62+
</div>
63+
</div>
64+
4165
<!-- 模型选择器 -->
4266
<div class="selector-section">
4367
<div class="selector-header">

0 commit comments

Comments
 (0)