Skip to content

Commit 2093f98

Browse files
milispclaude
andcommitted
feat: improve chat UI with refresh functionality and better configuration
- Add refresh button to conversation tabs for reloading conversations - Extract history loading logic to reusable function in ChatView - Simplify config dialog by removing redundant model settings section - Comment out verbose debug logging in codex client - Improve command preview in config dialog to use current model settings 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 67c7f0f commit 2093f98

File tree

4 files changed

+56
-89
lines changed

4 files changed

+56
-89
lines changed

src-tauri/src/codex_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl CodexClient {
196196
while let Ok(Some(line)) = lines.next_line().await {
197197
log::debug!("Received line from codex: {}", line);
198198
if let Ok(event) = serde_json::from_str::<Event>(&line) {
199-
log::debug!("Parsed event: {:?}", event);
199+
// log::debug!("Parsed event: {:?}", event);
200200

201201
// Log the event for debugging
202202
if let Some(event_session_id) = get_session_id_from_event(&event) {

src/components/ChatView.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,24 @@ export const ChatView: React.FC = () => {
5757
}
5858
}, [currentConversationId, activeConversations]);
5959

60-
useEffect(() => {
61-
const loadHistory = async () => {
62-
try {
63-
const history = await sessionLoader.loadSessionsFromDisk();
64-
setHistoryConversations(history);
65-
66-
const statuses: Record<string, boolean> = {};
67-
for (const conv of history) {
68-
statuses[conv.id] = await sessionLoader.isConversationFavorited(
69-
conv.id,
70-
);
71-
}
72-
setFavoriteStatuses(statuses);
73-
} catch (error) {
74-
console.error("Failed to load history conversations:", error);
60+
const loadHistory = async () => {
61+
try {
62+
const history = await sessionLoader.loadSessionsFromDisk();
63+
setHistoryConversations(history);
64+
65+
const statuses: Record<string, boolean> = {};
66+
for (const conv of history) {
67+
statuses[conv.id] = await sessionLoader.isConversationFavorited(
68+
conv.id,
69+
);
7570
}
76-
};
71+
setFavoriteStatuses(statuses);
72+
} catch (error) {
73+
console.error("Failed to load history conversations:", error);
74+
}
75+
};
7776

77+
useEffect(() => {
7878
loadHistory();
7979
}, []);
8080

@@ -206,6 +206,7 @@ export const ChatView: React.FC = () => {
206206
onDeleteConversation={handleDeleteConversation}
207207
onSelectSession={handleSelectSession}
208208
onKillSession={handleKillSession}
209+
onRefreshConversations={loadHistory}
209210
/>
210211
</div>
211212
</div>

src/components/chat/ConversationTabs.tsx

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
22
import { ConversationList } from "./ConversationList";
33
import { Button } from "@/components/ui/button";
44
import { Input } from "@/components/ui/input";
5-
import { Circle, X, Search } from "lucide-react";
5+
import { Circle, X, Search, RefreshCw } from "lucide-react";
66
import { useLayoutStore } from "@/stores/layoutStore";
77
import type { Conversation } from "@/types/chat";
88
import React, { useMemo } from "react";
@@ -26,6 +26,7 @@ interface ChatTabsProps {
2626
onDeleteConversation: (conversationId: string, e: React.MouseEvent) => void;
2727
onSelectSession?: (sessionId: string) => void;
2828
onKillSession?: (sessionId: string) => void;
29+
onRefreshConversations?: () => void;
2930
}
3031

3132
export function ConversationTabs({
@@ -40,6 +41,7 @@ export function ConversationTabs({
4041
onToggleFavorite,
4142
onDeleteConversation,
4243
onKillSession,
44+
onRefreshConversations,
4345
}: ChatTabsProps) {
4446
const { conversationListTab, setConversationListTab } = useLayoutStore();
4547

@@ -159,14 +161,25 @@ export function ConversationTabs({
159161

160162
<TabsContent value="all" className="flex-1 overflow-y-auto mt-0">
161163
<div className="p-3 bg-white border-b">
162-
<div className="relative">
163-
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 h-3 w-3 text-gray-400" />
164-
<Input
165-
placeholder="Search all conversations..."
166-
value={searchQueries.all}
167-
onChange={(e) => handleSearchChange(e.target.value)}
168-
className="pl-8 h-8 text-sm"
169-
/>
164+
<div className="flex gap-2">
165+
<div className="relative flex-1">
166+
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 h-3 w-3 text-gray-400" />
167+
<Input
168+
placeholder="Search all conversations..."
169+
value={searchQueries.all}
170+
onChange={(e) => handleSearchChange(e.target.value)}
171+
className="pl-8 h-8 text-sm"
172+
/>
173+
</div>
174+
<Button
175+
variant="ghost"
176+
size="sm"
177+
className="h-8 w-8 p-0"
178+
onClick={onRefreshConversations}
179+
title="Refresh conversations"
180+
>
181+
<RefreshCw className="h-3 w-3" />
182+
</Button>
170183
</div>
171184
</div>
172185
<ConversationList

src/components/dialogs/ConfigDialog.tsx

Lines changed: 16 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
DialogTitle,
1313
} from "@/components/ui/dialog"
1414
import { useFolderStore } from "@/stores/FolderStore";
15+
import { useModelStore } from "@/stores/ModelStore";
16+
import { useSettingsStore } from "@/stores/SettingsStore";
1517

1618
interface ConfigDialogProps {
1719
isOpen: boolean;
@@ -27,6 +29,8 @@ export const ConfigDialog: React.FC<ConfigDialogProps> = ({
2729
onSave,
2830
}) => {
2931
const { currentFolder, setCurrentFolder } = useFolderStore();
32+
const { currentModel, currentProvider } = useModelStore();
33+
const { providers } = useSettingsStore();
3034
const [localConfig, setLocalConfig] = useState<CodexConfig>({
3135
...config,
3236
workingDirectory: currentFolder || config.workingDirectory
@@ -148,67 +152,6 @@ export const ConfigDialog: React.FC<ConfigDialogProps> = ({
148152
</p>
149153
</div>
150154

151-
{/* Model Configuration */}
152-
<div className="space-y-4">
153-
<h3 className="text-lg font-medium">Model Settings</h3>
154-
155-
{/* Provider */}
156-
<div className="space-y-2">
157-
<label className="text-sm font-medium">Provider</label>
158-
<div className="flex gap-2">
159-
{['openai', 'oss', 'custom'].map((provider) => (
160-
<Button
161-
key={provider}
162-
variant={localConfig.provider === provider ? 'default' : 'outline'}
163-
size="sm"
164-
onClick={() => updateConfig('provider', provider)}
165-
>
166-
{provider.toUpperCase()}
167-
</Button>
168-
))}
169-
</div>
170-
</div>
171-
172-
{/* Use OSS */}
173-
<div className="flex items-center gap-2">
174-
<input
175-
type="checkbox"
176-
id="useOss"
177-
checked={localConfig.useOss}
178-
onChange={(e) => updateConfig('useOss', e.target.checked)}
179-
className="rounded"
180-
/>
181-
<label htmlFor="useOss" className="text-sm font-medium">
182-
Use OSS (--oss flag)
183-
</label>
184-
</div>
185-
186-
{/* Model */}
187-
<div className="space-y-2">
188-
<label className="text-sm font-medium">Model</label>
189-
<Input
190-
value={localConfig.model}
191-
onChange={(e) => updateConfig('model', e.target.value)}
192-
placeholder="llama3.2, gpt-5, etc."
193-
/>
194-
<div className="flex gap-2 mt-2">
195-
{['gpt-oss:20b', 'gpt-5', 'gpt-4o', 'mistral', 'deepseek-r1', 'qwen3'].map((m) => (
196-
<Button
197-
key={m}
198-
variant="outline"
199-
size="sm"
200-
onClick={() => updateConfig('model', m)}
201-
>
202-
{m}
203-
</Button>
204-
))}
205-
</div>
206-
<p className="text-xs text-gray-500">
207-
Model name (e.g., llama3.2 for OSS, gpt-4 for OpenAI)
208-
</p>
209-
</div>
210-
</div>
211-
212155
{/* Security Settings */}
213156
<div className="space-y-4">
214157
<h3 className="text-lg font-medium">Security Settings</h3>
@@ -275,8 +218,18 @@ export const ConfigDialog: React.FC<ConfigDialogProps> = ({
275218
<label className="text-sm font-medium">Command Preview</label>
276219
<div className="bg-gray-100 p-3 rounded text-sm font-mono">
277220
cd {localConfig.workingDirectory || '.'} && {localConfig.codexPath || 'codex'} proto
278-
{localConfig.useOss && ' -c model_provider=oss'}
279-
{localConfig.model && ` -c model=${localConfig.model}`}
221+
{currentProvider && currentModel && (
222+
<>
223+
{(() => {
224+
const settingsProvider = Object.keys(providers).find(
225+
p => p.toLowerCase() === currentProvider.toLowerCase()
226+
);
227+
const useOss = settingsProvider && settingsProvider.toLowerCase() === 'ollama';
228+
return useOss ? ' -c model_provider=oss' : '';
229+
})()}
230+
{` -c model=${currentModel}`}
231+
</>
232+
)}
280233
{localConfig.approvalPolicy && ` -c approval_policy=${localConfig.approvalPolicy}`}
281234
{localConfig.sandboxMode && ` -c sandbox_mode=${localConfig.sandboxMode}`}
282235
{localConfig.customArgs && localConfig.customArgs.length > 0 && ` ${localConfig.customArgs.join(' ')}`}

0 commit comments

Comments
 (0)