Skip to content

Commit 9096e5e

Browse files
committed
docs: how to use legacy ui
1 parent 712ee17 commit 9096e5e

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

examples/server/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,16 @@ Apart from error types supported by OAI, we also have custom types that are spec
929929
}
930930
```
931931

932+
### Legacy completion web UI
933+
934+
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`
935+
936+
For example:
937+
938+
```sh
939+
./llama-server -m my_model.gguf -c 8192 --path ./examples/server/public_legacy
940+
```
941+
932942
### Extending or building alternative Web Front End
933943

934944
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.

examples/server/public/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
.btn-mini {
2626
@apply cursor-pointer opacity-0 group-hover:opacity-100 hover:shadow-md;
2727
}
28+
.chat-screen { max-width: 900px; }
2829
</style>
2930
</head>
3031

@@ -52,7 +53,7 @@ <h2 class="font-bold mb-4 ml-4">Conversations</h2>
5253
</div>
5354
</div>
5455

55-
<div class="flex flex-col w-screen h-screen max-w-screen-md px-8 mx-auto">
56+
<div class="chat-screen flex flex-col w-screen h-screen px-8 mx-auto">
5657
<!-- header -->
5758
<div class="flex flex-row items-center">
5859
<div class="grow text-2xl font-bold mt-8 mb-6">

examples/server/server.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,14 +3112,11 @@ int main(int argc, char ** argv) {
31123112
// register static assets routes
31133113
if (!params.public_path.empty()) {
31143114
// Set the base directory for serving static files
3115-
svr->set_base_dir(params.public_path);
3116-
}
3117-
3118-
if (!params.api_keys.empty()) {
3119-
// for now, if API key is set, web UI is unusable
3120-
svr->Get("/", [&](const httplib::Request &, httplib::Response & res) {
3121-
return res.set_content("Web UI is disabled because API key is set.", "text/html; charset=utf-8");
3122-
});
3115+
bool is_found = svr->set_mount_point("/", params.public_path);
3116+
if (!is_found) {
3117+
LOG_ERR("%s: static assets path not found: %s\n", __func__, params.public_path.c_str());
3118+
return 1;
3119+
}
31233120
} else {
31243121
// using embedded static files
31253122
svr->Get("/", handle_static_file(index_html, index_html_len, "text/html; charset=utf-8"));

0 commit comments

Comments
 (0)