mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-28 15:25:27 +08:00
refactor: add provider names to model constants
This commit is contained in:
@@ -94,3 +94,13 @@ export const GEMINI_MODELS = {
|
|||||||
|
|
||||||
DEFAULT: "gemini-3.1-pro-preview",
|
DEFAULT: "gemini-3.1-pro-preview",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ordered provider registry. Display order in selection UIs.
|
||||||
|
*/
|
||||||
|
export const PROVIDERS = [
|
||||||
|
{ id: "claude", name: "Anthropic", models: CLAUDE_MODELS },
|
||||||
|
{ id: "codex", name: "OpenAI", models: CODEX_MODELS },
|
||||||
|
{ id: "gemini", name: "Google", models: GEMINI_MODELS },
|
||||||
|
{ id: "cursor", name: "Cursor", models: CURSOR_MODELS },
|
||||||
|
];
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
CURSOR_MODELS,
|
CURSOR_MODELS,
|
||||||
CODEX_MODELS,
|
CODEX_MODELS,
|
||||||
GEMINI_MODELS,
|
GEMINI_MODELS,
|
||||||
|
PROVIDERS,
|
||||||
} from "../../../../../shared/modelConstants";
|
} from "../../../../../shared/modelConstants";
|
||||||
import type { ProjectSession, LLMProvider } from "../../../../types/app";
|
import type { ProjectSession, LLMProvider } from "../../../../types/app";
|
||||||
import { NextTaskBanner } from "../../../task-master";
|
import { NextTaskBanner } from "../../../task-master";
|
||||||
@@ -52,12 +53,11 @@ type ProviderGroup = {
|
|||||||
models: { value: string; label: string }[];
|
models: { value: string; label: string }[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const PROVIDER_GROUPS: ProviderGroup[] = [
|
const PROVIDER_GROUPS: ProviderGroup[] = PROVIDERS.map((p) => ({
|
||||||
{ id: "claude", name: "Anthropic", models: CLAUDE_MODELS.OPTIONS },
|
id: p.id as LLMProvider,
|
||||||
{ id: "cursor", name: "Cursor", models: CURSOR_MODELS.OPTIONS },
|
name: p.name,
|
||||||
{ id: "codex", name: "OpenAI", models: CODEX_MODELS.OPTIONS },
|
models: p.models.OPTIONS,
|
||||||
{ id: "gemini", name: "Google", models: GEMINI_MODELS.OPTIONS },
|
}));
|
||||||
];
|
|
||||||
|
|
||||||
function getModelConfig(p: LLMProvider) {
|
function getModelConfig(p: LLMProvider) {
|
||||||
if (p === "claude") return CLAUDE_MODELS;
|
if (p === "claude") return CLAUDE_MODELS;
|
||||||
@@ -231,9 +231,14 @@ export default function ProviderSelectionEmptyState({
|
|||||||
defaultValue: "No models found.",
|
defaultValue: "No models found.",
|
||||||
})}
|
})}
|
||||||
</CommandEmpty>
|
</CommandEmpty>
|
||||||
{visibleProviderGroups.map((group) => (
|
{visibleProviderGroups.map((group, idx) => (
|
||||||
<CommandGroup
|
<CommandGroup
|
||||||
key={group.id}
|
key={group.id}
|
||||||
|
className={
|
||||||
|
idx > 0
|
||||||
|
? "border-t border-border/40 [&_[cmdk-group-heading]]:mt-1 [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-wider"
|
||||||
|
: "[&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-wider"
|
||||||
|
}
|
||||||
heading={
|
heading={
|
||||||
<span className="flex items-center gap-1.5">
|
<span className="flex items-center gap-1.5">
|
||||||
<SessionProviderLogo provider={group.id} className="h-3.5 w-3.5 shrink-0" />
|
<SessionProviderLogo provider={group.id} className="h-3.5 w-3.5 shrink-0" />
|
||||||
@@ -248,6 +253,7 @@ export default function ProviderSelectionEmptyState({
|
|||||||
key={`${group.id}-${model.value}`}
|
key={`${group.id}-${model.value}`}
|
||||||
value={`${group.name} ${model.label}`}
|
value={`${group.name} ${model.label}`}
|
||||||
onSelect={() => handleModelSelect(group.id, model.value)}
|
onSelect={() => handleModelSelect(group.id, model.value)}
|
||||||
|
className="ml-4 border-l border-border/40 pl-4"
|
||||||
>
|
>
|
||||||
<span className="flex-1 truncate">{model.label}</span>
|
<span className="flex-1 truncate">{model.label}</span>
|
||||||
{isSelected && (
|
{isSelected && (
|
||||||
|
|||||||
Reference in New Issue
Block a user