merge stash
This commit is contained in:
parent
6ff5279b02
commit
d9b55400ba
1 changed files with 15 additions and 0 deletions
15
gui/src/redux/selectors/selectLastToolCall.ts
Normal file
15
gui/src/redux/selectors/selectLastToolCall.ts
Normal 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;
|
||||
},
|
||||
);
|
||||
Loading…
Add table
Reference in a new issue