-
Notifications
You must be signed in to change notification settings - Fork 9
🚀 Feat: Model selection + tests #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nicofretti
merged 22 commits into
nicofretti:develop
from
LedjoLleshaj:feature-model-selection
Feb 2, 2026
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
0f563f8
🚀 Feature: add database support for default models
LedjoLleshaj 623648e
🚀 Feature: expose default model selection endpoints
LedjoLleshaj 01e748a
🚀 Feature: UI for default model selection
LedjoLleshaj 2fe7bab
test: integration tests for default model selection
LedjoLleshaj 111aef6
📚 Docs: updated files inside llm/
LedjoLleshaj e6de5d2
🧩 Fix: default model selection and implement auto-default logic
LedjoLleshaj d24ea7f
📐 Refactor: ran make format and pre-merge
LedjoLleshaj a0219c5
🚀 Feature: add database support for default models
LedjoLleshaj 43ca5bc
🚀 Feature: expose default model selection endpoints
LedjoLleshaj 07b537c
🚀 Feature: UI for default model selection
LedjoLleshaj a2ac623
test: integration tests for default model selection
LedjoLleshaj b4505ab
📚 Docs: updated files inside llm/
LedjoLleshaj 0c1ce1c
🧩 Fix: default model selection and implement auto-default logic
LedjoLleshaj ffead9f
📐 Refactor: ran make format and pre-merge
LedjoLleshaj e304733
Merge branch 'feature-model-selection' of https://github.com/LedjoLle…
LedjoLleshaj 4170eb4
unit tests and small format fixes
LedjoLleshaj 980f549
UI fixes
LedjoLleshaj 181f8d7
fix coderabbit suggestions
LedjoLleshaj 4b1d483
📐 Refactor: Model Card
LedjoLleshaj e2ea5ce
fix coderabbit suggestions
LedjoLleshaj 1a7d4ae
last coderabbit fixes
LedjoLleshaj 23f258d
Merge branch 'develop' into feature-model-selection
nicofretti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| import type { ReactNode } from "react"; | ||
| import { Box, Text, Button, IconButton, Spinner, Tooltip } from "@primer/react"; | ||
| import { | ||
| TrashIcon, | ||
| PencilIcon, | ||
| CheckCircleIcon, | ||
| CheckCircleFillIcon, | ||
| StarIcon, | ||
| } from "@primer/octicons-react"; | ||
| import type { LLMModelConfig, EmbeddingModelConfig } from "../../types"; | ||
|
|
||
| interface ModelCardStatus { | ||
| isDefault: boolean; | ||
| isTesting: boolean; | ||
| isSettingDefault: boolean; | ||
| } | ||
|
|
||
| interface ModelCardActions { | ||
| onSetDefault: () => void; | ||
| onTest: () => void; | ||
| onEdit: () => void; | ||
| onDelete: () => void; | ||
| } | ||
|
|
||
| interface ModelCardProps<T extends LLMModelConfig | EmbeddingModelConfig> { | ||
| model: T; | ||
| status: ModelCardStatus; | ||
| actions: ModelCardActions; | ||
| extraDetails?: ReactNode; | ||
| } | ||
|
|
||
| export function ModelCard<T extends LLMModelConfig | EmbeddingModelConfig>({ | ||
| model, | ||
| status, | ||
| actions, | ||
| extraDetails, | ||
| }: ModelCardProps<T>) { | ||
| const { isDefault, isTesting, isSettingDefault } = status; | ||
| const { onSetDefault, onTest, onEdit, onDelete } = actions; | ||
|
|
||
| return ( | ||
| <Box | ||
| sx={{ | ||
| p: 3, | ||
| border: "1px solid", | ||
| borderColor: "border.default", | ||
| borderRadius: 2, | ||
| bg: "canvas.subtle", | ||
| transition: "all 0.2s", | ||
| }} | ||
| > | ||
| <Box sx={{ display: "flex", alignItems: "start", justifyContent: "space-between" }}> | ||
| <Box sx={{ flex: 1, display: "flex", flexDirection: "column" }}> | ||
| {/* name and badges row */} | ||
| <Box sx={{ display: "flex", alignItems: "center", gap: 2, mb: 1 }}> | ||
| <Text sx={{ fontWeight: "bold", fontSize: 2, color: "fg.default" }}>{model.name}</Text> | ||
| <Box | ||
| sx={{ | ||
| px: 2, | ||
| py: 1, | ||
| borderRadius: 2, | ||
| bg: "accent.subtle", | ||
| color: "accent.fg", | ||
| fontSize: 0, | ||
| fontWeight: "semibold", | ||
| }} | ||
| > | ||
| {model.provider} | ||
| </Box> | ||
| {/* isDefault renders the default badge with CheckCircleFillIcon to visually distinguish the selected model */} | ||
| {isDefault && ( | ||
| <Box | ||
| sx={{ | ||
| px: 2, | ||
| py: 1, | ||
| borderRadius: 2, | ||
| border: "1px solid", | ||
| borderColor: "success.emphasis", | ||
| color: "success.fg", | ||
| fontSize: 0, | ||
| fontWeight: "semibold", | ||
| display: "flex", | ||
| alignItems: "center", | ||
| gap: 1, | ||
| }} | ||
| > | ||
| <CheckCircleFillIcon size={12} /> | ||
| Default | ||
| </Box> | ||
| )} | ||
| </Box> | ||
|
|
||
| {/* model details - model.model_name and model.endpoint; extraDetails may be appended for additional info like embedding dimensions */} | ||
| <Text sx={{ fontSize: 1, color: "fg.muted", mb: 1 }}> | ||
| model: {model.model_name} | ||
| {extraDetails} | ||
| </Text> | ||
| <Text sx={{ fontSize: 1, color: "fg.muted", fontFamily: "mono" }}>{model.endpoint}</Text> | ||
| </Box> | ||
|
|
||
| {/* action buttons */} | ||
| <Box sx={{ display: "flex", gap: 2 }}> | ||
| {!isDefault && ( | ||
| <Tooltip aria-label="Set as default model" direction="s"> | ||
| <Button | ||
| size="small" | ||
| variant="default" | ||
| onClick={onSetDefault} | ||
| disabled={isSettingDefault} | ||
| sx={{ | ||
| color: "attention.fg", | ||
| borderColor: "attention.emphasis", | ||
| "&:hover:not(:disabled)": { | ||
| bg: "attention.subtle", | ||
| borderColor: "attention.emphasis", | ||
| color: "attention.fg", | ||
| }, | ||
| }} | ||
| > | ||
| <Box sx={{ display: "flex", alignItems: "center", gap: 1 }}> | ||
| {isSettingDefault ? <Spinner size="small" /> : <StarIcon size={16} />} | ||
| <Text>{isSettingDefault ? "Setting..." : "Set Default"}</Text> | ||
| </Box> | ||
| </Button> | ||
| </Tooltip> | ||
| )} | ||
| <Button | ||
| size="small" | ||
| variant="default" | ||
| onClick={onTest} | ||
| disabled={isTesting} | ||
| sx={{ | ||
| color: isTesting ? "fg.muted" : "success.fg", | ||
| borderColor: isTesting ? "border.default" : "success.emphasis", | ||
| "&:hover:not(:disabled)": { | ||
| bg: "success.subtle", | ||
| borderColor: "success.emphasis", | ||
| color: "success.fg", | ||
| }, | ||
| }} | ||
| > | ||
| <Box sx={{ display: "flex", alignItems: "center", gap: 1 }}> | ||
| {isTesting ? <Spinner size="small" /> : <CheckCircleIcon size={16} />} | ||
| <Text>{isTesting ? "Testing..." : "Test"}</Text> | ||
| </Box> | ||
| </Button> | ||
| <IconButton icon={PencilIcon} aria-label="edit" size="small" onClick={onEdit} /> | ||
| <IconButton | ||
| icon={TrashIcon} | ||
| aria-label="delete" | ||
| size="small" | ||
| variant="danger" | ||
| onClick={onDelete} | ||
| /> | ||
| </Box> | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.