feat: rename 'model' to 'model_name'

This commit is contained in:
Henry Li
2026-01-16 14:03:34 +08:00
parent 1f03fb3749
commit faf80bb429
10 changed files with 147 additions and 89 deletions

View File

@@ -1,6 +1,6 @@
import * as React from "react"
import * as React from "react";
import { cn } from "@/lib/utils"
import { cn } from "@/lib/utils";
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
return (
@@ -11,11 +11,11 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
"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",
className
className,
)}
{...props}
/>
)
);
}
export { Input }
export { Input };

View File

@@ -1,5 +1,10 @@
import type { ChatStatus } from "ai";
import { CheckIcon, LightbulbIcon, LightbulbOffIcon } from "lucide-react";
import {
BoxIcon,
CheckIcon,
LightbulbIcon,
LightbulbOffIcon,
} from "lucide-react";
import { useCallback, useMemo, useState, type ComponentProps } from "react";
import {
@@ -20,10 +25,8 @@ import {
ModelSelectorInput,
ModelSelectorItem,
ModelSelectorList,
ModelSelectorLogo,
ModelSelectorName,
ModelSelectorTrigger,
type ModelSelectorLogoProps,
} from "../ai-elements/model-selector";
import { Tooltip } from "./tooltip";
@@ -56,14 +59,14 @@ export function InputBox({
}) {
const [modelDialogOpen, setModelDialogOpen] = useState(false);
const selectedModel = useMemo(
() => AVAILABLE_MODELS.find((m) => m.name === context.model),
[context.model],
() => AVAILABLE_MODELS.find((m) => m.name === context.model_name),
[context.model_name],
);
const handleModelSelect = useCallback(
(model: string) => {
(model_name: string) => {
onContextChange?.({
...context,
model,
model_name,
});
setModelDialogOpen(false);
},
@@ -140,13 +143,8 @@ export function InputBox({
>
<ModelSelectorTrigger asChild>
<PromptInputButton>
<ModelSelectorLogo
className="size-4"
provider={
selectedModel?.provider as ModelSelectorLogoProps["provider"]
}
/>
<ModelSelectorName>
<BoxIcon className="size-4" />
<ModelSelectorName className="font-light">
{selectedModel?.displayName}
</ModelSelectorName>
</PromptInputButton>
@@ -160,12 +158,8 @@ export function InputBox({
value={m.name}
onSelect={() => handleModelSelect(m.name)}
>
<ModelSelectorLogo
className="size-4"
provider={m.provider}
/>
<ModelSelectorName>{m.displayName}</ModelSelectorName>
{m.name === context.model ? (
{m.name === context.model_name ? (
<CheckIcon className="ml-auto size-4" />
) : (
<div className="ml-auto size-4" />

View File

@@ -20,7 +20,7 @@ import {
SidebarMenuButton,
SidebarMenuItem,
} from "@/components/ui/sidebar";
import { useDeleteThread, useThreads } from "@/core/api";
import { useDeleteThread, useThreads } from "@/core/threads/hooks";
import { pathOfThread, titleOfThread } from "@/core/threads/utils";
export function RecentChatList() {