fix: improve model display and session header layout

This commit is contained in:
Chris Scott committed 2025-11-25 09:52:08 -05:00
1 parent 8a56bc208d
commit d9ee1a67b7
2 files changed
+14 -9

No files matched your search

@@ -1,5 +1,5 @@
import { useState, useRef, useEffect, type KeyboardEvent } from 'react'
import { useSendPrompt, useAbortSession, useMessages, useSendShell } from '@/hooks/useOpenCode'
import { useSendPrompt, useAbortSession, useMessages, useSendShell, useConfig } from '@/hooks/useOpenCode'
import { useSettings } from '@/hooks/useSettings'
import { useCommands } from '@/hooks/useCommands'
import { useCommandHandler } from '@/hooks/useCommandHandler'
@@ -58,6 +58,7 @@ export function PromptInput({
const sendShell = useSendShell(opcodeUrl, directory)
const abortSession = useAbortSession(opcodeUrl, directory)
const { data: messages } = useMessages(opcodeUrl, sessionID, directory)
const { data: config } = useConfig(opcodeUrl)
const { preferences, updateSettings } = useSettings()
const { filterCommands } = useCommands(opcodeUrl)
const { executeCommand } = useCommandHandler({
@@ -370,10 +371,15 @@ export function PromptInput({
const hasActiveStream = messages?.some(msg => isMessageStreaming(msg)) || false
const currentMode = preferences?.mode || 'build'
const currentModel = preferences?.defaultModel || ''
const modeColor = currentMode === 'plan' ? 'text-yellow-600 dark:text-yellow-500' : 'text-green-600 dark:text-green-500'
const modeBg = currentMode === 'plan' ? 'bg-yellow-500/10 border-yellow-500/30' : 'bg-green-500/10 border-green-500/30'
const lastAssistantMessage = messages?.filter(msg => msg.info.role === 'assistant').pop()
const sessionModel = lastAssistantMessage?.info.role === 'assistant'
? `${lastAssistantMessage.info.providerID}/${lastAssistantMessage.info.modelID}`
: null
const currentModel = sessionModel || config?.model || ''
useEffect(() => {
const loadModelName = async () => {
if (currentModel) {
@@ -24,7 +24,6 @@ interface SessionDetailHeaderProps {
repoDirectory: string | undefined;
onFileBrowserOpen: () => void;
onSettingsOpen: () => void;
onShowModelsDialog?: () => void;
}
export function SessionDetailHeader({
@@ -68,12 +67,12 @@ export function SessionDetailHeader({
<p className="text-[10px] sm:text-xs text-muted-foreground truncate">
{repoName}
</p>
<BranchSwitcher
repoId={repoId}
currentBranch={currentBranch}
isWorktree={repo.isWorktree}
repoUrl={repo.repoUrl}
/>
<BranchSwitcher
repoId={repoId}
currentBranch={currentBranch}
isWorktree={repo.isWorktree}
repoUrl={repo.repoUrl}
/>
</div>
</div>
</div>