Skip to content

Commit

Permalink
Add github and huggingface URLs only if they are set
Browse files Browse the repository at this point in the history
Signed-off-by: Arnaud J Le Hors <[email protected]>
  • Loading branch information
lehors committed Nov 14, 2024
1 parent f3179f1 commit cb00be8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions web/modules/mof/src/ModelSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ private function processModel(ModelInterface $model): array {
'origin' => $model->getOrigin() ?? '',
'producer' => $model->getOrganization() ?? '',
'contact' => $owner->id() > 1 ? $owner->getEmail() : '',
'github' => $model->getGithubSlug() ? 'https://github.com/' . $model->getGithubSlug() : '',
'huggingface' => $model->getHuggingfaceSlug() ? 'https://huggingface.co/' . $model->getHuggingfaceSlug() : '',
],
];

if ($model->getGithubSlug()) {
$data['release']['github'] = 'https://github.com/' . $model->getGithubSlug();
}
if ($model->getHuggingfaceSlug()) {
$data['release']['huggingface'] = 'https://huggingface.co/' . $model->getHuggingfaceSlug();
}

$completed = array_filter(
$this->componentManager->getComponents(),
fn($c) => in_array($c->id, $model->getCompletedComponents()));
Expand Down

0 comments on commit cb00be8

Please sign in to comment.