-
Notifications
You must be signed in to change notification settings - Fork 7
/
pinokio.js
84 lines (84 loc) · 3.21 KB
/
pinokio.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
const os = require('os')
const fs = require('fs')
const path = require("path")
const exists = (filepath) => {
return new Promise(r=>fs.access(filepath, fs.constants.F_OK, e => r(!e)))
}
module.exports = {
// start: async (kernel) => {
// let installed = await exists(path.resolve(__dirname, "text-generation-webui"))
// if (installed) {
// return "start.json"
// }
// },
title: "Text generation webui",
description: "A gradio web UI for running Large Language Models like LLaMA, llama.cpp, GPT-J, Pythia, OPT, and GALACTICA.",
icon: "icon.png",
menu: async (kernel) => {
let installed = await exists(path.resolve(__dirname, "text-generation-webui"))
let running = kernel.status("chat.json", __dirname) || kernel.status("basic.json", __dirname) || kernel.status("notebook.json", __dirname) || kernel.status("custom.json", __dirname)
if (installed) {
let session = (await kernel.loader.load(path.resolve(__dirname, "session.json"))).resolved
return [{
filter: () => { return running },
html: "<i class='fa-solid fa-rocket'></i> Open Web UI",
href: (session && session.url ? session.url : "http://127.0.0.1:7860"),
target: "_blank"
}, {
when: "chat.json",
on: "<i class='fa-solid fa-desktop'></i> Server",
href: "chat.json?fullscreen=true"
}, {
when: "basic.json",
on: "<i class='fa-solid fa-desktop'></i> Server",
href: "basic.json?fullscreen=true"
}, {
when: "notebook.json",
on: "<i class='fa-solid fa-desktop'></i> Server",
href: "notebook.json?fullscreen=true"
}, {
when: "custom.json",
on: "<i class='fa-solid fa-desktop'></i> Server",
href: "custom.json?fullscreen=true"
}, {
when: "chat.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running Chat Mode",
type: "label",
}, {
filter: () => { return !running },
html: "<i class='fa-solid fa-power-off'></i> Start Chat mode",
href: "chat.json?fullscreen=true&run=true"
}, {
when: "basic.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running Basic Mode",
type: "label",
}, {
filter: () => { return !running },
html: "<i class='fa-solid fa-power-off'></i> Start Basic Mode",
href: "basic.json?fullscreen=true&run=true"
}, {
when: "notebook.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running Notebook Mode",
type: "label",
}, {
filter: () => { return !running },
html: "<i class='fa-solid fa-power-off'></i> Start Notebook Mode",
href: "notebook.json?fullscreen=true&run=true"
}, {
when: "custom.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running with Custom Flags",
type: "label",
}, {
filter: () => { return !running },
html: "<i class='fa-solid fa-power-off'></i> Start with Custom Flags",
href: "custom.json?fullscreen=true&run=true"
}]
} else {
return [{
html: '<i class="fa-solid fa-plug"></i> Install',
type: "link",
href: "install.json?run=true&fullscreen=true"
}]
}
}
}