Get rid of "partial" component in names referencing not necessarily partial messages (#4332)

This commit is contained in:
Wojciech Kordalski 2025-06-04 22:55:20 +02:00 committed by GitHub
parent 6f21103545
commit d1876d6af7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 11 deletions

View file

@ -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 },
})
}
}

View file

@ -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[]

View file

@ -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