web-llm icon indicating copy to clipboard operation
web-llm copied to clipboard

simple chat example "npm start"

Open zwilch opened this issue 1 year ago • 4 comments

Win10

Path: examples/simple-chat

can not follow Readme.md instruction

\webllm-npm\web-llm\examples\simple-chat>npm install
npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility

added 216 packages, and audited 217 packages in 44s

98 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

\webllm-npm\web-llm\examples\simple-chat>npm start

> [email protected] start
> cp src/gh-config.js src/app-config.js && parcel src/llm_chat.html  --port 8888

command cp unknown

zwilch avatar Dec 16 '23 10:12 zwilch

I think you can First, create a new Node.js script file, for example, copy-config.js, in examples\simple-chat. In this file, write the following content to copy files: const fs = require('fs'); fs.copyFileSync('src/gh-config.js', 'src/app-config.js'); Then, modify the scripts section in package.json to use this new Node.js script instead of the cp command: change scripts": { "start": "cp src/gh-config.js src/app-config.js && parcel src/llm_chat.html --port 8888", "mlc-local": "cp src/mlc-local-config.js src/app-config.js && parcel src/llm_chat.html --port 8888", "build": "cp src/gh-config.js src/app-config.js && parcel build src/llm_chat.html --dist-dir lib --no-content-hash" } to "scripts": { "start": "node copy-config.js && parcel src/llm_chat.html --port 8888", "mlc-local": "node copy-config.js && parcel src/llm_chat.html --port 8888", "build": "node copy-config.js && parcel build src/llm_chat.html --dist-dir lib --no-content-hash" } in file examples\simple-chat\package.json for windows10

tlopex avatar Dec 16 '23 15:12 tlopex

thanks @tlopex do you mind send a PR

tqchen avatar Dec 16 '23 15:12 tqchen

@tqchen Okay, I will do it later.

tlopex avatar Dec 16 '23 15:12 tlopex

thank you for the greate example, but should it not be fixed in the source?

zwilch avatar Dec 17 '23 20:12 zwilch