alwaysai
Version:
The alwaysAI command-line interface (CLI)
25 lines (21 loc) • 678 B
text/typescript
import * as logSymbols from 'log-symbols';
import { AppJsonFile, appInstallModel } from '../../../core/app';
import { Spawner, runWithSpinner, echo } from '../../../util';
export async function appInstallModelsComponent(spawner: Spawner) {
const appJsonFile = AppJsonFile();
const appJson = appJsonFile.read();
let hasModels = false;
if (appJson.models) {
for (const [id, version] of Object.entries(appJson.models)) {
hasModels = true;
await runWithSpinner(
appInstallModel,
[spawner, id, version],
`Install model ${id}`
);
}
}
if (!hasModels) {
echo(`${logSymbols.warning} Application has no models`);
}
}