File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -77,34 +77,31 @@ You need to have [Node.js](https://nodejs.org/en) installed.
7777``` bash
7878mkdir llama-client
7979cd llama-client
80- npm init
81- npm install axios
8280```
8381
8482Create a index.js file and put inside this:
8583
8684``` javascript
87- const axios = require (" axios" );
88-
8985const prompt = ` Building a website can be done in 10 simple steps:` ;
9086
9187async function Test () {
92- let result = await axios .post (" http://127.0.0.1:8080/completion" , {
93- prompt,
94- n_predict: 512 ,
95- });
96-
97- // the response is received until completion finish
98- console .log (result .data .content );
88+ let response = await fetch (" http://127.0.0.1:8080/completion" , {
89+ method: ' POST' ,
90+ body: JSON .stringify ({
91+ prompt,
92+ n_predict: 512 ,
93+ })
94+ })
95+ console .log ((await response .json ()).content )
9996}
10097
101- Test ();
98+ Test ()
10299```
103100
104101And run it:
105102
106103``` bash
107- node .
104+ node index.js
108105```
109106
110107## API Endpoints
You can’t perform that action at this time.
0 commit comments