feat(hermes): add agent quality config

This commit is contained in:
晴天
2026-05-26 04:42:28 +08:00
parent a34d7befb6
commit 2a23b682be
6 changed files with 315 additions and 2 deletions

View File

@@ -118,6 +118,9 @@ const AGENT_RUNTIME_DEFAULTS = {
gatewayNotifyInterval: 180,
gatewayAutoContinueFreshness: 3600,
imageInputMode: 'auto',
agentVerbose: false,
reasoningEffort: 'medium',
personalitiesJson: '{}',
}
const UNAUTHORIZED_DM_DEFAULTS = {
@@ -260,6 +263,7 @@ const STT_OPENAI_MODELS = ['whisper-1', 'gpt-4o-mini-transcribe', 'gpt-4o-transc
const STT_MISTRAL_MODELS = ['voxtral-mini-latest', 'voxtral-mini-2602']
const UNAUTHORIZED_DM_BEHAVIORS = ['pair', 'ignore']
const IMAGE_INPUT_MODES = ['auto', 'native', 'text']
const REASONING_EFFORTS = ['xhigh', 'high', 'medium', 'low', 'minimal', 'none']
const DISPLAY_TOOL_PROGRESS_VALUES = ['off', 'new', 'all', 'verbose']
const DISPLAY_LANGUAGE_VALUES = ['en', 'zh', 'zh-hant', 'ja', 'de', 'es', 'fr', 'tr', 'uk', 'af', 'ko', 'it', 'ga', 'pt', 'ru', 'hu']
const DISPLAY_RESUME_VALUES = ['full', 'minimal']
@@ -1123,6 +1127,20 @@ export function render() {
${IMAGE_INPUT_MODES.map(mode => option(`engine.hermesAgentRuntimeConfigImageInputMode_${mode}`, mode, agentRuntimeValues.imageInputMode)).join('')}
</select>
</label>
<label class="hm-field">
<span class="hm-field-label">${t('engine.hermesAgentRuntimeConfigReasoningEffort')}</span>
<select id="hm-agent-reasoning-effort" class="hm-input" ${disabled ? 'disabled' : ''}>
${REASONING_EFFORTS.map(effort => option(`engine.hermesAgentRuntimeConfigReasoningEffort_${effort}`, effort, agentRuntimeValues.reasoningEffort)).join('')}
</select>
</label>
<label class="hm-channel-check">
<input id="hm-agent-verbose" type="checkbox" ${agentRuntimeValues.agentVerbose ? 'checked' : ''} ${disabled ? 'disabled' : ''}>
<span>${t('engine.hermesAgentRuntimeConfigVerbose')}</span>
</label>
<label class="hm-field hm-field--wide">
<span class="hm-field-label">${t('engine.hermesAgentRuntimeConfigPersonalities')}</span>
<textarea id="hm-agent-personalities-json" class="hm-input" spellcheck="false" rows="7" ${disabled ? 'disabled' : ''} style="font-family:var(--hm-font-mono);line-height:1.65;min-height:190px">${esc(agentRuntimeValues.personalitiesJson)}</textarea>
</label>
</div>
<div class="hm-channel-footnote">${t('engine.hermesAgentRuntimeConfigFootnote')}</div>
</div>
@@ -3060,6 +3078,9 @@ export function render() {
gatewayNotifyInterval: el.querySelector('#hm-agent-gateway-notify-interval')?.value || '180',
gatewayAutoContinueFreshness: el.querySelector('#hm-agent-gateway-auto-continue-freshness')?.value || '3600',
imageInputMode: el.querySelector('#hm-agent-image-input-mode')?.value || 'auto',
reasoningEffort: el.querySelector('#hm-agent-reasoning-effort')?.value || 'medium',
agentVerbose: !!el.querySelector('#hm-agent-verbose')?.checked,
personalitiesJson: el.querySelector('#hm-agent-personalities-json')?.value || '{}',
}
agentRuntimeSaving = true
agentRuntimeError = null

View File

@@ -897,7 +897,16 @@ export default {
hermesAgentRuntimeConfigImageInputMode_auto: _('自动选择', 'Auto', '自動選擇'),
hermesAgentRuntimeConfigImageInputMode_native: _('原生图片输入', 'Native image input', '原生圖片輸入'),
hermesAgentRuntimeConfigImageInputMode_text: _('转文本描述', 'Convert to text description', '轉文字描述'),
hermesAgentRuntimeConfigFootnote: _('这些字段会写入 agent.*,影响 CLI 与 Gateway 长跑行为。将可选超时设为 0 表示关闭对应限制或通知disabled_toolsets 和其他高级 agent 字段会保留在 raw YAML 中。', 'These fields are written under agent.* and affect CLI and Gateway long-running behavior. Set optional timeouts to 0 to disable the corresponding limit or notification. disabled_toolsets and other advanced agent fields stay in raw YAML.', '這些欄位會寫入 agent.*,影響 CLI 與 Gateway 長跑行為。將可選逾時設為 0 表示關閉對應限制或通知disabled_toolsets 和其他進階 agent 欄位會保留在 raw YAML 中。'),
hermesAgentRuntimeConfigVerbose: _('启用详细日志', 'Enable verbose logging', '啟用詳細日誌'),
hermesAgentRuntimeConfigReasoningEffort: _('推理强度', 'Reasoning effort', '推理強度'),
hermesAgentRuntimeConfigReasoningEffort_xhigh: _('最高', 'Extra high', '最高'),
hermesAgentRuntimeConfigReasoningEffort_high: _('高', 'High', '高'),
hermesAgentRuntimeConfigReasoningEffort_medium: _('中', 'Medium', '中'),
hermesAgentRuntimeConfigReasoningEffort_low: _('低', 'Low', '低'),
hermesAgentRuntimeConfigReasoningEffort_minimal: _('极简', 'Minimal', '極簡'),
hermesAgentRuntimeConfigReasoningEffort_none: _('关闭', 'Off', '關閉'),
hermesAgentRuntimeConfigPersonalities: _('人格预设 JSON', 'Personalities JSON', '人格預設 JSON'),
hermesAgentRuntimeConfigFootnote: _('这些字段会写入 agent.*,影响 CLI 与 Gateway 长跑行为。将可选超时设为 0 表示关闭对应限制或通知;人格预设必须是名称到提示词的 JSON 映射disabled_toolsets 和其他高级 agent 字段会保留在 raw YAML 中。', 'These fields are written under agent.* and affect CLI and Gateway long-running behavior. Set optional timeouts to 0 to disable the corresponding limit or notification. Personalities must be a JSON map from name to prompt. disabled_toolsets and other advanced agent fields stay in raw YAML.', '這些欄位會寫入 agent.*,影響 CLI 與 Gateway 長跑行為。將可選逾時設為 0 表示關閉對應限制或通知;人格預設必須是名稱到提示詞的 JSON 映射disabled_toolsets 和其他進階 agent 欄位會保留在 raw YAML 中。'),
hermesUnauthorizedDmConfigTitle: _('未授权私信', 'Unauthorized DMs', '未授權私訊'),
hermesUnauthorizedDmConfigDesc: _('控制陌生用户直接私信 Hermes 时的全局响应策略,适合公网部署时减少无效打扰或保留配对入口。', 'Control the global response when unknown users send Hermes a direct message. Useful for public deployments that need fewer unsolicited replies or a pairing entry point.', '控制陌生使用者直接私訊 Hermes 時的全域回應策略,適合公開部署時減少無效打擾或保留配對入口。'),
hermesUnauthorizedDmConfigStatusReady: _('结构化配置', 'structured settings', '結構化設定'),