llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

displaying context and token stats in real time

Open NoahOksuz opened this issue 1 month ago • 4 comments

Add parsing progress display to webui

Fixes #17079

Adds parsing progress during prompt tokenization, similar to token generation progress.

Changes:

  • Display Input: processed / total (percent%) during prompt parsing
  • Display parsing tokens/second (X.X t/s) during parsing
  • Calculate parsing speed from prompt_progress timing data

Implementation:

  • Added parsingTokensPerSecond, inputTokensProcessed, and inputTokensTotal to ApiProcessingState
  • Updated parseCompletionTimingData() to calculate parsing speed from prompt_progress.time_ms and prompt_progress.processed
  • Updated getProcessingDetails() to show input parsing progress when status is 'preparing'

Users now see real-time parsing progress instead of just "Processing...".

NoahOksuz avatar Nov 08 '25 19:11 NoahOksuz

@NoahOksuz I can't figure out how to enable it. I see:

image

catap avatar Nov 08 '25 21:11 catap

@NoahOksuz I can't figure out how to enable it. I see: image

works locally. im just working on another PR atm ill take a second look in 5 minutes at this

NoahOksuz avatar Nov 08 '25 21:11 NoahOksuz

aha, I just patched sources of used build. Which seems not enough :(

If you share a picture how it looks on your side, I can genuely how I think it looks.

catap avatar Nov 08 '25 21:11 catap

I think you need to enable progress updates from the backend. Setting return_progress to true in the request body should enable it.

// tools/server/webui/src/lib/services/chat.ts   chat.ts  ~ line 117
const requestBody: ApiChatCompletionRequest = {
	messages: processedMessages.map((msg: ApiChatMessageData) => ({
		role: msg.role,
		content: msg.content
	})),
	stream
};

should be

const requestBody: ApiChatCompletionRequest = {
	messages: processedMessages.map((msg: ApiChatMessageData) => ({
		role: msg.role,
		content: msg.content
	})),
	stream,
	return_progress: true // Add this
};

Then it works for me

gSUz92nc avatar Nov 08 '25 22:11 gSUz92nc