| 1 | import { ToolCallState } from "core"; |
| 2 | import { RootState } from "../store"; |
| 3 | |
| 4 | export function findCurrentToolCall( |
| 5 | chatHistory: RootState["session"]["history"], |
| 6 | ): ToolCallState | undefined { |
| 7 | return chatHistory[chatHistory.length - 1]?.toolCallState; |
| 8 | } |
| 9 | |
| 10 | export function findToolCall( |
| 11 | chatHistory: RootState["session"]["history"], |
| 12 | toolCallId: string, |
| 13 | ): ToolCallState | undefined { |
| 14 | return chatHistory.find( |
| 15 | (item) => item.toolCallState?.toolCallId === toolCallId, |
| 16 | )?.toolCallState; |
| 17 | } |