fix: support slash-containing model IDs (#1074)

* fix: support slash-containing model IDs

* fix: parse worktree default model identifiers

---------

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Artёm
2026-05-01 00:34:36 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent f96374c738
commit d35ff8a2db
8 changed files with 44 additions and 30 deletions
@@ -16,6 +16,7 @@ import { ModelSelector } from './ModelSelector';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import { ScrollableOverlay } from '@/components/ui/ScrollableOverlay';
import { useI18n } from '@/lib/i18n';
import { parseModelIdentifier } from '@/lib/modelIdentifier';
import {
Select,
SelectContent,
@@ -761,8 +762,8 @@ export const AgentsPage: React.FC = () => {
</div>
<div className="flex min-w-0 flex-1 items-center gap-2 sm:w-fit sm:flex-initial">
<ModelSelector
providerId={model ? model.split('/')[0] : ''}
modelId={model ? model.split('/')[1] : ''}
providerId={parseModelIdentifier(model)?.providerId ?? ''}
modelId={parseModelIdentifier(model)?.modelId ?? ''}
onChange={(providerId: string, modelId: string) => {
if (providerId && modelId) {
setModel(`${providerId}/${modelId}`);
@@ -17,6 +17,7 @@ import {
SelectValue,
} from '@/components/ui/select';
import { useI18n } from '@/lib/i18n';
import { parseModelIdentifier } from '@/lib/modelIdentifier';
export const CommandsPage: React.FC = () => {
const { t } = useI18n();
@@ -295,8 +296,8 @@ export const CommandsPage: React.FC = () => {
</div>
<div className="flex min-w-0 flex-1 items-center gap-2 sm:w-fit sm:flex-initial">
<ModelSelector
providerId={model ? model.split('/')[0] : ''}
modelId={model ? model.split('/')[1] : ''}
providerId={parseModelIdentifier(model)?.providerId ?? ''}
modelId={parseModelIdentifier(model)?.modelId ?? ''}
onChange={(providerId: string, modelId: string) => {
if (providerId && modelId) {
setModel(`${providerId}/${modelId}`);
@@ -9,15 +9,14 @@ import { useUIStore } from '@/stores/useUIStore';
import { getRegisteredRuntimeAPIs } from '@/contexts/runtimeAPIRegistry';
import { cn } from '@/lib/utils';
import { useI18n } from '@/lib/i18n';
import { parseModelIdentifier } from '@/lib/modelIdentifier';
const getDisplayModel = (
storedModel: string | undefined
): { providerId: string; modelId: string } => {
if (storedModel) {
const parts = storedModel.split('/');
if (parts.length === 2 && parts[0] && parts[1]) {
return { providerId: parts[0], modelId: parts[1] };
}
const parsed = parseModelIdentifier(storedModel);
if (parsed) {
return parsed;
}
return { providerId: '', modelId: '' };