mirror of
https://github.com/andrepimenta/claude-code-chat.git
synced 2025-12-10 06:29:44 +00:00
Fix request start time isProcessing
This commit is contained in:
@@ -440,7 +440,7 @@ class ClaudeChatProvider {
|
||||
// Set processing state to true
|
||||
this._postMessage({
|
||||
type: 'setProcessing',
|
||||
data: true
|
||||
data: {isProcessing: true}
|
||||
});
|
||||
|
||||
// Create backup commit before Claude makes changes
|
||||
@@ -784,7 +784,7 @@ class ClaudeChatProvider {
|
||||
// Clear processing state
|
||||
this._postMessage({
|
||||
type: 'setProcessing',
|
||||
data: false
|
||||
data: {isProcessing: false}
|
||||
});
|
||||
|
||||
// Update cumulative tracking
|
||||
@@ -866,7 +866,7 @@ class ClaudeChatProvider {
|
||||
// Clear processing state
|
||||
this._postMessage({
|
||||
type: 'setProcessing',
|
||||
data: false
|
||||
data: {isProcessing: false}
|
||||
});
|
||||
|
||||
// Show login required message
|
||||
@@ -1744,17 +1744,11 @@ class ClaudeChatProvider {
|
||||
|
||||
private _sendAndSaveMessage(message: { type: string, data: any }, options?: { isProcessing?: boolean }): void {
|
||||
|
||||
console.log("--MESSAGE", message, options)
|
||||
|
||||
// Initialize conversation if this is the first message
|
||||
if (this._currentConversation.length === 0) {
|
||||
this._conversationStartTime = new Date().toISOString();
|
||||
}
|
||||
|
||||
if (message.type === 'sessionInfo') {
|
||||
message.data.sessionId;
|
||||
}
|
||||
|
||||
// Send to UI using the helper method
|
||||
this._postMessage(message);
|
||||
|
||||
@@ -1916,6 +1910,14 @@ class ClaudeChatProvider {
|
||||
|
||||
private _stopClaudeProcess(): void {
|
||||
console.log('Stop request received');
|
||||
|
||||
this._isProcessing = false
|
||||
|
||||
// Update UI state
|
||||
this._postMessage({
|
||||
type: 'setProcessing',
|
||||
data: {isProcessing: false}
|
||||
});
|
||||
|
||||
if (this._currentClaudeProcess) {
|
||||
console.log('Terminating Claude process...');
|
||||
@@ -1933,11 +1935,6 @@ class ClaudeChatProvider {
|
||||
|
||||
// Clear process reference
|
||||
this._currentClaudeProcess = undefined;
|
||||
// Update UI state
|
||||
this._postMessage({
|
||||
type: 'setProcessing',
|
||||
data: false
|
||||
});
|
||||
|
||||
this._postMessage({
|
||||
type: 'clearLoading'
|
||||
@@ -2024,6 +2021,8 @@ class ClaudeChatProvider {
|
||||
type: 'sessionCleared'
|
||||
});
|
||||
|
||||
let requestStartTime: number
|
||||
|
||||
// Small delay to ensure messages are cleared before loading new ones
|
||||
setTimeout(() => {
|
||||
for (const message of this._currentConversation) {
|
||||
@@ -2031,6 +2030,13 @@ class ClaudeChatProvider {
|
||||
type: message.messageType,
|
||||
data: message.data
|
||||
});
|
||||
if(message.messageType === 'userInput'){
|
||||
try{
|
||||
requestStartTime = new Date(message.timestamp).getTime()
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send updated totals
|
||||
@@ -2049,7 +2055,7 @@ class ClaudeChatProvider {
|
||||
this._isProcessing = conversationData.isProcessing;
|
||||
this._postMessage({
|
||||
type: 'setProcessing',
|
||||
data: conversationData.isProcessing
|
||||
data: {isProcessing: conversationData.isProcessing, requestStartTime}
|
||||
});
|
||||
}
|
||||
// Send ready message after conversation is loaded
|
||||
|
||||
@@ -1494,8 +1494,8 @@ const html = `<!DOCTYPE html>
|
||||
}
|
||||
}
|
||||
|
||||
function startRequestTimer() {
|
||||
requestStartTime = Date.now();
|
||||
function startRequestTimer(startTime = undefined) {
|
||||
requestStartTime = startTime || Date.now();
|
||||
// Update status every 100ms for smooth real-time display
|
||||
requestTimer = setInterval(() => {
|
||||
if (isProcessing) {
|
||||
@@ -2533,9 +2533,9 @@ const html = `<!DOCTYPE html>
|
||||
break;
|
||||
|
||||
case 'setProcessing':
|
||||
isProcessing = message.data;
|
||||
isProcessing = message.data.isProcessing;
|
||||
if (isProcessing) {
|
||||
startRequestTimer();
|
||||
startRequestTimer(message.data.requestStartTime);
|
||||
showStopButton();
|
||||
disableButtons();
|
||||
} else {
|
||||
@@ -2584,7 +2584,6 @@ const html = `<!DOCTYPE html>
|
||||
break;
|
||||
|
||||
case 'sessionInfo':
|
||||
console.log('Session info:', message.data);
|
||||
if (message.data.sessionId) {
|
||||
showSessionInfo(message.data.sessionId);
|
||||
// Show detailed session information
|
||||
|
||||
Reference in New Issue
Block a user