alwaysai
Version:
The alwaysAI command-line interface (CLI)
58 lines • 2.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.destinationPromptComponent = exports.checkProcessorBrand = exports.Destination = void 0;
const si = require("systeminformation");
const util_1 = require("../../../util");
exports.Destination = (0, util_1.keyMirror)({
YOUR_LOCAL_COMPUTER: null,
REMOTE_DEVICE: null
});
async function checkProcessorBrand() {
const architecture = await si.cpu();
const brand = architecture.brand;
if (brand.toLowerCase().includes('celeron') ||
brand.toLowerCase().includes('atom')) {
return false;
}
return true;
}
exports.checkProcessorBrand = checkProcessorBrand;
async function destinationPromptComponent(props) {
const choices = [];
if (await checkProcessorBrand()) {
choices.push({
title: 'Your local computer',
value: exports.Destination.YOUR_LOCAL_COMPUTER
});
}
else {
choices.push({
title: 'Your local computer (Not available)',
value: exports.Destination.YOUR_LOCAL_COMPUTER,
disabled: true
});
}
choices.push({
title: 'Remote device',
value: exports.Destination.REMOTE_DEVICE
});
const foundChoiceIndex = choices.findIndex((choice) => choice.value === props.prevDestination);
const initial = foundChoiceIndex > -1 ? foundChoiceIndex : 0;
const answer = await (0, util_1.promptForInput)({
purpose: 'to choose whether you want to run your application here on this computer or on a remote device',
questions: [
{
type: 'select',
name: 'destination',
message: 'What is the destination?',
initial,
choices,
warn: 'edgeIQ does not support Atom/Celeron powered devices.'
}
]
});
const destination = answer.destination;
return destination;
}
exports.destinationPromptComponent = destinationPromptComponent;
//# sourceMappingURL=destination-prompt-component.js.map