Skip to content
Merged
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
16 changes: 16 additions & 0 deletions ui/desktop/src/hooks/useChatStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ export function useChatStream({
if (cached) {
setSession(cached.session);
updateMessages(cached.messages);
setTokenState({
inputTokens: cached.session?.input_tokens ?? 0,
outputTokens: cached.session?.output_tokens ?? 0,
totalTokens: cached.session?.total_tokens ?? 0,
accumulatedInputTokens: cached.session?.accumulated_input_tokens ?? 0,
accumulatedOutputTokens: cached.session?.accumulated_output_tokens ?? 0,
accumulatedTotalTokens: cached.session?.accumulated_total_tokens ?? 0,
});
Comment on lines +215 to +222
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This token state initialization logic is duplicated. Extract it into a helper function to avoid maintenance issues if the token state structure changes.

Copilot generated this review using guidance from repository custom instructions.
setChatState(ChatState.Idle);
return;
}
Expand Down Expand Up @@ -241,6 +249,14 @@ export function useChatStream({
const session = response.data;
setSession(session);
updateMessages(session?.conversation || []);
setTokenState({
inputTokens: session?.input_tokens ?? 0,
outputTokens: session?.output_tokens ?? 0,
totalTokens: session?.total_tokens ?? 0,
accumulatedInputTokens: session?.accumulated_input_tokens ?? 0,
accumulatedOutputTokens: session?.accumulated_output_tokens ?? 0,
accumulatedTotalTokens: session?.accumulated_total_tokens ?? 0,
});
Comment on lines +252 to +259
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This token state initialization logic is duplicated. Extract it into a helper function to avoid maintenance issues if the token state structure changes.

Copilot generated this review using guidance from repository custom instructions.
setChatState(ChatState.Idle);
onSessionLoaded?.();
} catch (error) {
Expand Down
Loading