natureco-cli 2.23.13 → 2.23.15
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 -7
package/package.json
CHANGED
package/src/utils/api.js
CHANGED
|
@@ -432,6 +432,7 @@ async function sendMessageOpenAICompatible(providerConfig, messages, tools) {
|
|
|
432
432
|
const endpoint = baseUrl.includes('api.natureco.me')
|
|
433
433
|
? 'https://api.natureco.me/api/v1/chat/completions'
|
|
434
434
|
: `${baseUrl}/chat/completions`;
|
|
435
|
+
console.error('DEBUG endpoint:', endpoint);
|
|
435
436
|
|
|
436
437
|
const requestBody = {
|
|
437
438
|
model: providerConfig.model,
|
|
@@ -463,14 +464,16 @@ async function sendMessageOpenAICompatible(providerConfig, messages, tools) {
|
|
|
463
464
|
}
|
|
464
465
|
|
|
465
466
|
const data = await response.json();
|
|
466
|
-
console.error('DEBUG response:', JSON.stringify(data).slice(0,
|
|
467
|
+
console.error('DEBUG response raw:', JSON.stringify(data).slice(0, 300));
|
|
468
|
+
const content = data.choices?.[0]?.message?.content
|
|
469
|
+
|| data.choices?.[0]?.text
|
|
470
|
+
|| data.response
|
|
471
|
+
|| data.content
|
|
472
|
+
|| '';
|
|
473
|
+
console.error('DEBUG content:', content);
|
|
467
474
|
return {
|
|
468
475
|
role: 'assistant',
|
|
469
|
-
content
|
|
470
|
-
|| data.choices?.[0]?.text
|
|
471
|
-
|| data.response
|
|
472
|
-
|| data.content
|
|
473
|
-
|| '',
|
|
476
|
+
content,
|
|
474
477
|
tool_calls: data.choices?.[0]?.message?.tool_calls || undefined,
|
|
475
478
|
};
|
|
476
479
|
}
|
|
@@ -533,6 +536,7 @@ async function sendMessageAnthropic(providerConfig, messages, tools) {
|
|
|
533
536
|
*/
|
|
534
537
|
async function sendMessageToProvider(apiKey, message, conversationId = null, systemPrompt = null, options = {}) {
|
|
535
538
|
const providerConfig = getProviderConfig();
|
|
539
|
+
console.error('DEBUG sendMessageToProvider providerUrl:', providerConfig?.url);
|
|
536
540
|
|
|
537
541
|
if (!providerConfig) {
|
|
538
542
|
throw new Error(
|
|
@@ -731,6 +735,9 @@ function clearConversation(conversationId) {
|
|
|
731
735
|
async function sendMessage(apiKey, botId, message, conversationId = null, chatSystemPrompt = '', options = {}) {
|
|
732
736
|
// Handle legacy 6th param (toolDefinitions array was passed)
|
|
733
737
|
if (Array.isArray(options)) options = {};
|
|
738
|
+
const providerConfig = getProviderConfig();
|
|
739
|
+
console.error('DEBUG providerUrl:', providerConfig?.url);
|
|
740
|
+
console.error('DEBUG provider type:', providerConfig?.isAnthropic ? 'anthropic' : 'openai');
|
|
734
741
|
// Get user's home directory
|
|
735
742
|
const homeDir = os.homedir();
|
|
736
743
|
|
|
@@ -740,7 +747,6 @@ async function sendMessage(apiKey, botId, message, conversationId = null, chatSy
|
|
|
740
747
|
|
|
741
748
|
// Get config to check MCP status
|
|
742
749
|
const config = getConfig();
|
|
743
|
-
const providerConfig = getProviderConfig();
|
|
744
750
|
|
|
745
751
|
// NatureCo — minimal system prompt, skip tool descriptions/MCP
|
|
746
752
|
if (providerConfig && providerConfig.url.includes('api.natureco.me')) {
|