jan/web/utils/model.ts
Louis 7feaf9694d
feat: Deprecate model.json ready state in favor of .download ext (#1238)
* feat: Deprecate model.json ready state in favor of .download ext

* refactor: resolve ts ignore

* chore: fix warning

* fix: path polyfill on Windows
2023-12-28 14:06:13 +07:00

13 lines
357 B
TypeScript

import { basename } from 'path'
import { Model } from '@janhq/core'
export const modelBinFileName = (model: Model) => {
const modelFormatExt = '.gguf'
const extractedFileName = basename(model.source_url) ?? model.id
const fileName = extractedFileName.toLowerCase().endsWith(modelFormatExt)
? extractedFileName
: model.id
return fileName
}