natureco-cli 2.23.20 → 2.23.21
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.
- package/package.json +1 -1
- package/src/utils/api.js +13 -3
package/package.json
CHANGED
package/src/utils/api.js
CHANGED
|
@@ -599,13 +599,23 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
|
|
|
599
599
|
: await sendMessageOpenAICompatible(providerConfig, messages, tools);
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
-
|
|
602
|
+
if (!assistantMessage) {
|
|
603
|
+
return {
|
|
604
|
+
reply: 'No response from provider',
|
|
605
|
+
conversation_id: convId,
|
|
606
|
+
message_id: `msg_${Date.now()}`,
|
|
607
|
+
success: false
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
debugLog('[Provider] Response type:', assistantMessage?.tool_calls ? 'tool_calls' : 'text');
|
|
603
612
|
|
|
604
613
|
// Add assistant message to history
|
|
605
614
|
messages.push(assistantMessage);
|
|
606
615
|
|
|
607
616
|
// Check for tool calls
|
|
608
|
-
|
|
617
|
+
const hasToolCalls = assistantMessage?.tool_calls?.length > 0;
|
|
618
|
+
if (hasToolCalls) {
|
|
609
619
|
debugLog(`[Provider] Tool calls: ${assistantMessage.tool_calls.length}`);
|
|
610
620
|
|
|
611
621
|
// Separate local and MCP tool calls
|
|
@@ -666,7 +676,7 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
|
|
|
666
676
|
}
|
|
667
677
|
|
|
668
678
|
// No tool calls, we have final response
|
|
669
|
-
finalResponse = assistantMessage
|
|
679
|
+
finalResponse = assistantMessage?.content;
|
|
670
680
|
break;
|
|
671
681
|
}
|
|
672
682
|
|