docs: how to use legacy ui

This commit is contained in:
Xuan Son Nguyen 2024-11-05 22:21:47 +01:00
parent 712ee17aa0
commit 9096e5ed5e
3 changed files with 17 additions and 9 deletions

View file

@ -929,6 +929,16 @@ Apart from error types supported by OAI, we also have custom types that are spec
}
```
### Legacy completion web UI
A new chat-based UI has replaced the old completion-based since [this PR](https://github.com/ggerganov/llama.cpp/pull/10175). If you want to use the old completion, start the server with `--path ./examples/server/public_legacy`
For example:
```sh
./llama-server -m my_model.gguf -c 8192 --path ./examples/server/public_legacy
```
### Extending or building alternative Web Front End
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.

View file

@ -25,6 +25,7 @@
.btn-mini {
@apply cursor-pointer opacity-0 group-hover:opacity-100 hover:shadow-md;
}
.chat-screen { max-width: 900px; }
</style>
</head>
@ -52,7 +53,7 @@
</div>
</div>
<div class="flex flex-col w-screen h-screen max-w-screen-md px-8 mx-auto">
<div class="chat-screen flex flex-col w-screen h-screen px-8 mx-auto">
<!-- header -->
<div class="flex flex-row items-center">
<div class="grow text-2xl font-bold mt-8 mb-6">

View file

@ -3112,14 +3112,11 @@ int main(int argc, char ** argv) {
// register static assets routes
if (!params.public_path.empty()) {
// Set the base directory for serving static files
svr->set_base_dir(params.public_path);
}
if (!params.api_keys.empty()) {
// for now, if API key is set, web UI is unusable
svr->Get("/", [&](const httplib::Request &, httplib::Response & res) {
return res.set_content("Web UI is disabled because API key is set.", "text/html; charset=utf-8");
});
bool is_found = svr->set_mount_point("/", params.public_path);
if (!is_found) {
LOG_ERR("%s: static assets path not found: %s\n", __func__, params.public_path.c_str());
return 1;
}
} else {
// using embedded static files
svr->Get("/", handle_static_file(index_html, index_html_len, "text/html; charset=utf-8"));