Skip to content

Commit 8fbb439

Browse files
committed
Set correct tasks_id in V2 API
1 parent 3d29873 commit 8fbb439

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

web/src/helpers/LLM/remote.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ToolCalls } from '../../state/chat/reducer'
1+
import { ToolCalls, UserChatMessage } from '../../state/chat/reducer'
22
import { LLMResponse, LLMResponseV2, CompletedToolCalls } from './types'
33
import { PlanActionsParams } from '.'
44
import { 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

0 commit comments

Comments
 (0)