MCPcopy Create free account
hub / github.com/anomalyco/models.dev / getFilePath

Function getFilePath

providers/jiekou/scripts/generate-models.ts:275–294  ·  view source on GitHub ↗
(
  modelsDir: string,
  modelId: string
)

Source from the content-addressed store, hash-verified

273}
274
275function getFilePath(
276 modelsDir: string,
277 modelId: string
278): { filePath: string; dirPath: string } {
279 if (modelId.includes("/")) {
280 // e.g., "deepseek/deepseek-r1-0528" -> models/deepseek/deepseek-r1-0528.toml
281 const parts = modelId.split("/");
282 const fileName = `${parts[parts.length - 1]}.toml`;
283 const subDir = parts.slice(0, -1).join("/");
284 const dirPath = path.join(modelsDir, subDir);
285 const filePath = path.join(dirPath, fileName);
286 return { filePath, dirPath };
287 } else {
288 // e.g., "claude-opus-4-6" -> models/claude-opus-4-6.toml
289 return {
290 filePath: path.join(modelsDir, `${modelId}.toml`),
291 dirPath: modelsDir,
292 };
293 }
294}
295
296async function ensureDir(dirPath: string): Promise<void> {
297 try {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected