mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 11:20:37 +09:00
Address PR feedback for OpenCode integration
This commit is contained in:
parent
6a101e0da1
commit
69c453b274
12 changed files with 87 additions and 55 deletions
16
ui/src/lib/model-utils.ts
Normal file
16
ui/src/lib/model-utils.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export function extractProviderId(modelId: string): string | null {
|
||||
const trimmed = modelId.trim();
|
||||
if (!trimmed.includes("/")) return null;
|
||||
const provider = trimmed.slice(0, trimmed.indexOf("/")).trim();
|
||||
return provider || null;
|
||||
}
|
||||
|
||||
export function extractProviderIdWithFallback(modelId: string, fallback = "other"): string {
|
||||
return extractProviderId(modelId) ?? fallback;
|
||||
}
|
||||
|
||||
export function extractModelName(modelId: string): string {
|
||||
const trimmed = modelId.trim();
|
||||
if (!trimmed.includes("/")) return trimmed;
|
||||
return trimmed.slice(trimmed.indexOf("/") + 1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue