Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"framer-motion": "^12.16.0",
"input-otp": "^1.4.2",
"lucide-react": "^0.514.0",
"next": "^15.2.3",
"next-auth": "5.0.0-beta.25",
Expand Down Expand Up @@ -1012,6 +1013,8 @@

"inline-style-parser": ["inline-style-parser@0.2.4", "", {}, "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q=="],

"input-otp": ["input-otp@1.4.2", "", { "peerDependencies": { "react": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc" } }, "sha512-l3jWwYNvrEa6NTCt7BECfCm48GvwuZzkoeG3gBL2w4CHeOXW3eKFmf9UNYkNfYc3mxMrthMnxjIE07MT0zLBQA=="],

"internal-slot": ["internal-slot@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "hasown": "^2.0.2", "side-channel": "^1.1.0" } }, "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw=="],

"internmap": ["internmap@2.0.3", "", {}, "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg=="],
Expand Down
5 changes: 4 additions & 1 deletion frontend/components/ui/model-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ export function ModelSelector({
if (onValueChange) {
onValueChange(newValue);
}
if (typeof window !== "undefined") {
window.localStorage.setItem("model", newValue);
}
};

const selectedModelObj = getModelById(selectedModel);

const getModelStatusIcon = (model: Model) => {
Expand Down
19 changes: 15 additions & 4 deletions frontend/components/ui/ui-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ import remarkGfm from "remark-gfm";
import { Geist_Mono } from "next/font/google";
import { cn } from "@/lib/utils";
import TabsSuggestion from "./tabs-suggestion";
import { ModelSelector } from "@/components/ui/model-selector";
import { DEFAULT_MODEL_ID } from "@/models/constants";
import dynamic from "next/dynamic";
const ModelSelectorNoSSR = dynamic(
() => import("@/components/ui/model-selector").then((m) => m.ModelSelector),
{ ssr: false }
);
import { DEFAULT_MODEL_ID, getModelById } from "@/models/constants";
import { useTheme } from "next-themes";
import { ArrowUpIcon, WrapText } from "lucide-react";
import { atomOneDark } from "react-syntax-highlighter/dist/esm/styles/hljs";
Expand Down Expand Up @@ -54,7 +58,14 @@ interface UIInputProps {
const UIInput = ({
conversationId: initialConversationId,
}: UIInputProps = {}) => {
const [model, setModel] = useState<string>(DEFAULT_MODEL_ID);
const [model, setModel] = useState<string>(() => {
if (typeof window === "undefined") return DEFAULT_MODEL_ID;
const stored = window.localStorage.getItem("model");
if (stored) {
return stored;
}
return DEFAULT_MODEL_ID;
});
const [query, setQuery] = useState<string>("");
const [messages, setMessages] = useState<Message[]>([]);
const [showWelcome, setShowWelcome] = useState(true);
Expand Down Expand Up @@ -587,7 +598,7 @@ const UIInput = ({
/>
<div className="mt-2 flex items-center justify-between">
<div className="flex items-center gap-2">
<ModelSelector
<ModelSelectorNoSSR
value={model}
onValueChange={setModel}
disabled={
Expand Down