Merge pull request #141 from aaaaron/integrate-opencode-pr62
Integrate opencode pr62 & pr104
This commit is contained in:
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).trim();
|
||||
}
|
||||
@@ -11,6 +11,8 @@ export const queryKeys = {
|
||||
taskSessions: (id: string) => ["agents", "task-sessions", id] as const,
|
||||
keys: (agentId: string) => ["agents", "keys", agentId] as const,
|
||||
configRevisions: (agentId: string) => ["agents", "config-revisions", agentId] as const,
|
||||
adapterModels: (companyId: string, adapterType: string) =>
|
||||
["agents", companyId, "adapter-models", adapterType] as const,
|
||||
},
|
||||
issues: {
|
||||
list: (companyId: string) => ["issues", companyId] as const,
|
||||
|
||||
Reference in New Issue
Block a user