Elffuss BraidHub

kikocis/continue public

main · 2.0 KiBRawPermalink
1import { ModelRole } from "@continuedev/config-yaml";
2import { Cog6ToothIcon } from "@heroicons/react/24/outline";
3import { ModelDescription } from "core";
4import { ReactNode } from "react";
5import { ToolTip } from "../../../components/gui/Tooltip";
6import { Button } from "../../../components/ui";
7import ModelRoleSelector from "./ModelRoleSelector";
8
9interface ModelRoleRowProps {
10 role: ModelRole;
11 displayName: string;
12 description: string | ReactNode;
13 models: ModelDescription[];
14 selectedModel: ModelDescription | undefined;
15 onSelect: (model: ModelDescription | null) => void;
16 onConfigure: (model: ModelDescription | null) => void;
17 setupURL: string;
18 shortcut?: ReactNode;
19}
20
21export function ModelRoleRow({
22 role,
23 displayName,
24 description,
25 models,
26 selectedModel,
27 onSelect,
28 onConfigure,
29 setupURL,
30 shortcut,
31}: ModelRoleRowProps) {
32 return (
33 <div className="py-6 first:pt-0 last:pb-0">
34 <div className="mb-2">
35 <div className="flex items-center gap-2">
36 <span className="text-base font-medium">{displayName}</span>
37 {shortcut && shortcut}
38 </div>
39 <p className="text-description mt-1 text-xs">{description}</p>
40 </div>
41 <div className="flex items-center gap-2">
42 <div className="flex-1">
43 <ModelRoleSelector
44 displayName={displayName}
45 description={description}
46 models={models}
47 selectedModel={selectedModel ?? null}
48 onSelect={onSelect}
49 setupURL={setupURL}
50 hideTitle={true}
51 />
52 </div>
53 {selectedModel && (
54 <ToolTip content="Configure">
55 <Button
56 variant="ghost"
57 size="sm"
58 onClick={() => onConfigure(selectedModel)}
59 className="text-description hover:enabled:text-foreground my-0 h-6 w-6 p-0"
60 >
61 <Cog6ToothIcon className="h-4 w-4 flex-shrink-0" />
62 </Button>
63 </ToolTip>
64 )}
65 </div>
66 </div>
67 );
68}