gpt4all-api
gpt4all-api copied to clipboard
gpt4all doesn't load on linux server
I tried this on my local machine and linux server but neither of them actually worked I gave it a pretty generous amount of time to load but I don't think it even started gpt4all.
additional info (windows)
index.js: https://pastebin.com/raw/FTDL7dHK
gpt.js: https://pastebin.com/raw/eQNgh41t
file structure:

Please tell me if I did anything wrong, i'm not sure if I did the installation process correctly.
Hi! Would you be able to show me what comes up in terminal when you run it?
Also, if you wish to trouble shoot yourself
import { spawn } from 'child_process';
import { EventEmitter } from 'events';
class GPT4ALL extends EventEmitter {
status = 0;
buffer = "";
constructor(app) {
super();
this.chat = spawn(app);
this.chat.stdout.on('data', (data) => {
let str = data.toString();
if (str.includes("\x1b[33m")) {
this.status = 1;
this.emit("ready");
this.buffer = "";
} else if (str.includes(">")) {
this.emit("data", this.buffer);
this.buffer = "";
} else {
this.buffer += str;
}
});
this.chat.on('exit', (code) => { console.error(`${code}`);
}
async ask(msg) {
if (!this.status) return null;
this.chat.stdin.write(`${msg}\n`);
return new Promise(resolve => this.once("data", resolve));
}
}
export default GPT4ALL;
here is a version of the gpt4all wrapper that includes error handling (which will be hopefully re-added to the official release)
It just says that the express server is running

also there was a small error in the error handling wrapper
this.chat.on('exit', (code) => { console.error(`${code}`); //doesnt work
this.chat.on('exit', (code) => { console.error(`${code}`) }); //works
edit: I ran it with the error handling and it seems like gpt just exits with error code 1 edit 2: also dont you need to specify the model path when launching the .exe ?
after a little more debugging than i would like to admit i figured out that the model was corrupted, I redownloaded it from the original gpt4all repository and it works now.
Nvm i only got it to work in command prompt but the sdk still does the same thing
Can you show what you mean by working in command prompt?
it works when I run it from command prompt
But it still doesnt work with the library
