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