Changesets · Branches · Tags · Compare
| Changeset | 7b12c3a0cd8649375d882613166608a5174baba7952c26abdf1b18bf010affe5 |
|---|---|
| Author | xiaohuanxiong3 <39520495+xiaohuanxiong3@users.noreply.github.com> · 2025-09-23 05:31 +08:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-22 14:31 -07:00 |
| Parents | aca660a1e721 |
3 files changed
modified gui/src/redux/selectors/selectToolCalls.ts +3 −1
| @@ -50,7 +50,9 @@ | ||
| 50 | 50 | (_store: RootState, toolCallId: string) => toolCallId, |
| 51 | 51 | ], |
| 52 | 52 | (applyStates, toolCallId) => { |
| 53 | - return applyStates.states.find((state) => state.toolCallId === toolCallId); | |
| 53 | + return applyStates.states.findLast( | |
| 54 | + (state) => state.toolCallId === toolCallId, | |
| 55 | + ); | |
| 54 | 56 | }, |
| 55 | 57 | ); |
| 56 | 58 |
modified gui/src/redux/thunks/streamResponseAfterToolCall.ts +1 −1
| @@ -69,7 +69,7 @@ | ||
| 69 | 69 | |
| 70 | 70 | // Check if we should continue streaming based on tool call completion |
| 71 | 71 | const history = getState().session.history; |
| 72 | - const assistantMessage = history.find( | |
| 72 | + const assistantMessage = history.findLast( | |
| 73 | 73 | (item) => |
| 74 | 74 | item.message.role === "assistant" && |
| 75 | 75 | item.toolCallStates?.some((tc) => tc.toolCallId === toolCallId), |
modified gui/src/redux/util/index.ts +3 −2
| @@ -66,7 +66,8 @@ | ||
| 66 | 66 | chatHistory: RootState["session"]["history"], |
| 67 | 67 | toolCallId: string, |
| 68 | 68 | ): ToolCallState | undefined { |
| 69 | - for (const item of chatHistory) { | |
| 69 | + for (let i = chatHistory.length - 1; i >= 0; i--) { | |
| 70 | + const item = chatHistory[i]; | |
| 70 | 71 | if (item.toolCallStates) { |
| 71 | 72 | const toolCallState = item.toolCallStates.find( |
| 72 | 73 | (state) => state.toolCallId === toolCallId, |
| @@ -84,7 +85,7 @@ | ||
| 84 | 85 | chatHistory: RootState["session"]["history"], |
| 85 | 86 | toolCallId: string, |
| 86 | 87 | ): ChatHistoryItemWithMessageId | undefined { |
| 87 | - return chatHistory.find( | |
| 88 | + return chatHistory.findLast( | |
| 88 | 89 | (item) => |
| 89 | 90 | item.message.role === "tool" && item.message.toolCallId === toolCallId, |
| 90 | 91 | ); |