* chore: resolve fetch models api limit rate * chore: delete module cache * chore: update latest npm module * chore: typo
38 lines
949 B
TypeScript
38 lines
949 B
TypeScript
export const parseToModel = (model) => {
|
|
const modelVersions = [];
|
|
model.versions.forEach((v) => {
|
|
const version = {
|
|
_id: `${model.author}-${v.name}`,
|
|
name: v.name,
|
|
quantMethod: v.quantMethod,
|
|
bits: v.bits,
|
|
size: v.size,
|
|
maxRamRequired: v.maxRamRequired,
|
|
usecase: v.usecase,
|
|
downloadLink: v.downloadLink,
|
|
productId: model.id,
|
|
};
|
|
modelVersions.push(version);
|
|
});
|
|
|
|
const product = {
|
|
_id: model.id,
|
|
name: model.name,
|
|
shortDescription: model.shortDescription,
|
|
avatarUrl: model.avatarUrl,
|
|
author: model.author,
|
|
version: model.version,
|
|
modelUrl: model.modelUrl,
|
|
nsfw: model.nsfw,
|
|
tags: model.tags,
|
|
greeting: model.defaultGreeting,
|
|
type: model.type,
|
|
createdAt: model.createdAt,
|
|
longDescription: model.longDescription,
|
|
status: "Downloadable",
|
|
releaseDate: 0,
|
|
availableVersions: modelVersions,
|
|
};
|
|
return product;
|
|
};
|