mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 16:04:01 +00:00
feat(models): add collision-safe aliases and model echoes (#125)
This commit is contained in:
1 parent
a0fbd6b6cb
commit
9b44a031ca
14 files changed
+443
-23
No files matched your search
@@ -1067,6 +1067,16 @@
|
||||
<label for="c-protocols" data-i18n="config.upstream.protocols">模型协议覆盖(JSON)</label>
|
||||
<textarea id="c-protocols" spellcheck="false">{}</textarea>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="c-model-aliases" data-i18n="config.upstream.aliases">模型公开别名(JSON:公开名 → 上游 ID)</label>
|
||||
<textarea id="c-model-aliases" spellcheck="false">{}</textarea>
|
||||
</div>
|
||||
<div class="field full">
|
||||
<label class="check">
|
||||
<input id="c-strip-free-suffix" type="checkbox" />
|
||||
<span data-i18n="config.upstream.stripFreeSuffix">自动去掉公开模型名的 -free 后缀(保留原始 ID 兼容)</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="field full">
|
||||
<label class="check">
|
||||
<input id="c-free-only" type="checkbox" />
|
||||
|
||||
@@ -347,6 +347,8 @@ const DICTIONARY = {
|
||||
"config.upstream.timeout": "Request timeout (seconds)",
|
||||
"config.upstream.refresh": "Model refresh interval (seconds)",
|
||||
"config.upstream.protocols": "Model protocol overrides (JSON)",
|
||||
"config.upstream.aliases": "Public model aliases (JSON: public name → upstream ID)",
|
||||
"config.upstream.stripFreeSuffix": "Strip -free from public model names (upstream IDs remain accepted)",
|
||||
"config.reasoning.title": "Thinking effort",
|
||||
"config.reasoning.caption":
|
||||
"Applied only when the client does not specify an effort; per-model overrides take priority. Choosing “Off” removes reasoning for requests that do not ask for it.",
|
||||
@@ -973,6 +975,8 @@ const DICTIONARY = {
|
||||
"config.upstream.timeout": "Timeout của request (giây)",
|
||||
"config.upstream.refresh": "Làm mới mô hình (giây)",
|
||||
"config.upstream.protocols": "Ghi đè giao thức mô hình (JSON)",
|
||||
"config.upstream.aliases": "Bí danh mô hình (JSON: tên công khai → ID upstream)",
|
||||
"config.upstream.stripFreeSuffix": "Bỏ hậu tố -free khỏi tên công khai (vẫn nhận ID upstream)",
|
||||
"config.reasoning.title": "Cường độ Thinking",
|
||||
"config.reasoning.caption":
|
||||
"Chỉ áp dụng khi client không chỉ định rõ; có thể ghi đè theo từng mô hình. Chọn “Tắt” sẽ bỏ reasoning cho các request không yêu cầu rõ.",
|
||||
@@ -1564,6 +1568,8 @@ const DICTIONARY = {
|
||||
"config.upstream.timeout": "Timeout richiesta (secondi)",
|
||||
"config.upstream.refresh": "Intervallo di refresh modelli (secondi)",
|
||||
"config.upstream.protocols": "Override protocollo modello (JSON)",
|
||||
"config.upstream.aliases": "Alias pubblici (JSON: nome pubblico → ID upstream)",
|
||||
"config.upstream.stripFreeSuffix": "Rimuovi -free dai nomi pubblici (gli ID upstream restano validi)",
|
||||
"config.reasoning.title": "Livello di ragionamento",
|
||||
"config.reasoning.caption":
|
||||
"Applicato solo quando il client non specifica un livello di ragionamento; gli override per modello hanno priorità. Scegliere “Disattivo” rimuove il ragionamento per le richieste che non lo richiedono.",
|
||||
|
||||
@@ -105,6 +105,8 @@ function fillConfig(value) {
|
||||
$("#c-timeout").value = value.retry.timeout_seconds;
|
||||
$("#c-refresh").value = value.models.refresh_seconds;
|
||||
$("#c-protocols").value = JSON.stringify(value.models.protocols || {}, null, 2);
|
||||
$("#c-model-aliases").value = JSON.stringify(value.models.aliases || {}, null, 2);
|
||||
$("#c-strip-free-suffix").checked = !!value.models.strip_free_suffix;
|
||||
$("#c-free-only").checked = !!value.models.free_only;
|
||||
$("#c-active-probes").checked = !!value.models.active_probes;
|
||||
const reasoning = value.reasoning || {};
|
||||
@@ -172,6 +174,8 @@ async function save(event) {
|
||||
...current.models,
|
||||
refresh_seconds: numberValue("#c-refresh"),
|
||||
protocols: JSON.parse($("#c-protocols").value || "{}"),
|
||||
aliases: JSON.parse($("#c-model-aliases").value || "{}"),
|
||||
strip_free_suffix: $("#c-strip-free-suffix").checked,
|
||||
free_only: $("#c-free-only").checked,
|
||||
active_probes: $("#c-active-probes").checked,
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user