Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows wsl install issue? #3

Open
redonkuless82 opened this issue Dec 2, 2023 · 1 comment
Open

windows wsl install issue? #3

redonkuless82 opened this issue Dec 2, 2023 · 1 comment

Comments

@redonkuless82
Copy link

So I have the engine api running, however when following the instructions for the openchat-ui, when loading the web interface in windows from the wsl install of ubuntu, i get the following:

CONSOLE:
event - compiled client and server successfully in 2.2s (273 modules)
wait - compiling...
event - compiled successfully in 165 ms (233 modules)
wait - compiling / (client and server)...
event - compiled client and server successfully in 6.5s (5563 modules)
wait - compiling /_error (client and server)...
error - ReferenceError: atob is not defined
at base64decode (file:///home/crypt1/openchat-ui/node_modules/mistral-tokenizer-js/mistral-tokenizer.js:21:5)
at decodeVocabulary (file:///home/crypt1/openchat-ui/node_modules/mistral-tokenizer-js/mistral-tokenizer.js:88:39)
at initializemistralTokenizer (file:///home/crypt1/openchat-ui/node_modules/mistral-tokenizer-js/mistral-tokenizer.js:421:34)
at file:///home/crypt1/openchat-ui/node_modules/mistral-tokenizer-js/mistral-tokenizer.js:435:1
at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
at async Loader.import (internal/modules/esm/loader.js:178:24) {
page: '/'
}

Web interface:

Server Error
ReferenceError: atob is not defined

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
base64decode
file:///home/crypt1/openchat-ui/node_modules/mistral-tokenizer-js/mistral-tokenizer.js (21:5)
decodeVocabulary
file:///home/crypt1/openchat-ui/node_modules/mistral-tokenizer-js/mistral-tokenizer.js (88:39)
initializemistralTokenizer
file:///home/crypt1/openchat-ui/node_modules/mistral-tokenizer-js/mistral-tokenizer.js (421:34)

file:///home/crypt1/openchat-ui/node_modules/mistral-tokenizer-js/mistral-tokenizer.js (435:1)
ModuleJob.run
internal/modules/esm/module_job.js (183:25)
async Loader.import
internal/modules/esm/loader.js (178:24)

@megler
Copy link

megler commented Dec 19, 2023

I can get you part of the way there. Create a server.js file in the root application directory with the following:

const { createServer } = require('http');
const next = require('next');

const port = parseInt(process.env.PORT, 10) || 4200;
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();

// Polyfill for atob in Node.js environment
global.atob = function (encodedString) {
  return Buffer.from(encodedString, 'base64').toString('utf-8');
};

app.prepare().then(() => {
  createServer((req, res) => {
    handle(req, res);
  }).listen(port, (err) => {
    if (err) throw err;
    console.log(`> Ready on http://localhost:${port}`);
  });
});

Then update your package.json to:

"scripts": {
  "dev": "node server.js",
  "build": "next build",
  "start": "NODE_ENV=production node server.js",
  "format": "prettier --write .",
  "test": "vitest",
  "coverage": "vitest run --coverage"
},

That got me to where the UI would load. Now I get an "Error Fetching Modules 500 Server Error." and also a TypeError that points to a nested npm package. I'm not sure if this new stuff is due to some work server setup issues or something in the server.js code I wrote, but this will get you in the ballpark. Hopefully, someone can run with this and overcome these last issues. If I hit on anything, I'll update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants