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:
@@ -34,7 +34,8 @@ const CommandPalette: Component<CommandPaletteProps> = (props) => {
|
||||
if (!q) return props.commands
|
||||
|
||||
return props.commands.filter((cmd) => {
|
||||
const labelMatch = cmd.label.toLowerCase().includes(q)
|
||||
const label = typeof cmd.label === "function" ? cmd.label() : cmd.label
|
||||
const labelMatch = label.toLowerCase().includes(q)
|
||||
const descMatch = cmd.description.toLowerCase().includes(q)
|
||||
const keywordMatch = cmd.keywords?.some((k) => k.toLowerCase().includes(q))
|
||||
const categoryMatch = cmd.category?.toLowerCase().includes(q)
|
||||
@@ -190,7 +191,9 @@ const CommandPalette: Component<CommandPaletteProps> = (props) => {
|
||||
onMouseEnter={() => setSelectedIndex(commandIndex)}
|
||||
>
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="font-medium text-gray-900 dark:text-gray-100">{command.label}</div>
|
||||
<div class="font-medium text-gray-900 dark:text-gray-100">
|
||||
{typeof command.label === "function" ? command.label() : command.label}
|
||||
</div>
|
||||
<div class="text-sm text-gray-600 dark:text-gray-400 mt-0.5">
|
||||
{command.description}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user