File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1404,6 +1404,11 @@ async function promptGPT(systemPrompt, input) {
14041404 case "reasoning" :
14051405 hasReasoningFromAPI = true ; // Mark that we're receiving reasoning from API
14061406 if ( eventData . content ) {
1407+ // Count tokens for rate calculation (thinking/reasoning)
1408+ const reasoningRequest = activeRequests . get ( chatId ) ;
1409+ if ( reasoningRequest ) {
1410+ reasoningRequest . tokensReceived += Math . ceil ( eventData . content . length / 4 ) ;
1411+ }
14071412 const currentChat = chatStore . getChat ( chatId ) ;
14081413 if ( ! currentChat ) break ; // Chat was deleted
14091414 const isMCPMode = currentChat . mcpMode || false ;
@@ -1959,6 +1964,11 @@ async function promptGPT(systemPrompt, input) {
19591964 if ( reasoningDelta && reasoningDelta . trim ( ) !== "" ) {
19601965 hasReasoningFromAPI = true ; // Mark that we're receiving reasoning from API
19611966 reasoningContent += reasoningDelta ;
1967+ // Count tokens for rate calculation (thinking/reasoning)
1968+ const reasoningRequest = activeRequests . get ( chatId ) ;
1969+ if ( reasoningRequest ) {
1970+ reasoningRequest . tokensReceived += Math . ceil ( reasoningDelta . length / 4 ) ;
1971+ }
19621972 const currentChat = chatStore . getChat ( chatId ) ;
19631973 if ( ! currentChat ) {
19641974 // Chat was deleted, skip this line
You can’t perform that action at this time.
0 commit comments