Skip to content

Distribute and run LLMs with a single file.

Fix server initialization order

Justine Tunneyce2e84864862
diff --git a/llama.cpp/server/public/index.html b/llama.cpp/server/public/index.html
index 47cb5f76..367ded37 100644
--- a/llama.cpp/server/public/index.html
+++ b/llama.cpp/server/public/index.html
@@ -1018,7 +1018,7 @@
<footer>
<p><${ModelGenerationInfo} /></p>
- <p>Powered by <a href="https://github.com/ggerganov/llama.cpp">llama.cpp</a> and <a href="https://ggml.ai">ggml.ai</a>, and <a href="https://github.com/Mozilla-Ocho/llamafile/">llamafile</a></p>
+ <p>Powered by <a href="https://github.com/ggerganov/llama.cpp">llama.cpp</a>, <a href="https://ggml.ai">ggml.ai</a>, and <a href="https://github.com/Mozilla-Ocho/llamafile/">llamafile</a></p>
</footer>
</div>
`;
diff --git a/llama.cpp/server/server.cpp b/llama.cpp/server/server.cpp
index 4d3a3e27..63fd24a1 100644
--- a/llama.cpp/server/server.cpp
+++ b/llama.cpp/server/server.cpp
@@ -3100,6 +3100,13 @@ int server_cli(int argc, char **argv)
log_data["api_key"] = "api_key: " + std::to_string(sparams.api_keys.size()) + " keys loaded";
}
+ // launch browser tab
+ if (!sparams.nobrowser) {
+ char url[128];
+ snprintf(url, sizeof(url), "http://%s:%d/", connect_host, sparams.port);
+ llamafile_launch_browser(url);
+ }
+
if (!FLAG_unsecure) {
if (IsXnu()) {
// Cosmopolitan libc explicitly does not support cosmo_dlopen on x64
@@ -3170,13 +3177,6 @@ int server_cli(int argc, char **argv)
return 0;
});
- // launch browser tab
- if (!sparams.nobrowser) {
- char url[128];
- snprintf(url, sizeof(url), "http://%s:%d/", connect_host, sparams.port);
- llamafile_launch_browser(url);
- }
-
if (sparams.chat_template.empty()) { // custom chat template is not supplied
// check if the template comes with the model is supported by us
llama.validate_model_chat_template(sparams);