mirror of
https://github.com/aljazceru/opencode.git
synced 2026-02-18 14:35:16 +01:00
Added /thinking slash command to toggle thinking blocks visibility in OpenTUI. (#4424)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
committed by
GitHub
parent
066a876f3d
commit
d60102ba52
@@ -245,6 +245,11 @@ export function Autocomplete(props: {
|
|||||||
description: "jump to message",
|
description: "jump to message",
|
||||||
onSelect: () => command.trigger("session.timeline"),
|
onSelect: () => command.trigger("session.timeline"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
display: "/thinking",
|
||||||
|
description: "toggle thinking blocks",
|
||||||
|
onSelect: () => command.trigger("session.toggle.thinking"),
|
||||||
|
},
|
||||||
)
|
)
|
||||||
if (sync.data.config.share !== "disabled") {
|
if (sync.data.config.share !== "disabled") {
|
||||||
results.push({
|
results.push({
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ class CustomSpeedScroll implements ScrollAcceleration {
|
|||||||
const context = createContext<{
|
const context = createContext<{
|
||||||
width: number
|
width: number
|
||||||
conceal: () => boolean
|
conceal: () => boolean
|
||||||
|
showThinking: () => boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
function use() {
|
function use() {
|
||||||
@@ -112,6 +113,7 @@ export function Session() {
|
|||||||
const dimensions = useTerminalDimensions()
|
const dimensions = useTerminalDimensions()
|
||||||
const [sidebar, setSidebar] = createSignal<"show" | "hide" | "auto">(kv.get("sidebar", "auto"))
|
const [sidebar, setSidebar] = createSignal<"show" | "hide" | "auto">(kv.get("sidebar", "auto"))
|
||||||
const [conceal, setConceal] = createSignal(true)
|
const [conceal, setConceal] = createSignal(true)
|
||||||
|
const [showThinking, setShowThinking] = createSignal(true)
|
||||||
|
|
||||||
const wide = createMemo(() => dimensions().width > 120)
|
const wide = createMemo(() => dimensions().width > 120)
|
||||||
const sidebarVisible = createMemo(() => sidebar() === "show" || (sidebar() === "auto" && wide()))
|
const sidebarVisible = createMemo(() => sidebar() === "show" || (sidebar() === "auto" && wide()))
|
||||||
@@ -385,6 +387,15 @@ export function Session() {
|
|||||||
dialog.clear()
|
dialog.clear()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Toggle thinking blocks",
|
||||||
|
value: "session.toggle.thinking",
|
||||||
|
category: "Session",
|
||||||
|
onSelect: (dialog) => {
|
||||||
|
setShowThinking((prev) => !prev)
|
||||||
|
dialog.clear()
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "Page up",
|
title: "Page up",
|
||||||
value: "session.page.up",
|
value: "session.page.up",
|
||||||
@@ -674,6 +685,7 @@ export function Session() {
|
|||||||
return contentWidth()
|
return contentWidth()
|
||||||
},
|
},
|
||||||
conceal,
|
conceal,
|
||||||
|
showThinking,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<box flexDirection="row" paddingBottom={1} paddingTop={1} paddingLeft={2} paddingRight={2} gap={2}>
|
<box flexDirection="row" paddingBottom={1} paddingTop={1} paddingLeft={2} paddingRight={2} gap={2}>
|
||||||
@@ -1030,7 +1042,7 @@ function ReasoningPart(props: { last: boolean; part: ReasoningPart; message: Ass
|
|||||||
const ctx = use()
|
const ctx = use()
|
||||||
const content = createMemo(() => props.part.text.trim())
|
const content = createMemo(() => props.part.text.trim())
|
||||||
return (
|
return (
|
||||||
<Show when={content()}>
|
<Show when={content() && ctx.showThinking()}>
|
||||||
<box
|
<box
|
||||||
id={"text-" + props.part.id}
|
id={"text-" + props.part.id}
|
||||||
paddingLeft={2}
|
paddingLeft={2}
|
||||||
|
|||||||
Reference in New Issue
Block a user