gpt4all-api icon indicating copy to clipboard operation
gpt4all-api copied to clipboard

gpt4all doesn't load on linux server

Open altacountbabi opened this issue 2 years ago • 5 comments

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: image

Please tell me if I did anything wrong, i'm not sure if I did the installation process correctly.

altacountbabi avatar Apr 08 '23 22:04 altacountbabi

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)

9P9 avatar Apr 08 '23 22:04 9P9

It just says that the express server is running

image

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 ?

altacountbabi avatar Apr 09 '23 08:04 altacountbabi

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

altacountbabi avatar Apr 10 '23 08:04 altacountbabi

Can you show what you mean by working in command prompt?

9P9 avatar Apr 10 '23 20:04 9P9

it works when I run it from command prompt image But it still doesnt work with the library image

altacountbabi avatar Apr 10 '23 20:04 altacountbabi