Skip to content

Commit 950ba1a

Browse files
authored
Server: reorganize some http logic (#5939)
* refactor static file handler * use set_pre_routing_handler for validate_api_key * merge embedding handlers * correct http verb for endpoints * fix embedding response * fix test case CORS Options * fix code style
1 parent e1fa956 commit 950ba1a

File tree

4 files changed

+335
-314
lines changed

4 files changed

+335
-314
lines changed

examples/server/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ see https://github.com/ggerganov/llama.cpp/issues/1437
4242
- `-to N`, `--timeout N`: Server read/write timeout in seconds. Default `600`.
4343
- `--host`: Set the hostname or ip address to listen. Default `127.0.0.1`.
4444
- `--port`: Set the port to listen. Default: `8080`.
45-
- `--path`: path from which to serve static files (default examples/server/public)
45+
- `--path`: path from which to serve static files (default: disabled)
4646
- `--api-key`: Set an api key for request authorization. By default the server responds to every request. With an api key set, the requests must have the Authorization header set with the api key as Bearer token. May be used multiple times to enable multiple valid keys.
4747
- `--api-key-file`: path to file containing api keys delimited by new lines. If set, requests must include one of the keys for access. May be used in conjunction with `--api-key`'s.
4848
- `--embedding`: Enable embedding extraction, Default: disabled.
@@ -558,7 +558,7 @@ The HTTP server supports OAI-like API
558558

559559
### Extending or building alternative Web Front End
560560

561-
The default location for the static files is `examples/server/public`. You can extend the front end by running the server binary with `--path` set to `./your-directory` and importing `/completion.js` to get access to the llamaComplete() method.
561+
You can extend the front end by running the server binary with `--path` set to `./your-directory` and importing `/completion.js` to get access to the llamaComplete() method.
562562

563563
Read the documentation in `/completion.js` to see convenient ways to access llama.
564564

0 commit comments

Comments
 (0)