Skip to content

Commit d14a22b

Browse files
committed
style: UI and UX touches
1 parent 5e93dae commit d14a22b

6 files changed

Lines changed: 63 additions & 9 deletions

File tree

‎frontend/src/components/ai-elements/thoughts-tools-group.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useEffect, useMemo, useRef, useState } from "react";
2-
import { BrainIcon, WrenchIcon, ClockIcon } from "lucide-react";
2+
import { BrainIcon, ClockIcon } from "lucide-react";
3+
import { getToolIcon } from "@/lib/toolIcons";
34
import {
45
Reasoning,
56
ReasoningContent,
@@ -163,10 +164,12 @@ const ToolSummaryIcon = ({
163164
setImageError(false);
164165
}, [mcpUrl]);
165166

167+
const ToolIcon = getToolIcon(toolCall.name);
168+
166169
if (!faviconUrl) {
167170
return (
168171
<span className={ICON_CHIP_CLASS} aria-hidden="true">
169-
<WrenchIcon className="size-3 text-muted-foreground" />
172+
<ToolIcon className="size-3 text-muted-foreground" />
170173
</span>
171174
);
172175
}

‎frontend/src/components/ai-elements/tool.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import {
55
ChevronDownIcon,
66
CircleIcon,
77
ClockIcon,
8-
WrenchIcon,
98
XCircleIcon,
109
CheckIcon,
1110
XIcon,
1211
} from "lucide-react";
12+
import { getToolIcon } from "@/lib/toolIcons";
1313
import {
1414
type ComponentProps,
1515
type ReactNode,
@@ -94,6 +94,10 @@ export const ToolHeader = ({
9494
setImageError(false);
9595
}, [mcpUrl]);
9696

97+
// Extract tool name from "tool-<name>" format for built-in icon lookup
98+
const toolName = type.startsWith("tool-") ? type.slice(5) : type;
99+
const ToolIcon = getToolIcon(toolName);
100+
97101
let faviconUrl: string | null = null;
98102
if (mcpUrl && !imageError) {
99103
try {
@@ -128,7 +132,7 @@ export const ToolHeader = ({
128132
alt="icon"
129133
/>
130134
) : (
131-
<WrenchIcon className="size-4 text-muted-foreground" />
135+
<ToolIcon className="size-4 text-muted-foreground" />
132136
)}
133137
<span className="font-sm text-muted-foreground text-sm">{type}</span>
134138
{getStatusBadge(state)}

‎frontend/src/components/file-manager/FileManagerDialog.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ export function FileManagerDialog({
225225
console.error("OCR extraction failed:", error);
226226
} finally {
227227
setExtracting(false);
228-
setSelectedFileIds(new Set());
229228
}
230229
};
231230

‎frontend/src/components/settings/ToolsSection.tsx‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,28 @@ export const ToolsSection: React.FC = () => {
3535

3636
const parentRef = useRef<HTMLDivElement>(null);
3737

38+
const mcpNameById = useMemo(() => {
39+
const map: Record<string, string> = {};
40+
data.mcpServers.forEach((s) => {
41+
map[s.id] = s.name;
42+
});
43+
return map;
44+
}, [data.mcpServers]);
45+
3846
const filtered = useMemo(() => {
3947
if (!search.trim()) return data.tools;
4048
const q = search.toLowerCase();
4149
return data.tools.filter(
4250
(t) =>
4351
t.name.toLowerCase().includes(q) ||
4452
(t.description && t.description.toLowerCase().includes(q)) ||
45-
(t.mcp_server_id && t.mcp_server_id.toLowerCase().includes(q)),
53+
(t.mcp_server_id && t.mcp_server_id.toLowerCase().includes(q)) ||
54+
(t.mcp_server_id &&
55+
(mcpNameById[t.mcp_server_id] || "")
56+
.toLowerCase()
57+
.includes(q)),
4658
);
47-
}, [data.tools, search]);
59+
}, [data.tools, search, mcpNameById]);
4860

4961
const enabledInFiltered = filtered.filter((t) => t.is_enabled).length;
5062
const approvalRequiredInFiltered = filtered.filter(
@@ -305,7 +317,7 @@ export const ToolsSection: React.FC = () => {
305317
)}
306318
{tool.mcp_server_id && (
307319
<div className="text-[10px] text-muted-foreground/70 truncate max-w-[200px] sm:max-w-[300px]">
308-
MCP: {tool.mcp_server_id}
320+
{mcpNameById[tool.mcp_server_id] || tool.mcp_server_id}
309321
</div>
310322
)}
311323
</div>

‎frontend/src/components/ui/button.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority";
55
import { cn } from "@/lib/utils";
66

77
const buttonVariants = cva(
8-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
8+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm transition-all select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
99
{
1010
variants: {
1111
variant: {

‎frontend/src/lib/toolIcons.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import {
2+
WrenchIcon,
3+
SearchIcon,
4+
ListIcon,
5+
FileCodeIcon,
6+
FilePlusIcon,
7+
FileEditIcon,
8+
FileXIcon,
9+
ImageIcon,
10+
type LucideIcon,
11+
BookIcon,
12+
CloudIcon,
13+
Scan,
14+
} from "lucide-react";
15+
16+
/**
17+
* Maps built-in tool names to lucide-react icons.
18+
* Falls back to WrenchIcon for unknown / MCP tools.
19+
*/
20+
const BUILT_IN_TOOL_ICONS: Record<string, LucideIcon> = {
21+
search_ddgs: SearchIcon,
22+
get_weather: CloudIcon,
23+
search_document: SearchIcon,
24+
read_document_page: BookIcon,
25+
view_document_page: Scan,
26+
list_document_parts: ListIcon,
27+
read_document_part: FileCodeIcon,
28+
create_document: FilePlusIcon,
29+
write_document_part: FileEditIcon,
30+
delete_document_part: FileXIcon,
31+
generate_image: ImageIcon,
32+
};
33+
34+
export const getToolIcon = (toolName: string): LucideIcon => {
35+
return BUILT_IN_TOOL_ICONS[toolName] ?? WrenchIcon;
36+
};

0 commit comments

Comments
 (0)