@@ -337,7 +337,7 @@ func (m *messageListCmp) updateToolCalls(msg message.Message, existingToolCalls
337 var cmds []tea.Cmd
337 var cmds []tea.Cmd
339 for _, tc := range msg.ToolCalls() {
339 for _, tc := range msg.ToolCalls() {
340− if cmd := m.updateOrAddToolCall(tc, existingToolCalls, msg.ID); cmd != nil {
340+ if cmd := m.updateOrAddToolCall(msg, tc, existingToolCalls); cmd != nil {
341 cmds = append(cmds, cmd)
341 cmds = append(cmds, cmd)
@@ -346,18 +346,21 @@ func (m *messageListCmp) updateToolCalls(msg message.Message, existingToolCalls
348// updateOrAddToolCall updates an existing tool call or adds a new one.
348// updateOrAddToolCall updates an existing tool call or adds a new one.
349−func (m *messageListCmp) updateOrAddToolCall(tc message.ToolCall, existingToolCalls map[int]messages.ToolCallCmp, messageID string) tea.Cmd {
349+func (m *messageListCmp) updateOrAddToolCall(msg message.Message, tc message.ToolCall, existingToolCalls map[int]messages.ToolCallCmp) tea.Cmd {
350 // Try to find existing tool call
350 // Try to find existing tool call
351 for index, existingTC := range existingToolCalls {
351 for index, existingTC := range existingToolCalls {
352 if tc.ID == existingTC.GetToolCall().ID {
352 if tc.ID == existingTC.GetToolCall().ID {
353 existingTC.SetToolCall(tc)
353 existingTC.SetToolCall(tc)
354+ if msg.FinishPart() != nil && msg.FinishPart().Reason == message.FinishReasonCanceled {
355+ existingTC.SetCancelled()
354 m.listCmp.UpdateItem(index, existingTC)
357 m.listCmp.UpdateItem(index, existingTC)
355 return nil
358 return nil
359 // Add new tool call if not found
362 // Add new tool call if not found
360− return m.listCmp.AppendItem(messages.NewToolCallCmp(messageID, tc))
363+ return m.listCmp.AppendItem(messages.NewToolCallCmp(msg.ID, tc))
363// handleNewAssistantMessage processes new assistant messages and their tool calls.
366// handleNewAssistantMessage processes new assistant messages and their tool calls.