Add files via upload

This commit is contained in:
公明
2026-05-20 17:48:42 +08:00
committed by GitHub
parent 05ca0c1480
commit b9bf8f62d4
6 changed files with 77 additions and 16 deletions
+2 -2
View File
@@ -1690,8 +1690,8 @@
"multiAgentPeLoop": "plan_execute outer loop limit",
"multiAgentPeLoopPlaceholder": "0 uses Eino default (10)",
"multiAgentPeLoopHint": "Only for plan_execute; max execute↔replan rounds.",
"multiAgentRobotUse": "Use multi-agent for WeCom / DingTalk / Lark bots",
"multiAgentRobotUseHint": "Requires 'Enable multi-agent' to be checked; usage and cost will be higher.",
"multiAgentRobotMode": "Default conversation mode for bots",
"multiAgentRobotModeHint": "Execution mode for WeCom / DingTalk / Lark bot messages. Deep / Plan-Execute / Supervisor require multi-agent to be enabled.",
"multiAgentBatchUse": "Use multi-agent for batch task queues",
"multiAgentBatchUseHint": "When enabled, each sub-task executed by queue in Task Management will run through Eino DeepAgent (requires multi-agent).",
"enableKnowledge": "Enable knowledge retrieval",
+2 -2
View File
@@ -1679,8 +1679,8 @@
"multiAgentPeLoop": "plan_execute 外层循环上限",
"multiAgentPeLoopPlaceholder": "0 表示 Eino 默认 10",
"multiAgentPeLoopHint": "仅 plan_execute 有效;execute 与 replan 之间的最大轮次。",
"multiAgentRobotUse": "企业微信 / 钉钉 / 飞书机器人也使用多代理",
"multiAgentRobotUseHint": "需同时勾选「启用多代理」;调用量与成本更高。",
"multiAgentRobotMode": "机器人默认对话模式",
"multiAgentRobotModeHint": "企业微信 / 钉钉 / 飞书机器人每条消息使用的执行模式;Deep / Plan-Execute / Supervisor 需启用多代理。",
"multiAgentBatchUse": "批量任务队列也使用多代理",
"multiAgentBatchUseHint": "开启后,任务管理中按队列执行的每个子任务将走 Eino DeepAgent(需启用多代理)。",
"enableKnowledge": "启用知识检索功能",
+26
View File
@@ -3064,6 +3064,27 @@ function getConversationGroup(dateObj, todayStart, sevenDaysCutoff, yesterdaySta
}
// 加载对话
/** 轻量加载会话后,拉取最后一条助手消息的 process_details(机器人等无 SSE 场景) */
async function prefetchLastAssistantProcessDetails() {
const nodes = document.querySelectorAll('#chat-messages .message.assistant');
if (!nodes.length) return;
const last = nodes[nodes.length - 1];
if (!last || !last.id) return;
const container = document.getElementById('process-details-' + last.id);
if (!container || container.dataset.lazyNotLoaded !== '1') return;
const backendId = last.dataset && last.dataset.backendMessageId;
if (!backendId || typeof apiFetch !== 'function') return;
const res = await apiFetch('/api/messages/' + encodeURIComponent(String(backendId)) + '/process-details');
const j = await res.json().catch(() => ({}));
if (!res.ok || !Array.isArray(j.processDetails) || j.processDetails.length === 0) return;
if (typeof renderProcessDetails === 'function') {
renderProcessDetails(last.id, j.processDetails);
}
if (typeof window.expandProcessDetailsTimeline === 'function') {
window.expandProcessDetailsTimeline(last.id);
}
}
async function loadConversation(conversationId) {
const seq = ++loadConversationRequestSeq;
try {
@@ -3283,6 +3304,11 @@ async function loadConversation(conversationId) {
.catch((e) => {
console.warn('attachRunningTaskEventStream on loadConversation failed', e);
});
} else if (seq === loadConversationRequestSeq && currentConversationId === conversationId) {
// 机器人等非 Web 流式来源:会话已结束或未注册任务时,按需拉取最后一条助手消息的过程详情
prefetchLastAssistantProcessDetails().catch((e) => {
console.warn('prefetchLastAssistantProcessDetails failed', e);
});
}
} catch (error) {
console.error('加载对话失败:', error);
+1
View File
@@ -2511,6 +2511,7 @@ async function attachRunningTaskEventStream(conversationId) {
window.attachRunningTaskEventStream = attachRunningTaskEventStream;
window.taskReplayProgressId = taskReplayProgressId;
window.expandProcessDetailsTimeline = expandProcessDetailsTimeline;
/** 从工具参数提取短摘要(URL/命令等),便于同名工具批量调用时区分 */
function parseToolCallArgsFromData(data) {
+37 -6
View File
@@ -31,6 +31,19 @@ let toolsPagination = {
let c2NavSyncedOnce = false;
/** 根据是否启用多代理,禁用/启用机器人模式中的 Eino 编排选项 */
function syncRobotAgentModeSelectOptions(multiEnabled) {
const sel = document.getElementById('multi-agent-robot-mode');
if (!sel) return;
['deep', 'plan_execute', 'supervisor'].forEach(function (v) {
const opt = sel.querySelector('option[value="' + v + '"]');
if (opt) opt.disabled = !multiEnabled;
});
if (!multiEnabled && ['deep', 'plan_execute', 'supervisor'].indexOf(sel.value) >= 0) {
sel.value = 'react';
}
}
/** 首次进入仪表盘等页面前拉一次配置,隐藏侧栏 C2(避免禁用后仍显示) */
window.syncC2NavOnceFromServer = async function syncC2NavOnceFromServer() {
if (c2NavSyncedOnce || typeof apiFetch === 'undefined') {
@@ -198,14 +211,27 @@ async function loadConfig(loadTools = true) {
const ma = currentConfig.multi_agent || {};
const maEn = document.getElementById('multi-agent-enabled');
if (maEn) maEn.checked = ma.enabled === true;
if (maEn) {
maEn.checked = ma.enabled === true;
if (!maEn.dataset.robotModeBound) {
maEn.dataset.robotModeBound = '1';
maEn.addEventListener('change', function () {
syncRobotAgentModeSelectOptions(maEn.checked);
});
}
}
const maPeLoop = document.getElementById('multi-agent-pe-loop');
if (maPeLoop) {
const v = ma.plan_execute_loop_max_iterations;
maPeLoop.value = (v !== undefined && v !== null && !Number.isNaN(Number(v))) ? String(Number(v)) : '0';
}
const maRobot = document.getElementById('multi-agent-robot-use');
if (maRobot) maRobot.checked = ma.robot_use_multi_agent === true;
const maRobotMode = document.getElementById('multi-agent-robot-mode');
if (maRobotMode) {
let mode = (ma.robot_default_agent_mode || 'react').trim().toLowerCase();
if (mode === 'single') mode = 'react';
maRobotMode.value = mode;
syncRobotAgentModeSelectOptions(ma.enabled === true);
}
// 填充知识库配置
const knowledgeEnabledCheckbox = document.getElementById('knowledge-enabled');
@@ -1133,9 +1159,14 @@ async function applySettings() {
const peRaw = document.getElementById('multi-agent-pe-loop')?.value;
const peParsed = parseInt(peRaw, 10);
const peLoop = Number.isNaN(peParsed) ? 0 : Math.max(0, peParsed);
const maEnabled = document.getElementById('multi-agent-enabled')?.checked === true;
let robotMode = document.getElementById('multi-agent-robot-mode')?.value || 'react';
if (!maEnabled && ['deep', 'plan_execute', 'supervisor'].indexOf(robotMode) >= 0) {
robotMode = 'react';
}
return {
enabled: document.getElementById('multi-agent-enabled')?.checked === true,
robot_use_multi_agent: document.getElementById('multi-agent-robot-use')?.checked === true,
enabled: maEnabled,
robot_default_agent_mode: robotMode,
batch_use_multi_agent: currentConfig?.multi_agent?.batch_use_multi_agent === true,
plan_execute_loop_max_iterations: peLoop
};
@@ -1384,7 +1415,7 @@ async function saveToolsConfig() {
agent: currentConfig.agent || {},
multi_agent: {
enabled: currentConfig?.multi_agent?.enabled === true,
robot_use_multi_agent: currentConfig?.multi_agent?.robot_use_multi_agent === true,
robot_default_agent_mode: currentConfig?.multi_agent?.robot_default_agent_mode || 'react',
batch_use_multi_agent: currentConfig?.multi_agent?.batch_use_multi_agent === true,
plan_execute_loop_max_iterations: Number(currentConfig?.multi_agent?.plan_execute_loop_max_iterations || 0),
tool_search_always_visible_tools: Array.from(alwaysVisibleToolNames).filter(name => !alwaysVisibleBuiltinToolNames.has(name))
+9 -6
View File
@@ -2144,12 +2144,15 @@
<small class="form-hint" data-i18n="settingsBasic.multiAgentPeLoopHint">仅 orchestration=plan_execute 时有效;execute 与 replan 之间的最大轮次。</small>
</div>
<div class="form-group">
<label class="checkbox-label">
<input type="checkbox" id="multi-agent-robot-use" class="modern-checkbox" />
<span class="checkbox-custom"></span>
<span class="checkbox-text" data-i18n="settingsBasic.multiAgentRobotUse">企业微信 / 钉钉 / 飞书机器人也使用多代理</span>
</label>
<small class="form-hint" data-i18n="settingsBasic.multiAgentRobotUseHint">需同时勾选「启用多代理」;调用量与成本更高。</small>
<label for="multi-agent-robot-mode" data-i18n="settingsBasic.multiAgentRobotMode">机器人默认对话模式</label>
<select id="multi-agent-robot-mode" class="form-select">
<option value="react" data-i18n="chat.agentModeReactNative">原生 ReAct</option>
<option value="eino_single" data-i18n="chat.agentModeEinoSingle">Eino 单代理(ADK</option>
<option value="deep" data-i18n="chat.agentModeDeep">DeepDeepAgent</option>
<option value="plan_execute" data-i18n="chat.agentModePlanExecuteLabel">Plan-Execute</option>
<option value="supervisor" data-i18n="chat.agentModeSupervisorLabel">Supervisor</option>
</select>
<small class="form-hint" data-i18n="settingsBasic.multiAgentRobotModeHint">企业微信 / 钉钉 / 飞书机器人每条消息使用的执行模式;Deep / Plan-Execute / Supervisor 需启用多代理。</small>
</div>
</div>
</div>