summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlon <114724657+longregen@users.noreply.github.com>2023-08-26 10:07:43 +0200
committerGitHub <noreply@github.com>2023-08-26 16:07:43 +0800
commitbae5c5f679e043371bc2b4dffff8d4964d6cb953 (patch)
tree3f33c9cab3e720f9bd694f394f7663900c2ff468
parent232caf3c1581a6cb023571780ff41dc2d66d1ca0 (diff)
examples : skip unnecessary external lib in server README.md how-to (#2804)
-rw-r--r--examples/server/README.md23
1 files changed, 10 insertions, 13 deletions
diff --git a/examples/server/README.md b/examples/server/README.md
index 77997f98..7105e902 100644
--- a/examples/server/README.md
+++ b/examples/server/README.md
@@ -77,34 +77,31 @@ You need to have [Node.js](https://nodejs.org/en) installed.
```bash
mkdir llama-client
cd llama-client
-npm init
-npm install axios
```
Create a index.js file and put inside this:
```javascript
-const axios = require("axios");
-
const prompt = `Building a website can be done in 10 simple steps:`;
async function Test() {
- let result = await axios.post("http://127.0.0.1:8080/completion", {
- prompt,
- n_predict: 512,
- });
-
- // the response is received until completion finish
- console.log(result.data.content);
+ let response = await fetch("http://127.0.0.1:8080/completion", {
+ method: 'POST',
+ body: JSON.stringify({
+ prompt,
+ n_predict: 512,
+ })
+ })
+ console.log((await response.json()).content)
}
-Test();
+Test()
```
And run it:
```bash
-node .
+node index.js
```
## API Endpoints