1
mirror of https://github.com/cocktailpeanut/dalai synced 2024-11-23 04:16:53 +01:00
This commit is contained in:
cocktailpeanut 2023-03-22 14:05:04 -04:00
parent dde228fa37
commit 0404c339a8
3 changed files with 4 additions and 18 deletions

View File

@ -300,6 +300,7 @@ ${fields}
config.id = "TS-" + Date.now() + "-" + Math.floor(Math.random() * 100000) config.id = "TS-" + Date.now() + "-" + Math.floor(Math.random() * 100000)
document.querySelector("#prompt-run").classList.add("hidden") document.querySelector("#prompt-run").classList.add("hidden")
document.querySelector("#prompt-cancel").classList.remove("hidden") document.querySelector("#prompt-cancel").classList.remove("hidden")
delete config.html
localStorage.setItem("config", JSON.stringify(config)) localStorage.setItem("config", JSON.stringify(config))
socket.emit('request', config) socket.emit('request', config)
config.id = null config.id = null

View File

@ -278,18 +278,14 @@ class Dalai {
if (!this.queue) this.queue = [] if (!this.queue) this.queue = []
if (platform === "win32") { if (platform === "win32") {
for(let i=0;i<msg.length; i++) { for(let i=0;i<msg.length; i++) {
console.log("msgi", msg[i]);
if (msg[i] === "\\") { if (msg[i] === "\\") {
this.queueActive = true this.queueActive = true
// start pushing to buffer // start pushing to buffer
// console.log("adding to queue", msg[i])
this.queue.push(msg[i]); this.queue.push(msg[i]);
} else { } else {
// otherwise flush // otherwise flush
this.queue.push(msg[i]) this.queue.push(msg[i])
console.log("flushing queue", this.queue)
let queueContent = this.queue.join("") let queueContent = this.queue.join("")
console.log({ before: queueContent, beforeEscape: winEscape(queueContent), after : this.htmlencode(winEscape(queueContent)) })
if (!this.bufferStarted && ["\n", "\b", "\f", "\r", "\t"].includes(queueContent)) { if (!this.bufferStarted && ["\n", "\b", "\f", "\r", "\t"].includes(queueContent)) {
// if the buffer hasn't started and incoming tokens are whitespaces, ignore // if the buffer hasn't started and incoming tokens are whitespaces, ignore
@ -307,24 +303,13 @@ class Dalai {
} }
} else { } else {
if (req.html) { if (req.html) {
cb(this.htmlencode(queueContent)) cb(this.htmlencode(msg))
} else { } else {
cb(queueContent) cb(msg)
} }
} }
} }
async uninstall(core, ...models) { async uninstall(core, ...models) {
// delete the rest of the files
//const files = (await fs.promises.readdir(path.resolve(this.home, core), { withFileTypes: true }))
// .filter(dirent => dirent.isFile() && !dirent.name.startsWith("."))
// .map(dirent => dirent.name);
//console.log("files", files)
//for(let file of files) {
// await fs.promises.rm(path.resolve(this.home, core, file)).catch((e) => { })
//}
if (models.length > 0) { if (models.length > 0) {
// delete the model folder // delete the model folder
const modelsPath = path.resolve(this.home, core, "models") const modelsPath = path.resolve(this.home, core, "models")

View File

@ -1,6 +1,6 @@
{ {
"name": "dalai", "name": "dalai",
"version": "0.2.52", "version": "0.3.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"author": "cocktailpeanut", "author": "cocktailpeanut",