mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-13 04:40:44 +08:00
Remove Plan/Agent v2 selector from chat settings.
v2 is gone; hide the dead version menu and force classic v1 on wire paths.
This commit is contained in:
parent
b6986c4b8c
commit
9da63de21b
4 changed files with 9 additions and 73 deletions
|
|
@ -744,9 +744,9 @@ def _normalize_confirm_strategy(payload: dict[str, Any] | None) -> str:
|
||||||
|
|
||||||
|
|
||||||
def _normalize_plan_agent_version(payload: dict[str, Any] | None) -> str:
|
def _normalize_plan_agent_version(payload: dict[str, Any] | None) -> str:
|
||||||
body = payload or {}
|
"""Plan agent v2 removed; always wire as classic v1."""
|
||||||
raw = str(body.get("plan_agent_version") or "").strip().lower()
|
del payload
|
||||||
return raw if raw in {"v1", "v2"} else "v1"
|
return "v1"
|
||||||
|
|
||||||
|
|
||||||
def _resolve_user_menu_chat_settings(
|
def _resolve_user_menu_chat_settings(
|
||||||
|
|
@ -755,7 +755,7 @@ def _resolve_user_menu_chat_settings(
|
||||||
tenant_id: str,
|
tenant_id: str,
|
||||||
user_id: str,
|
user_id: str,
|
||||||
) -> tuple[str, str, str, str]:
|
) -> tuple[str, str, str, str]:
|
||||||
"""User-wide settings (⋯ menu): mode + confirm + plan/agent version — all sessions share these keys."""
|
"""User-wide settings (⋯ menu): mode + confirm — all sessions share these keys."""
|
||||||
user_mode_key = _chat_user_mode_setting_key(tenant_id=tenant_id, user_id=user_id, field="interaction_mode")
|
user_mode_key = _chat_user_mode_setting_key(tenant_id=tenant_id, user_id=user_id, field="interaction_mode")
|
||||||
user_specialist_key = _chat_user_mode_setting_key(tenant_id=tenant_id, user_id=user_id, field="specialist")
|
user_specialist_key = _chat_user_mode_setting_key(tenant_id=tenant_id, user_id=user_id, field="specialist")
|
||||||
user_confirm_strategy_key = _chat_user_mode_setting_key(tenant_id=tenant_id, user_id=user_id, field="confirm_strategy")
|
user_confirm_strategy_key = _chat_user_mode_setting_key(tenant_id=tenant_id, user_id=user_id, field="confirm_strategy")
|
||||||
|
|
|
||||||
|
|
@ -108,10 +108,6 @@ const I18N = {
|
||||||
"chat.execModePlan": "Plan",
|
"chat.execModePlan": "Plan",
|
||||||
"chat.execModeApplied": "执行态:{mode}",
|
"chat.execModeApplied": "执行态:{mode}",
|
||||||
"chat.confirmStrategyLabel": "确认策略",
|
"chat.confirmStrategyLabel": "确认策略",
|
||||||
"chat.planAgentVersionLabel": "Plan / Agent 版本",
|
|
||||||
"chat.planAgentVersionV1": "v1(经典)",
|
|
||||||
"chat.planAgentVersionV2": "v2",
|
|
||||||
"chat.planAgentVersionV2Disabled": "v2(未启用,需 AIA_EXPERT_PLAN_AGENT_V2_ENABLED=1)",
|
|
||||||
"chat.confirmStrategyStrict": "Strict(需切换 Agent)",
|
"chat.confirmStrategyStrict": "Strict(需切换 Agent)",
|
||||||
"chat.confirmStrategyAuto": "Auto(自动确认执行)",
|
"chat.confirmStrategyAuto": "Auto(自动确认执行)",
|
||||||
"chat.confirmStrategyOff": "Off(不拦截确认)",
|
"chat.confirmStrategyOff": "Off(不拦截确认)",
|
||||||
|
|
@ -306,9 +302,6 @@ const I18N = {
|
||||||
"chat.execModePlan": "Plan",
|
"chat.execModePlan": "Plan",
|
||||||
"chat.execModeApplied": "Execution: {mode}",
|
"chat.execModeApplied": "Execution: {mode}",
|
||||||
"chat.confirmStrategyLabel": "Confirm Strategy",
|
"chat.confirmStrategyLabel": "Confirm Strategy",
|
||||||
"chat.planAgentVersionLabel": "Plan / Agent version",
|
|
||||||
"chat.planAgentVersionV1": "v1 (classic)",
|
|
||||||
"chat.planAgentVersionV2": "v2",
|
|
||||||
"chat.confirmStrategyStrict": "Strict (switch to Agent first)",
|
"chat.confirmStrategyStrict": "Strict (switch to Agent first)",
|
||||||
"chat.confirmStrategyAuto": "Auto (confirm executes directly)",
|
"chat.confirmStrategyAuto": "Auto (confirm executes directly)",
|
||||||
"chat.confirmStrategyOff": "Off (no confirm-mode gate)",
|
"chat.confirmStrategyOff": "Off (no confirm-mode gate)",
|
||||||
|
|
@ -414,7 +407,6 @@ const CHAT_INTERACTION_MODE_KEY = "ops_chat_interaction_mode";
|
||||||
const CHAT_MEMORY_MODE_KEY = "ops_chat_memory_mode";
|
const CHAT_MEMORY_MODE_KEY = "ops_chat_memory_mode";
|
||||||
const CHAT_EXECUTION_MODE_KEY = "ops_chat_execution_mode";
|
const CHAT_EXECUTION_MODE_KEY = "ops_chat_execution_mode";
|
||||||
const CHAT_CONFIRM_STRATEGY_KEY = "ops_chat_confirm_strategy";
|
const CHAT_CONFIRM_STRATEGY_KEY = "ops_chat_confirm_strategy";
|
||||||
const CHAT_PLAN_AGENT_VERSION_KEY = "ops_chat_plan_agent_version";
|
|
||||||
const CHAT_USER_MENU_MODE_KEY = "ops_chat_user_menu_mode";
|
const CHAT_USER_MENU_MODE_KEY = "ops_chat_user_menu_mode";
|
||||||
const CHAT_REASONING_TOGGLE_KEY = "ops_chat_reasoning_toggle";
|
const CHAT_REASONING_TOGGLE_KEY = "ops_chat_reasoning_toggle";
|
||||||
const EXECUTION_MODE_AGENT = "agent";
|
const EXECUTION_MODE_AGENT = "agent";
|
||||||
|
|
@ -423,7 +415,6 @@ const CONFIRM_STRATEGY_STRICT = "strict";
|
||||||
const CONFIRM_STRATEGY_AUTO = "auto";
|
const CONFIRM_STRATEGY_AUTO = "auto";
|
||||||
const CONFIRM_STRATEGY_OFF = "off";
|
const CONFIRM_STRATEGY_OFF = "off";
|
||||||
const PLAN_AGENT_V1 = "v1";
|
const PLAN_AGENT_V1 = "v1";
|
||||||
const PLAN_AGENT_V2 = "v2";
|
|
||||||
/** Default on: reasoning/tool fold matches streamed behavior; new browsers have no localStorage yet. */
|
/** Default on: reasoning/tool fold matches streamed behavior; new browsers have no localStorage yet. */
|
||||||
const ADMIN_CHAT_SHOW_TOOL_OUTPUT_DEFAULT = true;
|
const ADMIN_CHAT_SHOW_TOOL_OUTPUT_DEFAULT = true;
|
||||||
const REASONING_BLOCK_MAX_CHARS = 12000;
|
const REASONING_BLOCK_MAX_CHARS = 12000;
|
||||||
|
|
@ -3073,29 +3064,6 @@ function syncAuthUserLabel() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
items.push(modeSel);
|
items.push(modeSel);
|
||||||
items.push(el("div", { class: "muted", style: "padding:6px 10px 2px;font-size:12px;", text: t("chat.planAgentVersionLabel") }));
|
|
||||||
const pavSel = el("select", { class: "input", style: "width:100%;margin:4px 8px 8px;max-width:calc(100% - 16px);" });
|
|
||||||
try {
|
|
||||||
const prow = Array.isArray(bridge.getPlanAgentVersionOptions && bridge.getPlanAgentVersionOptions())
|
|
||||||
? bridge.getPlanAgentVersionOptions()
|
|
||||||
: [];
|
|
||||||
prow.forEach((r) =>
|
|
||||||
pavSel.appendChild(el("option", { value: String(r.value || ""), text: String(r.label || r.value || "") })),
|
|
||||||
);
|
|
||||||
pavSel.value = String((bridge.getPlanAgentVersionValue && bridge.getPlanAgentVersionValue()) || "");
|
|
||||||
} catch (_) {}
|
|
||||||
pavSel.addEventListener("change", async () => {
|
|
||||||
const v = pavSel.value;
|
|
||||||
try {
|
|
||||||
pavSel.disabled = true;
|
|
||||||
if (bridge.setPlanAgentVersionValue) await bridge.setPlanAgentVersionValue(v);
|
|
||||||
} catch (_) {
|
|
||||||
// errors are surfaced by saveUserGlobalModePreference()
|
|
||||||
} finally {
|
|
||||||
pavSel.disabled = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
items.push(pavSel);
|
|
||||||
items.push(el("div", { class: "muted", style: "padding:2px 10px 2px;font-size:12px;", text: t("chat.confirmStrategyLabel") }));
|
items.push(el("div", { class: "muted", style: "padding:2px 10px 2px;font-size:12px;", text: t("chat.confirmStrategyLabel") }));
|
||||||
const csSel = el("select", { class: "input", style: "width:100%;margin:4px 8px 8px;max-width:calc(100% - 16px);" });
|
const csSel = el("select", { class: "input", style: "width:100%;margin:4px 8px 8px;max-width:calc(100% - 16px);" });
|
||||||
try {
|
try {
|
||||||
|
|
@ -3393,12 +3361,6 @@ async function renderChatUi() {
|
||||||
normalizeExecutionMode(v) === EXECUTION_MODE_PLAN ? t("chat.execModePlan") : t("chat.execModeAgent");
|
normalizeExecutionMode(v) === EXECUTION_MODE_PLAN ? t("chat.execModePlan") : t("chat.execModeAgent");
|
||||||
let currentExecutionMode = normalizeExecutionMode(localStorage.getItem(CHAT_EXECUTION_MODE_KEY) || EXECUTION_MODE_AGENT);
|
let currentExecutionMode = normalizeExecutionMode(localStorage.getItem(CHAT_EXECUTION_MODE_KEY) || EXECUTION_MODE_AGENT);
|
||||||
let currentConfirmStrategy = normalizeConfirmStrategy(localStorage.getItem(CHAT_CONFIRM_STRATEGY_KEY) || CONFIRM_STRATEGY_STRICT);
|
let currentConfirmStrategy = normalizeConfirmStrategy(localStorage.getItem(CHAT_CONFIRM_STRATEGY_KEY) || CONFIRM_STRATEGY_STRICT);
|
||||||
const normalizePlanAgentVersion = (v) => {
|
|
||||||
const raw = String(v || "").trim().toLowerCase();
|
|
||||||
return raw === PLAN_AGENT_V2 ? PLAN_AGENT_V2 : PLAN_AGENT_V1;
|
|
||||||
};
|
|
||||||
let planAgentV2GloballyEnabled = false;
|
|
||||||
let currentPlanAgentVersion = normalizePlanAgentVersion(localStorage.getItem(CHAT_PLAN_AGENT_VERSION_KEY) || PLAN_AGENT_V1);
|
|
||||||
const execSelect = el("select", {
|
const execSelect = el("select", {
|
||||||
class: "input",
|
class: "input",
|
||||||
style: "min-width:96px;max-width:140px;padding:6px 8px;",
|
style: "min-width:96px;max-width:140px;padding:6px 8px;",
|
||||||
|
|
@ -3425,7 +3387,6 @@ async function renderChatUi() {
|
||||||
const execSelectWrap = el("span", { class: "chat-exec-mode-wrap", style: "display:inline-flex;align-items:center;" }, [
|
const execSelectWrap = el("span", { class: "chat-exec-mode-wrap", style: "display:inline-flex;align-items:center;" }, [
|
||||||
execSelect,
|
execSelect,
|
||||||
]);
|
]);
|
||||||
const outboundPlanAgentVersion = () => PLAN_AGENT_V1;
|
|
||||||
const refreshExecUi = () => {
|
const refreshExecUi = () => {
|
||||||
// Plan mode removed; keep agent execution only.
|
// Plan mode removed; keep agent execution only.
|
||||||
execSelectWrap.style.display = "none";
|
execSelectWrap.style.display = "none";
|
||||||
|
|
@ -3574,10 +3535,6 @@ async function renderChatUi() {
|
||||||
const mm = String((resp && resp.memory_mode) || "").toLowerCase();
|
const mm = String((resp && resp.memory_mode) || "").toLowerCase();
|
||||||
const em = String((resp && resp.execution_mode) || "").toLowerCase();
|
const em = String((resp && resp.execution_mode) || "").toLowerCase();
|
||||||
const cs = String((resp && resp.confirm_strategy) || "").toLowerCase();
|
const cs = String((resp && resp.confirm_strategy) || "").toLowerCase();
|
||||||
planAgentV2GloballyEnabled = !!(resp && resp.plan_agent_v2_globally_enabled);
|
|
||||||
const pavRaw = String((resp && resp.plan_agent_version) || "").trim().toLowerCase();
|
|
||||||
currentPlanAgentVersion = normalizePlanAgentVersion(pavRaw || localStorage.getItem(CHAT_PLAN_AGENT_VERSION_KEY));
|
|
||||||
localStorage.setItem(CHAT_PLAN_AGENT_VERSION_KEY, currentPlanAgentVersion);
|
|
||||||
const gm = resp && resp.global_menu && typeof resp.global_menu === "object" ? resp.global_menu : null;
|
const gm = resp && resp.global_menu && typeof resp.global_menu === "object" ? resp.global_menu : null;
|
||||||
if (gm) {
|
if (gm) {
|
||||||
const gIm = String(gm.interaction_mode || "").toLowerCase();
|
const gIm = String(gm.interaction_mode || "").toLowerCase();
|
||||||
|
|
@ -3589,15 +3546,10 @@ async function renderChatUi() {
|
||||||
try {
|
try {
|
||||||
const ur = await apiGet("/admin/api/chat/user-mode");
|
const ur = await apiGet("/admin/api/chat/user-mode");
|
||||||
if (ur && ur.ok) {
|
if (ur && ur.ok) {
|
||||||
planAgentV2GloballyEnabled = !!(ur.plan_agent_v2_globally_enabled != null ? ur.plan_agent_v2_globally_enabled : planAgentV2GloballyEnabled);
|
|
||||||
const gum = String((ur.interaction_mode || "").toLowerCase());
|
const gum = String((ur.interaction_mode || "").toLowerCase());
|
||||||
const gus = String((ur.specialist || "").toLowerCase());
|
const gus = String((ur.specialist || "").toLowerCase());
|
||||||
currentConfirmStrategy = normalizeConfirmStrategy(ur.confirm_strategy || currentConfirmStrategy);
|
currentConfirmStrategy = normalizeConfirmStrategy(ur.confirm_strategy || currentConfirmStrategy);
|
||||||
localStorage.setItem(CHAT_CONFIRM_STRATEGY_KEY, currentConfirmStrategy);
|
localStorage.setItem(CHAT_CONFIRM_STRATEGY_KEY, currentConfirmStrategy);
|
||||||
currentPlanAgentVersion = normalizePlanAgentVersion(
|
|
||||||
ur.plan_agent_version || localStorage.getItem(CHAT_PLAN_AGENT_VERSION_KEY),
|
|
||||||
);
|
|
||||||
localStorage.setItem(CHAT_PLAN_AGENT_VERSION_KEY, currentPlanAgentVersion);
|
|
||||||
if (isSelectableSpecialist(gus)) globalMenuModeValue = gus;
|
if (isSelectableSpecialist(gus)) globalMenuModeValue = gus;
|
||||||
else if (isSelectableSpecialist(gum)) globalMenuModeValue = gum;
|
else if (isSelectableSpecialist(gum)) globalMenuModeValue = gum;
|
||||||
else globalMenuModeValue = MAIN_MODE_VALUE;
|
else globalMenuModeValue = MAIN_MODE_VALUE;
|
||||||
|
|
@ -3632,11 +3584,8 @@ async function renderChatUi() {
|
||||||
interaction_mode: "expert",
|
interaction_mode: "expert",
|
||||||
specialist,
|
specialist,
|
||||||
confirm_strategy: String(currentConfirmStrategy || CONFIRM_STRATEGY_STRICT),
|
confirm_strategy: String(currentConfirmStrategy || CONFIRM_STRATEGY_STRICT),
|
||||||
plan_agent_version: String(currentPlanAgentVersion || PLAN_AGENT_V1),
|
plan_agent_version: PLAN_AGENT_V1,
|
||||||
});
|
});
|
||||||
if (resp && typeof resp.plan_agent_v2_globally_enabled === "boolean") {
|
|
||||||
planAgentV2GloballyEnabled = !!resp.plan_agent_v2_globally_enabled;
|
|
||||||
}
|
|
||||||
localStorage.setItem(CHAT_USER_MENU_MODE_KEY, specialist);
|
localStorage.setItem(CHAT_USER_MENU_MODE_KEY, specialist);
|
||||||
globalMenuModeValue = specialist;
|
globalMenuModeValue = specialist;
|
||||||
if (!resp || resp.ok === false) {
|
if (!resp || resp.ok === false) {
|
||||||
|
|
@ -3966,19 +3915,6 @@ async function renderChatUi() {
|
||||||
refreshExecUi();
|
refreshExecUi();
|
||||||
publishUserMenuPrefsBridge();
|
publishUserMenuPrefsBridge();
|
||||||
},
|
},
|
||||||
getPlanAgentVersionOptions: () => [
|
|
||||||
{ value: PLAN_AGENT_V1, label: t("chat.planAgentVersionV1") },
|
|
||||||
{ value: PLAN_AGENT_V2, label: t("chat.planAgentVersionV2") },
|
|
||||||
],
|
|
||||||
getPlanAgentVersionValue: () => String(currentPlanAgentVersion || PLAN_AGENT_V1),
|
|
||||||
setPlanAgentVersionValue: async (v) => {
|
|
||||||
const next = normalizePlanAgentVersion(v);
|
|
||||||
currentPlanAgentVersion = next;
|
|
||||||
localStorage.setItem(CHAT_PLAN_AGENT_VERSION_KEY, currentPlanAgentVersion);
|
|
||||||
await saveUserGlobalModePreference();
|
|
||||||
refreshExecUi();
|
|
||||||
publishUserMenuPrefsBridge();
|
|
||||||
},
|
|
||||||
getConfirmStrategyOptions: () => [
|
getConfirmStrategyOptions: () => [
|
||||||
{ value: CONFIRM_STRATEGY_STRICT, label: t("chat.confirmStrategyStrict") },
|
{ value: CONFIRM_STRATEGY_STRICT, label: t("chat.confirmStrategyStrict") },
|
||||||
{ value: CONFIRM_STRATEGY_AUTO, label: t("chat.confirmStrategyAuto") },
|
{ value: CONFIRM_STRATEGY_AUTO, label: t("chat.confirmStrategyAuto") },
|
||||||
|
|
@ -4542,7 +4478,7 @@ async function renderChatUi() {
|
||||||
specialist: String(specialist || "generalist"),
|
specialist: String(specialist || "generalist"),
|
||||||
memory_mode: String(memoryMode || "default"),
|
memory_mode: String(memoryMode || "default"),
|
||||||
execution_mode: String(executionMode || "agent"),
|
execution_mode: String(executionMode || "agent"),
|
||||||
plan_agent_version: outboundPlanAgentVersion(),
|
plan_agent_version: PLAN_AGENT_V1,
|
||||||
lang: currentLang === "en" ? "en" : "zh",
|
lang: currentLang === "en" ? "en" : "zh",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ def build_gateway_context(
|
||||||
if execution_mode not in {"agent", "plan"}:
|
if execution_mode not in {"agent", "plan"}:
|
||||||
execution_mode = "agent"
|
execution_mode = "agent"
|
||||||
plan_agent_version = str(p.get("plan_agent_version") or "v1").strip().lower() or "v1"
|
plan_agent_version = str(p.get("plan_agent_version") or "v1").strip().lower() or "v1"
|
||||||
if plan_agent_version not in {"v1", "v2"}:
|
if plan_agent_version != "v1":
|
||||||
plan_agent_version = "v1"
|
plan_agent_version = "v1"
|
||||||
if interaction_mode != "expert":
|
if interaction_mode != "expert":
|
||||||
interaction_mode = "expert"
|
interaction_mode = "expert"
|
||||||
|
|
@ -107,7 +107,7 @@ def build_gateway_context(
|
||||||
if execution_mode not in {"agent", "plan"}:
|
if execution_mode not in {"agent", "plan"}:
|
||||||
execution_mode = "agent"
|
execution_mode = "agent"
|
||||||
plan_agent_version = str(p.get("plan_agent_version") or "v1").strip().lower() or "v1"
|
plan_agent_version = str(p.get("plan_agent_version") or "v1").strip().lower() or "v1"
|
||||||
if plan_agent_version not in {"v1", "v2"}:
|
if plan_agent_version != "v1":
|
||||||
plan_agent_version = "v1"
|
plan_agent_version = "v1"
|
||||||
if interaction_mode != "expert":
|
if interaction_mode != "expert":
|
||||||
interaction_mode = "expert"
|
interaction_mode = "expert"
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ async def run_agent_turn_via_bridge(
|
||||||
if execution_mode not in {"agent", "plan"}:
|
if execution_mode not in {"agent", "plan"}:
|
||||||
execution_mode = "agent"
|
execution_mode = "agent"
|
||||||
plan_agent_version = str(p.get("plan_agent_version") or "v1").strip().lower() or "v1"
|
plan_agent_version = str(p.get("plan_agent_version") or "v1").strip().lower() or "v1"
|
||||||
if plan_agent_version not in {"v1", "v2"}:
|
if plan_agent_version != "v1":
|
||||||
plan_agent_version = "v1"
|
plan_agent_version = "v1"
|
||||||
store = get_assistant_store()
|
store = get_assistant_store()
|
||||||
gw = OclawGateway(store=store)
|
gw = OclawGateway(store=store)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue