Skip to content

Commit

Permalink
merge stash
Browse files Browse the repository at this point in the history
  • Loading branch information
sestinj committed Nov 26, 2024
1 parent 6ff5279 commit d9b5540
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions gui/src/redux/selectors/selectLastToolCall.ts
Original file line number Diff line number Diff line change
@@ -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;
},
);

0 comments on commit d9b5540

Please sign in to comment.