Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions src/core/task/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,17 @@ export class Task extends EventEmitter<ClineEvents> {
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 },
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/shared/ExtensionMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface ExtensionMessage {
| "theme"
| "workspaceUpdated"
| "invoke"
| "partialMessage"
| "messageUpdated"
| "mcpServers"
| "enhancedPrompt"
| "commitSearchResults"
Expand Down Expand Up @@ -92,7 +92,7 @@ export interface ExtensionMessage {
isActive: boolean
path?: string
}>
partialMessage?: ClineMessage
clineMessage?: ClineMessage
routerModels?: RouterModels
openAiModels?: string[]
ollamaModels?: string[]
Expand Down
8 changes: 4 additions & 4 deletions webview-ui/src/context/ExtensionStateContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading