diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 5683c2d9b2..ad4d6f383f 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -340,17 +340,17 @@ export class Task extends EventEmitter { await this.saveClineMessages() } - private async updateClineMessage(partialMessage: ClineMessage) { + private async updateClineMessage(message: ClineMessage) { const provider = this.providerRef.deref() - await provider?.postMessageToWebview({ type: "partialMessage", partialMessage }) - this.emit("message", { action: "updated", message: partialMessage }) + await provider?.postMessageToWebview({ type: "messageUpdated", clineMessage: message }) + this.emit("message", { action: "updated", message }) - const shouldCaptureMessage = partialMessage.partial !== true && CloudService.isEnabled() + const shouldCaptureMessage = message.partial !== true && CloudService.isEnabled() if (shouldCaptureMessage) { CloudService.instance.captureEvent({ event: TelemetryEventName.TASK_MESSAGE, - properties: { taskId: this.taskId, message: partialMessage }, + properties: { taskId: this.taskId, message }, }) } } diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index a488807d81..07d300ed01 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -35,7 +35,7 @@ export interface ExtensionMessage { | "theme" | "workspaceUpdated" | "invoke" - | "partialMessage" + | "messageUpdated" | "mcpServers" | "enhancedPrompt" | "commitSearchResults" @@ -92,7 +92,7 @@ export interface ExtensionMessage { isActive: boolean path?: string }> - partialMessage?: ClineMessage + clineMessage?: ClineMessage routerModels?: RouterModels openAiModels?: string[] ollamaModels?: string[] diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index 15e8ca9f72..9b73ff00c0 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -263,14 +263,14 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode setOpenedTabs(tabs) break } - case "partialMessage": { - const partialMessage = message.partialMessage! + case "messageUpdated": { + const clineMessage = message.clineMessage! setState((prevState) => { // worth noting it will never be possible for a more up-to-date message to be sent here or in normal messages post since the presentAssistantContent function uses lock - const lastIndex = findLastIndex(prevState.clineMessages, (msg) => msg.ts === partialMessage.ts) + const lastIndex = findLastIndex(prevState.clineMessages, (msg) => msg.ts === clineMessage.ts) if (lastIndex !== -1) { const newClineMessages = [...prevState.clineMessages] - newClineMessages[lastIndex] = partialMessage + newClineMessages[lastIndex] = clineMessage return { ...prevState, clineMessages: newClineMessages } } return prevState