File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1- import { ToolCalls } from '../../state/chat/reducer'
1+ import { ToolCalls , UserChatMessage } from '../../state/chat/reducer'
22import { LLMResponse , LLMResponseV2 , CompletedToolCalls } from './types'
33import { PlanActionsParams } from '.'
44import { getLLMResponse } from '../../app/api'
@@ -245,8 +245,10 @@ export async function planActionsRemoteV2({
245245 throw new Error ( 'No user message found in thread' )
246246 }
247247
248- const lastUserMessage = messageHistory [ lastUserMessageIdx ]
249- const tasks_id = lastUserMessage . tasks_id || null
248+ const lastTasksIdMessage = messageHistory . findLast ( ( message , idx ) => {
249+ return message . role === 'user' && message . tasks_id
250+ } ) as UserChatMessage
251+ const tasks_id = lastTasksIdMessage ?. tasks_id
250252
251253 // Extract completed tool calls from the last 'pending' planner response only
252254 // Find the last assistant message with actions from pending source
You can’t perform that action at this time.
0 commit comments