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
+20
View File
@@ -0,0 +1,20 @@
export interface ParsedModelIdentifier {
providerId: string;
modelId: string;
}
export const parseModelIdentifier = (value: string | undefined): ParsedModelIdentifier | null => {
if (!value) {
return null;
}
const separatorIndex = value.indexOf('/');
if (separatorIndex <= 0 || separatorIndex >= value.length - 1) {
return null;
}
return {
providerId: value.slice(0, separatorIndex),
modelId: value.slice(separatorIndex + 1),
};
};