mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
feat: 生成参数全面汉化 + 滑动条改造
- 20 个字段标签全部中文化 - 基础: 最大上下文/补全 Tokens、回复次数、流式输出、温度、种子等 - 惩罚: 频率惩罚、存在惩罚、重复惩罚 - 行为: 合并系统消息、推理努力度、请求思考过程、函数调用等 - 7 个连续参数改为滑动条 + 精确数字输入 - temperature(0-2), top_p/top_a/min_p(0-1) - frequency/presence_penalty(-2~2), repetition_penalty(0-3) - 双向同步: 拖动滑块自动更新数字输入及反向 - CSS: 自定义轨道/滑块/hover glow/紧凑数字框
This commit is contained in:
142
panel.js
142
panel.js
@@ -148,95 +148,47 @@ const TASK_PROFILE_GENERATION_GROUPS = [
|
|||||||
{
|
{
|
||||||
title: "基础生成参数",
|
title: "基础生成参数",
|
||||||
fields: [
|
fields: [
|
||||||
{ key: "max_context_tokens", label: "max_context_tokens", type: "number" },
|
{ key: "max_context_tokens", label: "最大上下文 Tokens", type: "number" },
|
||||||
{
|
{ key: "max_completion_tokens", label: "最大补全 Tokens", type: "number" },
|
||||||
key: "max_completion_tokens",
|
{ key: "reply_count", label: "回复次数", type: "number" },
|
||||||
label: "max_completion_tokens",
|
{ key: "stream", label: "流式输出", type: "tri_bool" },
|
||||||
type: "number",
|
{ key: "temperature", label: "温度 (Temperature)", type: "range", min: 0, max: 2, step: 0.01 },
|
||||||
},
|
{ key: "top_p", label: "Top P", type: "range", min: 0, max: 1, step: 0.01 },
|
||||||
{ key: "reply_count", label: "reply_count", type: "number" },
|
{ key: "top_k", label: "Top K", type: "number" },
|
||||||
{ key: "stream", label: "stream", type: "tri_bool" },
|
{ key: "top_a", label: "Top A", type: "range", min: 0, max: 1, step: 0.01 },
|
||||||
{
|
{ key: "min_p", label: "Min P", type: "range", min: 0, max: 1, step: 0.01 },
|
||||||
key: "temperature",
|
{ key: "seed", label: "随机种子 (Seed)", type: "number" },
|
||||||
label: "temperature",
|
|
||||||
type: "number",
|
|
||||||
step: "0.01",
|
|
||||||
},
|
|
||||||
{ key: "top_p", label: "top_p", type: "number", step: "0.01" },
|
|
||||||
{ key: "top_k", label: "top_k", type: "number" },
|
|
||||||
{ key: "top_a", label: "top_a", type: "number", step: "0.01" },
|
|
||||||
{ key: "min_p", label: "min_p", type: "number", step: "0.01" },
|
|
||||||
{ key: "seed", label: "seed", type: "number" },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "惩罚参数",
|
title: "惩罚参数",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{ key: "frequency_penalty", label: "频率惩罚", type: "range", min: -2, max: 2, step: 0.01 },
|
||||||
key: "frequency_penalty",
|
{ key: "presence_penalty", label: "存在惩罚", type: "range", min: -2, max: 2, step: 0.01 },
|
||||||
label: "frequency_penalty",
|
{ key: "repetition_penalty", label: "重复惩罚", type: "range", min: 0, max: 3, step: 0.01 },
|
||||||
type: "number",
|
|
||||||
step: "0.01",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "presence_penalty",
|
|
||||||
label: "presence_penalty",
|
|
||||||
type: "number",
|
|
||||||
step: "0.01",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "repetition_penalty",
|
|
||||||
label: "repetition_penalty",
|
|
||||||
type: "number",
|
|
||||||
step: "0.01",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "行为参数",
|
title: "行为参数",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{ key: "squash_system_messages", label: "合并系统消息", type: "tri_bool" },
|
||||||
key: "squash_system_messages",
|
|
||||||
label: "squash_system_messages",
|
|
||||||
type: "tri_bool",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: "reasoning_effort",
|
key: "reasoning_effort",
|
||||||
label: "reasoning_effort",
|
label: "推理努力度",
|
||||||
type: "enum",
|
type: "enum",
|
||||||
options: [
|
options: [
|
||||||
{ value: "", label: "跟随默认" },
|
{ value: "", label: "跟随默认" },
|
||||||
{ value: "minimal", label: "minimal" },
|
{ value: "minimal", label: "最低" },
|
||||||
{ value: "low", label: "low" },
|
{ value: "low", label: "低" },
|
||||||
{ value: "medium", label: "medium" },
|
{ value: "medium", label: "中" },
|
||||||
{ value: "high", label: "high" },
|
{ value: "high", label: "高" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{ key: "request_thoughts", label: "请求思考过程", type: "tri_bool" },
|
||||||
key: "request_thoughts",
|
{ key: "enable_function_calling", label: "函数调用", type: "tri_bool" },
|
||||||
label: "request_thoughts",
|
{ key: "enable_web_search", label: "网页搜索", type: "tri_bool" },
|
||||||
type: "tri_bool",
|
{ key: "character_name_prefix", label: "角色名前缀", type: "text" },
|
||||||
},
|
{ key: "wrap_user_messages_in_quotes", label: "用户消息加引号", type: "tri_bool" },
|
||||||
{
|
|
||||||
key: "enable_function_calling",
|
|
||||||
label: "enable_function_calling",
|
|
||||||
type: "tri_bool",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "enable_web_search",
|
|
||||||
label: "enable_web_search",
|
|
||||||
type: "tri_bool",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "character_name_prefix",
|
|
||||||
label: "character_name_prefix",
|
|
||||||
type: "text",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "wrap_user_messages_in_quotes",
|
|
||||||
label: "wrap_user_messages_in_quotes",
|
|
||||||
type: "tri_bool",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -1563,6 +1515,19 @@ function _handleTaskProfileWorkspaceInput(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target.matches("[data-generation-key]")) {
|
if (target.matches("[data-generation-key]")) {
|
||||||
|
// 滑动条 ↔ 数字输入 同步
|
||||||
|
const group = target.closest(".bme-range-group");
|
||||||
|
if (group) {
|
||||||
|
const key = target.dataset.generationKey;
|
||||||
|
const sibling = group.querySelector(
|
||||||
|
target.type === "range" ? `.bme-range-number` : `.bme-range-input`,
|
||||||
|
);
|
||||||
|
if (sibling) sibling.value = target.value;
|
||||||
|
// 更新 label 上的值显示
|
||||||
|
const row = target.closest(".bme-config-row");
|
||||||
|
const badge = row?.querySelector(".bme-range-value");
|
||||||
|
if (badge) badge.textContent = target.value || "默认";
|
||||||
|
}
|
||||||
_persistGenerationField(target, false);
|
_persistGenerationField(target, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2466,6 +2431,39 @@ function _renderGenerationField(field, value) {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (field.type === "range") {
|
||||||
|
const numValue = value != null && value !== "" ? Number(value) : "";
|
||||||
|
const displayValue = numValue !== "" ? numValue : field.min ?? 0;
|
||||||
|
return `
|
||||||
|
<div class="bme-config-row">
|
||||||
|
<label>${_escHtml(field.label)} <span class="bme-range-value">${numValue !== "" ? numValue : "默认"}</span></label>
|
||||||
|
<div class="bme-range-group">
|
||||||
|
<input
|
||||||
|
class="bme-range-input"
|
||||||
|
type="range"
|
||||||
|
min="${field.min ?? 0}"
|
||||||
|
max="${field.max ?? 1}"
|
||||||
|
step="${field.step ?? 0.01}"
|
||||||
|
value="${displayValue}"
|
||||||
|
data-generation-key="${_escHtml(field.key)}"
|
||||||
|
data-value-type="number"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
class="bme-config-input bme-range-number"
|
||||||
|
type="number"
|
||||||
|
min="${field.min ?? 0}"
|
||||||
|
max="${field.max ?? 1}"
|
||||||
|
step="${field.step ?? 0.01}"
|
||||||
|
value="${_escHtml(numValue)}"
|
||||||
|
placeholder="默认"
|
||||||
|
data-generation-key="${_escHtml(field.key)}"
|
||||||
|
data-value-type="number"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<div class="bme-config-row">
|
<div class="bme-config-row">
|
||||||
<label>${_escHtml(field.label)}</label>
|
<label>${_escHtml(field.label)}</label>
|
||||||
|
|||||||
63
style.css
63
style.css
@@ -1506,6 +1506,69 @@
|
|||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── 滑动条组件 ── */
|
||||||
|
|
||||||
|
.bme-range-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bme-range-input {
|
||||||
|
flex: 1;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
height: 4px;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 2px;
|
||||||
|
outline: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bme-range-input::-webkit-slider-thumb {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
background: var(--bme-primary);
|
||||||
|
border-radius: 50%;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 2px solid rgba(0, 0, 0, 0.3);
|
||||||
|
transition: box-shadow 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bme-range-input::-webkit-slider-thumb:hover {
|
||||||
|
box-shadow: 0 0 0 4px rgba(233, 69, 96, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bme-range-input::-moz-range-thumb {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
background: var(--bme-primary);
|
||||||
|
border-radius: 50%;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 2px solid rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bme-range-input::-moz-range-track {
|
||||||
|
height: 4px;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bme-range-number {
|
||||||
|
width: 72px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bme-range-value {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--bme-primary);
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.bme-task-section-label {
|
.bme-task-section-label {
|
||||||
margin: 16px 0 10px;
|
margin: 16px 0 10px;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
|||||||
Reference in New Issue
Block a user