mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 21:31:26 +00:00
17 lines
435 B
TypeScript
17 lines
435 B
TypeScript
export function parseImageGenerationModelRef(
|
|
raw: string | undefined,
|
|
): { provider: string; model: string } | null {
|
|
const trimmed = raw?.trim();
|
|
if (!trimmed) {
|
|
return null;
|
|
}
|
|
const slashIndex = trimmed.indexOf("/");
|
|
if (slashIndex <= 0 || slashIndex === trimmed.length - 1) {
|
|
return null;
|
|
}
|
|
return {
|
|
provider: trimmed.slice(0, slashIndex).trim(),
|
|
model: trimmed.slice(slashIndex + 1).trim(),
|
|
};
|
|
}
|