Giter Site home page Giter Site logo

Comments (5)

9P9 avatar 9P9 commented on July 18, 2024

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)

from gpt4all-api.

altacountbabi avatar altacountbabi commented on July 18, 2024

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 ?

from gpt4all-api.

altacountbabi avatar altacountbabi commented on July 18, 2024

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

from gpt4all-api.

9P9 avatar 9P9 commented on July 18, 2024

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

from gpt4all-api.

altacountbabi avatar altacountbabi commented on July 18, 2024

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

from gpt4all-api.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.