Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,30 @@ export function useProcessingState(): UseProcessingStateReturn {
);
}

// Show input parsing progress when preparing
if (
stateToUse.status === 'preparing' &&
stateToUse.inputTokensProcessed !== undefined &&
stateToUse.inputTokensTotal !== undefined &&
stateToUse.inputTokensTotal > 0
) {
const inputPercent = Math.round(
(stateToUse.inputTokensProcessed / stateToUse.inputTokensTotal) * 100
);
details.push(
`Input: ${stateToUse.inputTokensProcessed}/${stateToUse.inputTokensTotal} (${inputPercent}%)`
);

// Show parsing tokens per second if available
if (
currentConfig.showTokensPerSecond &&
stateToUse.parsingTokensPerSecond !== undefined &&
stateToUse.parsingTokensPerSecond > 0
) {
details.push(`${stateToUse.parsingTokensPerSecond.toFixed(1)} t/s`);
}
}

if (stateToUse.outputTokensUsed > 0) {
// Handle infinite max_tokens (-1) case
if (stateToUse.outputTokensMax <= 0) {
Expand All @@ -144,7 +168,8 @@ export function useProcessingState(): UseProcessingStateReturn {
if (
currentConfig.showTokensPerSecond &&
stateToUse.tokensPerSecond &&
stateToUse.tokensPerSecond > 0
stateToUse.tokensPerSecond > 0 &&
stateToUse.status !== 'preparing' // Don't show generation t/s when parsing
) {
details.push(`${stateToUse.tokensPerSecond.toFixed(1)} tokens/sec`);
}
Expand Down
10 changes: 9 additions & 1 deletion tools/server/webui/src/lib/services/slots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ export class SlotsService {
? Math.round((promptProgress.processed / promptProgress.total) * 100)
: undefined;

// Calculate parsing tokens per second from prompt_progress
const parsingTokensPerSecond = promptProgress && promptProgress.time_ms > 0
? (promptProgress.processed / promptProgress.time_ms) * 1000
: undefined;

return {
status: predictedTokens > 0 ? 'generating' : promptProgress ? 'preparing' : 'idle',
tokensDecoded: predictedTokens,
Expand All @@ -267,7 +272,10 @@ export class SlotsService {
speculative: false,
progressPercent,
promptTokens,
cacheTokens
cacheTokens,
parsingTokensPerSecond,
inputTokensProcessed: promptProgress?.processed,
inputTokensTotal: promptProgress?.total
};
}

Expand Down
3 changes: 3 additions & 0 deletions tools/server/webui/src/lib/types/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,7 @@ export interface ApiProcessingState {
progressPercent?: number;
promptTokens?: number;
cacheTokens?: number;
parsingTokensPerSecond?: number;
inputTokensProcessed?: number; // Number of input tokens processed during parsing
inputTokensTotal?: number; // Total number of input tokens to process
}
Loading