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:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
f96374c738
commit
d35ff8a2db
@@ -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),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user