mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(frontend): add simple chat mode (#190)
* loop: simple-chat-mode completed after 1 iterations * feat(frontend): add simple chat mode for user messages and clean up redundant optimistic filtering * refactor(frontend): consolidate status indicators and simplify simple chat mode - Merge MiniScanner and CompactStatusIndicator into SessionStatusIndicator with size and showLabel props - Hide step-finish cost/token display in simpleChatMode - Update SessionCard and PromptInput to use unified SessionStatusIndicator - Add tests for step-finish rendering in simpleChatMode
This commit is contained in:
1 parent
b61a3c83d1
commit
adf77516e5
12 files changed
+493
-221
No files matched your search
@@ -7,6 +7,7 @@ import { ToolCallPart } from './ToolCallPart'
|
||||
import { RetryPart } from './RetryPart'
|
||||
import { useTTS } from '@/hooks/useTTS'
|
||||
import { useMobile } from '@/hooks/useMobile'
|
||||
import { useSettings } from '@/hooks/useSettings'
|
||||
import { CopyButton } from '@/components/ui/copy-button'
|
||||
|
||||
type RetryPartType = components['schemas']['RetryPart']
|
||||
@@ -100,6 +101,9 @@ function TTSButton({ messageId, content, className = "" }: TTSButtonProps) {
|
||||
}
|
||||
|
||||
export const MessagePart = memo(function MessagePart({ part, role, allParts, partIndex, onFileClick, onChildSessionClick, messageTextContent }: MessagePartProps) {
|
||||
const { preferences } = useSettings()
|
||||
const simpleChatMode = preferences?.simpleChatMode ?? false
|
||||
const showReasoning = preferences?.showReasoning ?? false
|
||||
const copyableContent = getCopyableContent(part, allParts)
|
||||
const isMobile = useMobile()
|
||||
|
||||
@@ -113,10 +117,13 @@ export const MessagePart = memo(function MessagePart({ part, role, allParts, par
|
||||
}
|
||||
return <TextPart part={part} />
|
||||
case 'patch':
|
||||
if (simpleChatMode) return null
|
||||
return <PatchPart part={part} onFileClick={onFileClick} />
|
||||
case 'tool':
|
||||
if (simpleChatMode) return null
|
||||
return <ToolCallPart part={part} onFileClick={onFileClick} onChildSessionClick={onChildSessionClick} />
|
||||
case 'reasoning':
|
||||
if (simpleChatMode || !showReasoning) return null
|
||||
return (
|
||||
<details className="border border-border rounded-lg my-2">
|
||||
<summary className="px-4 py-2 bg-muted hover:bg-accent cursor-pointer text-sm font-medium">
|
||||
@@ -128,29 +135,33 @@ export const MessagePart = memo(function MessagePart({ part, role, allParts, par
|
||||
</details>
|
||||
)
|
||||
case 'snapshot':
|
||||
if (simpleChatMode) return null
|
||||
return (
|
||||
<div className="border border-border rounded-lg p-4 my-2 bg-card">
|
||||
<div className="text-xs text-muted-foreground font-mono">Snapshot: {part.snapshot}</div>
|
||||
</div>
|
||||
)
|
||||
case 'agent':
|
||||
if (simpleChatMode) return null
|
||||
return (
|
||||
<div className="border border-border rounded-lg p-4 my-2 bg-card">
|
||||
<div className="text-sm font-medium text-blue-600 dark:text-blue-400">Agent: {part.name}</div>
|
||||
</div>
|
||||
)
|
||||
case 'step-finish': {
|
||||
const isFree = part.cost === 0
|
||||
const totalTokens = part.tokens.input + part.tokens.output + (part.tokens.cache?.read || 0)
|
||||
const costText = isMobile && isFree ? null : <span>${part.cost.toFixed(4)} • {totalTokens} tokens</span>
|
||||
return (
|
||||
<div className="text-xs text-muted-foreground my-1 flex items-center gap-2">
|
||||
{costText}
|
||||
<CopyButton content={copyableContent} title="Copy step complete" />
|
||||
{messageTextContent && part.messageID && <TTSButton messageId={part.messageID} content={messageTextContent} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
case 'step-finish':
|
||||
if (simpleChatMode) return null
|
||||
{
|
||||
const isFree = part.cost === 0
|
||||
const totalTokens = part.tokens.input + part.tokens.output + (part.tokens.cache?.read || 0)
|
||||
const costText = isMobile && isFree ? null : <span>${part.cost.toFixed(4)} • {totalTokens} tokens</span>
|
||||
return (
|
||||
<div className="text-xs text-muted-foreground my-1 flex items-center gap-2">
|
||||
{costText}
|
||||
<CopyButton content={copyableContent} title="Copy step complete" />
|
||||
{messageTextContent && part.messageID && <TTSButton messageId={part.messageID} content={messageTextContent} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
case 'file':
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1 px-2 py-1 rounded bg-muted border border-border text-sm text-foreground">
|
||||
|
||||
Reference in new issue
Block a user