diff --git a/src/components/Layouts/Header.tsx b/src/components/Layouts/Header.tsx index 7f3e153..3e4a1f6 100644 --- a/src/components/Layouts/Header.tsx +++ b/src/components/Layouts/Header.tsx @@ -22,6 +22,7 @@ import { getAllPrompts } from "@/db" import { ShareBtn } from "~/components/Common/ShareBtn" import { ProviderIcons } from "../Common/ProviderIcon" import { NewChat } from "./NewChat" +import { PageAssistSelect } from "../Select" type Props = { setSidebarOpen: (open: boolean) => void setOpenModelSettings: (open: boolean) => void @@ -49,14 +50,10 @@ export const Header: React.FC = ({ historyId, temporaryChat } = useMessageOption() - const { - data: models, - isLoading: isModelsLoading, - } = useQuery({ + const { data: models, isLoading: isModelsLoading, refetch } = useQuery({ queryKey: ["fetchModel"], queryFn: () => fetchChatModels({ returnEmpty: true }), - refetchInterval: 15_000, - refetchIntervalInBackground: true, + refetchIntervalInBackground: false, placeholderData: (prev) => prev }) @@ -87,9 +84,10 @@ export const Header: React.FC = ({ } return ( -
+
{pathname !== "/" && (
@@ -107,41 +105,38 @@ export const Header: React.FC = ({
- + {"/"}
- setSearchTerm(e.target.value)} + placeholder="Search..." + className={`${defaultSearchClass} ${searchClassName}`} + disabled={isLoading} + aria-label="Search options" + /> +
+
+ +
+ {isLoading ? ( +
+ + {loadingText} +
+ ) : filteredOptions.length === 0 ? ( +
+ +
+ ) : ( + filteredOptions.map((option, index) => ( +
{ + onChange(option) + setIsOpen(false) + setSearchTerm("") + }} + className={` + ${defaultOptionClass} + ${value === option.value ? "bg-blue-50 dark:bg-[#262627]" : "hover:bg-gray-100 dark:hover:bg-[#272728]"} + ${activeIndex === index ? "bg-gray-100 dark:bg-[#272728]" : ""} + ${optionClassName}`}> + {option.label} +
+ )) + )} +
+
+ )} +
+ ) +} \ No newline at end of file