Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
  • Loading branch information
axel7083 committed Jul 9, 2024
1 parent f168c0a commit 3a7a56d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/backend/src/managers/modelsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,22 +438,20 @@ export class ModelsManager implements Disposable {
let result: GGUFParseOutput<{ strict: false }>;
if (this.isModelOnDisk(modelId)) {
const modelPath = path.normalize(getLocalModelFile(model));
console.debug(`[getModelMetadata] reading model ${modelPath}`);
result = await gguf(modelPath, { allowLocalFile: true });
} else if (model.url) {
result = await gguf(model.url);
} else {
throw new Error('cannot get model metadata');
}
console.log('result', result);
return result.metadata;
} catch (err: unknown) {
data['error'] = err;
console.error(err);
throw err;
} finally {
data['duration'] = performance.now() - before;
this.telemetry.logUsage('get-metadata');
this.telemetry.logUsage('get-metadata', data);
}
}
}

0 comments on commit 3a7a56d

Please sign in to comment.