merge stash

This commit is contained in:
Nate 2024-11-26 13:40:21 -08:00
parent 6ff5279b02
commit d9b55400ba

View file

@ -0,0 +1,15 @@
import { createSelector } from "@reduxjs/toolkit";
import { ToolCallState } from "core";
import { RootState } from "../store";
export const selectLastToolCall = createSelector(
[(store: RootState) => store.state.history],
(history): ToolCallState | null => {
const lastToolCallHistoryItem = history.findLast(
(item) =>
item.message.role === "assistant" && item.message.toolCalls?.length,
);
if (!lastToolCallHistoryItem) return null;
return lastToolCallHistoryItem.toolCallState;
},
);