Files

117 lines
3.4 KiB
JavaScript

// Pinokio launcher entry: the menu buttons depend on whether the app is installed and what is running.
module.exports = {
version: "7.0",
title: "Teams Whisper",
description: "Record Teams calls and turn them into meeting reports, fully local",
menu: async (kernel, info) => {
// Installed marker: the bge-m3 embedding model that install.js downloads.
let installed = info.exists("app/models/bge-m3-Q8_0.gguf")
// Which launcher scripts are currently running.
let running = {
install: info.running("install.js"),
start: info.running("start.js"),
update: info.running("update.js"),
reset: info.running("reset.js")
}
// While install is running, show only the Installing entry.
if (running.install) {
return [{
default: true,
icon: "fa-solid fa-plug",
text: "Installing",
href: "install.js",
}]
// Installed: the menu depends on whether the server (start.js) is running.
} else if (installed) {
if (running.start) {
// start.js saves the server URL in local state once it is ready.
let local = info.local("start.js")
if (local && local.url) {
// Server running with a known URL: links to the Web UI, Prefect, extension, login and terminal.
return [{
default: true,
icon: "fa-solid fa-rocket",
text: "Open Web UI",
href: local.url,
}, {
icon: "fa-solid fa-diagram-project",
text: "Prefect",
href: "http://127.0.0.1:4200",
}, {
icon: "fa-solid fa-puzzle-piece",
text: "Extension",
href: "ext.js",
}, {
icon: "fa-solid fa-key",
text: "Cloud login",
href: "login.js",
}, {
icon: 'fa-solid fa-terminal',
text: "Terminal",
href: "start.js",
}]
// Server running but URL not known yet: only the terminal.
} else {
return [{
default: true,
icon: 'fa-solid fa-terminal',
text: "Terminal",
href: "start.js",
}]
}
// Other jobs in progress: show only their status.
} else if (running.update) {
return [{
default: true,
icon: 'fa-solid fa-terminal',
text: "Updating",
href: "update.js",
}]
} else if (running.reset) {
return [{
default: true,
icon: 'fa-solid fa-terminal',
text: "Resetting",
href: "reset.js",
}]
} else {
// Installed and idle: full menu.
return [{
default: true,
icon: "fa-solid fa-power-off",
text: "Start",
href: "start.js",
}, {
icon: "fa-solid fa-puzzle-piece",
text: "Extension",
href: "ext.js",
}, {
icon: "fa-solid fa-key",
text: "Cloud login",
href: "login.js",
}, {
icon: "fa-solid fa-plug",
text: "Update",
href: "update.js",
}, {
icon: "fa-solid fa-plug",
text: "Install",
href: "install.js",
}, {
icon: "fa-regular fa-circle-xmark",
text: "Reset",
href: "reset.js",
}]
}
// Not installed: only Install.
} else {
return [{
default: true,
icon: "fa-solid fa-plug",
text: "Install",
href: "install.js",
}]
}
}
}