Implement toggle thinking blocks with localStorage persistence
- Add preferences store to manage user preferences in localStorage - Toggle thinking blocks visibility via command palette (default: hidden) - Dynamic command label shows current state (Show/Hide Thinking Blocks) - Filter reasoning parts based on preference in message-stream - Conditionally render reasoning parts in message-part component - Support function labels in Command interface for dynamic text
This commit is contained in:
@@ -8,7 +8,7 @@ export interface KeyboardShortcut {
|
||||
|
||||
export interface Command {
|
||||
id: string
|
||||
label: string
|
||||
label: string | (() => string)
|
||||
description: string
|
||||
keywords?: string[]
|
||||
shortcut?: KeyboardShortcut
|
||||
@@ -47,7 +47,8 @@ export function createCommandRegistry() {
|
||||
|
||||
const lowerQuery = query.toLowerCase()
|
||||
return getAll().filter((cmd) => {
|
||||
const labelMatch = cmd.label.toLowerCase().includes(lowerQuery)
|
||||
const label = typeof cmd.label === "function" ? cmd.label() : cmd.label
|
||||
const labelMatch = label.toLowerCase().includes(lowerQuery)
|
||||
const descMatch = cmd.description.toLowerCase().includes(lowerQuery)
|
||||
const keywordMatch = cmd.keywords?.some((k) => k.toLowerCase().includes(lowerQuery))
|
||||
return labelMatch || descMatch || keywordMatch
|
||||
|
||||
Reference in New Issue
Block a user