Bläddra i källkod

feat: persist thinking blocks display to KV and indicate its current display state in the command_list (resolves #4582) (#4810)

Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <[email protected]>
Co-authored-by: Aiden Cline <[email protected]>
Ariane Emory 2 månader sedan
förälder
incheckning
33c63be980

+ 1 - 1
packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx

@@ -239,7 +239,7 @@ export function Autocomplete(props: {
         },
         {
           display: "/thinking",
-          description: "toggle thinking blocks",
+          description: "toggle thinking visibility",
           onSelect: () => command.trigger("session.toggle.thinking"),
         },
       )

+ 7 - 3
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

@@ -111,7 +111,7 @@ export function Session() {
   const dimensions = useTerminalDimensions()
   const [sidebar, setSidebar] = createSignal<"show" | "hide" | "auto">(kv.get("sidebar", "auto"))
   const [conceal, setConceal] = createSignal(true)
-  const [showThinking, setShowThinking] = createSignal(true)
+  const [showThinking, setShowThinking] = createSignal(kv.get("thinking_visibility", true))
   const [showTimestamps, setShowTimestamps] = createSignal(kv.get("timestamps", "hide") === "show")
 
   const wide = createMemo(() => dimensions().width > 120)
@@ -430,11 +430,15 @@ export function Session() {
       },
     },
     {
-      title: "Toggle thinking blocks",
+      title: showThinking() ? "Hide thinking" : "Show thinking",
       value: "session.toggle.thinking",
       category: "Session",
       onSelect: (dialog) => {
-        setShowThinking((prev) => !prev)
+        setShowThinking((prev) => {
+          const next = !prev
+          kv.set("thinking_visibility", next)
+          return next
+        })
         dialog.clear()
       },
     },