Skip to content

Misc. bug: Web UI does not use localStorage.getItem("base") as claimed in README #15047

@insanerest

Description

@insanerest

Name and Version

$ ./build/bin/llama-server --version
version: 6075 (5c0eb5e)
built with Apple clang version 17.0.0 (clang-1700.0.13.5) for arm64-apple-darwin24.5.0

Operating systems

Mac

Which llama.cpp modules do you know to be affected?

llama-server

Command line

Explained in the next section

Problem description & steps to reproduce

Summary

The summary of the problem is in the README.md of llama.cpp/tools/server it says:

NOTE: if you are using the vite dev server, you can change the API base URL to llama.cpp. To do that, run this code snippet in browser's console:

localStorage.setItem('base', 'http://localhost:8080')

This is supposed to fetch the props from the provided URL. But instead the BASE_URL is hardcoded in webui/src/Config.ts as shown below

export const BASE_URL = new URL('.', document.baseURI).href
  .toString()
  .replace(/\/$/, '');

So it DOES NOT even look at localStorage


Steps to reproduce

  1. Clone the repo and start your terminal at it.
  2. Build llama-server as stated in the README.md:
cmake -B build
cmake --build build --config Release -t llama-server
  1. Run the llama-server that was built (i will be using llama3.2, but any model can be used
./build/bin/llama-server -m ~/llama3.2 --port 11234
  1. Navigate to the webui directory and run the dev server
cd tools/server/webui
npm i
npm run dev
  1. Navigate to http://localhost:5173
  2. It should error with Failed to fetch server props
  3. As it says in the README.md, change the base to the server's URL and reload the page
// Our server is running at port 11234
localStorage.setItem('base', 'http://localhost:11234')
window.location.reload()
  1. It should still error Failed to fetch server props

First Bad Commit

No response

Relevant log output

[Debug] [vite] connecting... (client, line 742)
[Debug] [vite] connected. (client, line 865)
[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (props, line 0)
[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (props, line 0)
[Error] Error fetching server props: – Error: Failed to fetch server props — misc.ts:189
Error: Failed to fetch server props — misc.ts:189
	(anonymous function) (misc.ts:134)
[Error] Error: Failed to fetch server props — misc.ts:189
	(anonymous function) (app.context.tsx:65)
[Error] Error fetching server props: – Error: Failed to fetch server props — misc.ts:189
Error: Failed to fetch server props — misc.ts:189
	(anonymous function) (misc.ts:134)
[Error] Error: Failed to fetch server props
(anonymous function) — misc.ts:189

	(anonymous function) (app.context.tsx:65)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions