Home / File/ model-selector.tsx — ui Source File

model-selector.tsx — ui Source File

Architecture documentation for model-selector.tsx, a tsx file in the ui codebase. 11 imports, 1 dependents.

File tsx ApplicationExhibition PlaygroundAI 11 imports 1 dependents 3 functions

Entity Profile

Dependency Diagram

graph LR
  2675e614_cc7d_cd7d_6072_fe38d59c01af["model-selector.tsx"]
  95860729_4c34_7779_cac3_87c1c89cd6f0["models.ts"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> 95860729_4c34_7779_cac3_87c1c89cd6f0
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3["lucide-react"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3
  9c463da6_747b_38dc_586b_cbb4873070b1["radix-ui"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> 9c463da6_747b_38dc_586b_cbb4873070b1
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  9314e41b_b7ea_95cf_6b0c_62b297b3ebf4["use-mutation-observer"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> 9314e41b_b7ea_95cf_6b0c_62b297b3ebf4
  57e86e45_ac6e_7278_be08_9092724e8401["button"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> 57e86e45_ac6e_7278_be08_9092724e8401
  ea5fe791_bf71_2e59_8da4_433dcd06ee7b["command"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> ea5fe791_bf71_2e59_8da4_433dcd06ee7b
  951c1a95_84b7_603d_3cc1_d98bfa6cfc50["hover-card"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> 951c1a95_84b7_603d_3cc1_d98bfa6cfc50
  d752035b_6ed3_c6ef_e27c_eef51af9ec8d["label"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> d752035b_6ed3_c6ef_e27c_eef51af9ec8d
  64a3481c_a85b_fe79_409a_cb7f3f4bb871["popover"]
  2675e614_cc7d_cd7d_6072_fe38d59c01af --> 64a3481c_a85b_fe79_409a_cb7f3f4bb871
  5ee45142_aa10_ca73_456e_5946db3e53c3["page.tsx"]
  5ee45142_aa10_ca73_456e_5946db3e53c3 --> 2675e614_cc7d_cd7d_6072_fe38d59c01af
  style 2675e614_cc7d_cd7d_6072_fe38d59c01af fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { Check, ChevronsUpDown } from "lucide-react"
import type { Popover as PopoverPrimitive } from "radix-ui"

import { cn } from "@/lib/utils"
import { useMutationObserver } from "@/hooks/use-mutation-observer"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
} from "@/registry/new-york-v4/ui/command"
import {
  HoverCard,
  HoverCardContent,
  HoverCardTrigger,
} from "@/registry/new-york-v4/ui/hover-card"
import { Label } from "@/registry/new-york-v4/ui/label"
import {
  Popover,
  PopoverContent,
  PopoverTrigger,
} from "@/registry/new-york-v4/ui/popover"

import { type Model, type ModelType } from "../data/models"

interface ModelSelectorProps
  extends React.ComponentProps<typeof PopoverPrimitive.Root> {
  types: readonly ModelType[]
  models: Model[]
}

export function ModelSelector({ models, types, ...props }: ModelSelectorProps) {
  const [open, setOpen] = React.useState(false)
  const [selectedModel, setSelectedModel] = React.useState<Model>(models[0])
  const [peekedModel, setPeekedModel] = React.useState<Model>(models[0])

  return (
    <div className="grid gap-3">
      <HoverCard openDelay={200}>
        <HoverCardTrigger asChild>
          <Label htmlFor="model">Model</Label>
        </HoverCardTrigger>
        <HoverCardContent
          align="start"
          className="w-[260px] text-sm"
          side="left"
        >
          The model which will generate the completion. Some models are suitable
          for natural language tasks, others specialize in code. Learn more.
        </HoverCardContent>
      </HoverCard>
      <Popover open={open} onOpenChange={setOpen} {...props}>
        <PopoverTrigger asChild>
          <Button
// ... (104 more lines)

Subdomains

Dependencies

  • button
  • command
  • hover-card
  • label
  • lucide-react
  • models.ts
  • popover
  • radix-ui
  • react
  • use-mutation-observer
  • utils

Frequently Asked Questions

What does model-selector.tsx do?
model-selector.tsx is a source file in the ui codebase, written in tsx. It belongs to the ApplicationExhibition domain, PlaygroundAI subdomain.
What functions are defined in model-selector.tsx?
model-selector.tsx defines 3 function(s): ModelItem, ModelSelector, model.
What does model-selector.tsx depend on?
model-selector.tsx imports 11 module(s): button, command, hover-card, label, lucide-react, models.ts, popover, radix-ui, and 3 more.
What files import model-selector.tsx?
model-selector.tsx is imported by 1 file(s): page.tsx.
Where is model-selector.tsx in the architecture?
model-selector.tsx is located at apps/v4/app/(app)/examples/playground/components/model-selector.tsx (domain: ApplicationExhibition, subdomain: PlaygroundAI, directory: apps/v4/app/(app)/examples/playground/components).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free