GHHG10's picture
download
raw
850 Bytes
import type { Provider } from "@opencode-ai/sdk/v2"
export function parse(value: string) {
const [providerID, ...modelID] = value.split("/")
return { providerID, modelID: modelID.join("/") }
}
export function index(list: Provider[] | undefined) {
return new Map((list ?? []).map((item) => [item.id, item] as const))
}
export function get(list: Provider[] | ReadonlyMap<string, Provider> | undefined, providerID: string, modelID: string) {
const provider =
list instanceof Map
? list.get(providerID)
: Array.isArray(list)
? list.find((item) => item.id === providerID)
: undefined
return provider?.models[modelID]
}
export function name(
list: Provider[] | ReadonlyMap<string, Provider> | undefined,
providerID: string,
modelID: string,
) {
return get(list, providerID, modelID)?.name ?? modelID
}

Xet Storage Details

Size:
850 Bytes
·
Xet hash:
f8dcf1fc0f10a12c6019cb3813f88e2d06a02e5f240d70a4ccd66eb3aee7afee

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.