Skip to content

Commit 792f6eb

Browse files
committed
fix(model-selector): update chat model display logic and replace icon for manage models button
1 parent e38c569 commit 792f6eb

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

surfsense_web/components/new-chat/model-selector.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { useAtom, useAtomValue } from "jotai";
4-
import { Check, ChevronDown, Search, Settings2 } from "lucide-react";
4+
import { Check, ChevronDown, Search, SlidersHorizontal } from "lucide-react";
55
import { useRouter } from "next/navigation";
66
import type { UIEvent } from "react";
77
import { useCallback, useMemo, useState } from "react";
@@ -130,6 +130,7 @@ export function ModelSelector({
130130
const selected = chatModelsById.get(selectedModelId);
131131
const groups = useMemo(() => groupedModels(visibleChatModels), [visibleChatModels]);
132132
const loading = globalLoading || connectionsLoading;
133+
const hasSearchQuery = search.trim().length > 0;
133134

134135
function handleOpenChange(nextOpen: boolean) {
135136
if (!nextOpen) setSearch("");
@@ -197,7 +198,9 @@ export function ModelSelector({
197198
</div>
198199
) : Object.keys(groups).length === 0 ? (
199200
<div className="px-3 py-8 text-center text-sm text-muted-foreground">
200-
No enabled chat models. Add or enable models in Settings.
201+
{hasSearchQuery
202+
? "No matching chat models."
203+
: "No enabled chat models. Add or enable models in Settings."}
201204
</div>
202205
) : (
203206
Object.entries(groups).map(([connection, models]) => (
@@ -257,7 +260,7 @@ export function ModelSelector({
257260
className="w-full justify-start rounded-md bg-foreground/5 hover:bg-foreground/10 hover:text-foreground"
258261
onClick={manageModelConnections}
259262
>
260-
<Settings2 className="mr-2 h-4 w-4" /> Manage models
263+
<SlidersHorizontal className="h-4 w-4" /> Manage models
261264
</Button>
262265
</div>
263266
</div>
@@ -304,7 +307,10 @@ export function ModelSelector({
304307
return (
305308
<Popover open={open} onOpenChange={handleOpenChange}>
306309
<PopoverTrigger asChild>{trigger}</PopoverTrigger>
307-
<PopoverContent align="start" className="w-[340px] p-0">
310+
<PopoverContent
311+
align="start"
312+
className="w-[340px] border border-popover-border bg-popover p-0 text-popover-foreground shadow-md"
313+
>
308314
{content}
309315
</PopoverContent>
310316
</Popover>

0 commit comments

Comments
 (0)