Louis b5d520fe10
chore: resolve fetch models api limit rate (#383)
* chore: resolve fetch models api limit rate

* chore: delete module cache

* chore: update latest npm module

* chore: typo
2023-10-18 14:13:24 +07:00

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;
};