@blocksdiy/react-common 1.26.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -30,10 +30,10 @@ const generateId = (length = 10) => {
|
|
|
30
30
|
* Walk the conversation and return every assistant-emitted tool call
|
|
31
31
|
* that has no matching ToolMessage (i.e. is awaiting a result). With
|
|
32
32
|
* our current setup, the only tool that ends up in this state is the
|
|
33
|
-
* frontend
|
|
34
|
-
* run and never appear pending in the UI. Used by `sendFromInputs`
|
|
35
|
-
*
|
|
36
|
-
* instead of
|
|
33
|
+
* frontend user-choice tool; backend tools resolve in the same agent
|
|
34
|
+
* run and never appear pending in the UI. Used by `sendFromInputs` to
|
|
35
|
+
* auto-skip dangling answer UIs when the user types a new message
|
|
36
|
+
* instead of choosing an answer.
|
|
37
37
|
*/
|
|
38
38
|
const _collectPendingToolCalls = (messages) => {
|
|
39
39
|
const toolMessageIds = new Set();
|
|
@@ -307,14 +307,14 @@ const ChatInitializer = ({ agentId, agentChatId, chatId, token, appId, component
|
|
|
307
307
|
// const currentAttachments = attachments;
|
|
308
308
|
setPrompt("");
|
|
309
309
|
setAttachments([]);
|
|
310
|
-
// Auto-skip any
|
|
310
|
+
// Auto-skip any frontend user-choice tool call that's still waiting.
|
|
311
311
|
//
|
|
312
312
|
// If the user types a new message instead of clicking an answer on
|
|
313
|
-
//
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
// * `executingToolCallIds` keeps the toolCallId (the parked
|
|
317
|
-
//
|
|
313
|
+
// the inline form, the agent had returned an assistant message with
|
|
314
|
+
// a tool call and is parked awaiting a ToolMessage that never arrives.
|
|
315
|
+
// Without intervention here:
|
|
316
|
+
// * `executingToolCallIds` keeps the toolCallId (the parked Promise
|
|
317
|
+
// from useHumanInTheLoop never resolves, so
|
|
318
318
|
// onToolExecutionEnd never fires).
|
|
319
319
|
// * No ToolMessage is ever added, so the render code stays on
|
|
320
320
|
// "executing" → the form looks live forever, the next refresh
|
|
@@ -330,10 +330,10 @@ const ChatInitializer = ({ agentId, agentChatId, chatId, token, appId, component
|
|
|
330
330
|
// (assistant_tool_call → skip_result → new user turn) so the
|
|
331
331
|
// agent can respond coherently.
|
|
332
332
|
//
|
|
333
|
-
// Caveat: we don't (and can't, with the current useHumanInTheLoop
|
|
334
|
-
//
|
|
335
|
-
//
|
|
336
|
-
//
|
|
333
|
+
// Caveat: we don't (and can't, with the current useHumanInTheLoop API)
|
|
334
|
+
// resolve the parked Promise itself — it lingers in memory until page
|
|
335
|
+
// reload. Acceptable: one closure per skip, cleared on refresh, no
|
|
336
|
+
// functional impact.
|
|
337
337
|
if (copilotAgent) {
|
|
338
338
|
const pending = _collectPendingToolCalls(copilotAgent.messages);
|
|
339
339
|
for (const toolCall of pending) {
|