mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
feat(ui): enhance LoadingIndicator to display token counts and improve formatting
- Added candidatesTokens prop to LoadingIndicator for displaying token counts. - Updated formatting to show elapsed time and token counts inline. - Refactored tests to validate new token display functionality and formatting changes. - Introduced formatTokenCount utility for consistent token count representation. This improves user feedback during loading states by providing clearer information on token usage.
This commit is contained in:
parent
dbfa5b3e8e
commit
03e59256c4
6 changed files with 152 additions and 18 deletions
|
|
@ -27,7 +27,15 @@ export const Composer = () => {
|
|||
const uiActions = useUIActions();
|
||||
const { vimEnabled } = useVimMode();
|
||||
|
||||
const { showAutoAcceptIndicator } = uiState;
|
||||
const { showAutoAcceptIndicator, sessionStats } = uiState;
|
||||
|
||||
const tokens = Object.values(sessionStats.metrics.models).reduce(
|
||||
(acc, model) => ({
|
||||
prompt: acc.prompt + model.tokens.prompt,
|
||||
candidates: acc.candidates + model.tokens.candidates,
|
||||
}),
|
||||
{ prompt: 0, candidates: 0 },
|
||||
);
|
||||
|
||||
// State for keyboard shortcuts display toggle
|
||||
const [showShortcuts, setShowShortcuts] = useState(false);
|
||||
|
|
@ -64,6 +72,7 @@ export const Composer = () => {
|
|||
: uiState.currentLoadingPhrase
|
||||
}
|
||||
elapsedTime={uiState.elapsedTime}
|
||||
candidatesTokens={tokens.candidates}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue