mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
fix(tui): refine reasoning visibility updates
Save reasoning display changes atomically and keep trail segments visible when Activity can render them.
This commit is contained in:
parent
f7abcb4f01
commit
7d96a5ab6e
2 changed files with 33 additions and 8 deletions
|
|
@ -3105,14 +3105,34 @@ def _(rid, params: dict) -> dict:
|
||||||
|
|
||||||
arg = str(value or "").strip().lower()
|
arg = str(value or "").strip().lower()
|
||||||
if arg in ("show", "on"):
|
if arg in ("show", "on"):
|
||||||
_write_config_key("display.show_reasoning", True)
|
cfg = _load_cfg()
|
||||||
_write_config_key("display.sections.thinking", "expanded")
|
display = cfg.get("display") if isinstance(cfg.get("display"), dict) else {}
|
||||||
|
sections = (
|
||||||
|
display.get("sections")
|
||||||
|
if isinstance(display.get("sections"), dict)
|
||||||
|
else {}
|
||||||
|
)
|
||||||
|
display["show_reasoning"] = True
|
||||||
|
sections["thinking"] = "expanded"
|
||||||
|
display["sections"] = sections
|
||||||
|
cfg["display"] = display
|
||||||
|
_save_cfg(cfg)
|
||||||
if session:
|
if session:
|
||||||
session["show_reasoning"] = True
|
session["show_reasoning"] = True
|
||||||
return _ok(rid, {"key": key, "value": "show"})
|
return _ok(rid, {"key": key, "value": "show"})
|
||||||
if arg in ("hide", "off"):
|
if arg in ("hide", "off"):
|
||||||
_write_config_key("display.show_reasoning", False)
|
cfg = _load_cfg()
|
||||||
_write_config_key("display.sections.thinking", "hidden")
|
display = cfg.get("display") if isinstance(cfg.get("display"), dict) else {}
|
||||||
|
sections = (
|
||||||
|
display.get("sections")
|
||||||
|
if isinstance(display.get("sections"), dict)
|
||||||
|
else {}
|
||||||
|
)
|
||||||
|
display["show_reasoning"] = False
|
||||||
|
sections["thinking"] = "hidden"
|
||||||
|
display["sections"] = sections
|
||||||
|
cfg["display"] = display
|
||||||
|
_save_cfg(cfg)
|
||||||
if session:
|
if session:
|
||||||
session["show_reasoning"] = False
|
session["show_reasoning"] = False
|
||||||
return _ok(rid, {"key": key, "value": "hide"})
|
return _ok(rid, {"key": key, "value": "hide"})
|
||||||
|
|
|
||||||
|
|
@ -713,6 +713,7 @@ export function useMainApp(gw: GatewayClient) {
|
||||||
)
|
)
|
||||||
const thinkingPanelVisible = sectionMode('thinking', ui.detailsMode, ui.sections, ui.detailsModeCommandOverride) !== 'hidden'
|
const thinkingPanelVisible = sectionMode('thinking', ui.detailsMode, ui.sections, ui.detailsModeCommandOverride) !== 'hidden'
|
||||||
const toolsPanelVisible = sectionMode('tools', ui.detailsMode, ui.sections, ui.detailsModeCommandOverride) !== 'hidden'
|
const toolsPanelVisible = sectionMode('tools', ui.detailsMode, ui.sections, ui.detailsModeCommandOverride) !== 'hidden'
|
||||||
|
const activityPanelVisible = sectionMode('activity', ui.detailsMode, ui.sections, ui.detailsModeCommandOverride) !== 'hidden'
|
||||||
|
|
||||||
const showProgressArea = useTurnSelector(state =>
|
const showProgressArea = useTurnSelector(state =>
|
||||||
anyPanelVisible
|
anyPanelVisible
|
||||||
|
|
@ -721,14 +722,18 @@ export function useMainApp(gw: GatewayClient) {
|
||||||
state.outcome ||
|
state.outcome ||
|
||||||
state.streamPendingTools.length ||
|
state.streamPendingTools.length ||
|
||||||
state.streamSegments.some(segment => {
|
state.streamSegments.some(segment => {
|
||||||
const thinking = Boolean(segment.thinking?.trim())
|
const hasThinking = Boolean(segment.thinking?.trim())
|
||||||
const tools = Boolean(segment.tools?.length)
|
const hasTrailTools = Boolean(segment.tools?.length)
|
||||||
|
|
||||||
if (segment.kind === 'trail' && !segment.text) {
|
if (segment.kind === 'trail' && !segment.text) {
|
||||||
return (thinkingPanelVisible && thinking) || (toolsPanelVisible && tools)
|
return (thinkingPanelVisible && hasThinking) || ((toolsPanelVisible || activityPanelVisible) && hasTrailTools)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Boolean(segment.text?.trim()) || (thinkingPanelVisible && thinking) || (toolsPanelVisible && tools)
|
return (
|
||||||
|
Boolean(segment.text?.trim()) ||
|
||||||
|
(thinkingPanelVisible && hasThinking) ||
|
||||||
|
((toolsPanelVisible || activityPanelVisible) && hasTrailTools)
|
||||||
|
)
|
||||||
}) ||
|
}) ||
|
||||||
state.subagents.length ||
|
state.subagents.length ||
|
||||||
state.tools.length ||
|
state.tools.length ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue