natureco-cli 2.23.6 → 2.23.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "2.23.6",
3
+ "version": "2.23.8",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
@@ -23,6 +23,7 @@
23
23
  "author": "NatureCo",
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
+ "@inquirer/prompts": "^8.5.0",
26
27
  "@whiskeysockets/baileys": "^7.0.0-rc10",
27
28
  "chalk": "^4.1.2",
28
29
  "commander": "^11.1.0",
package/src/utils/api.js CHANGED
@@ -428,7 +428,10 @@ function formatToolsForAnthropic() {
428
428
  * Send message to OpenAI-compatible provider (Groq, OpenAI, Together, etc.)
429
429
  */
430
430
  async function sendMessageOpenAICompatible(providerConfig, messages, tools) {
431
- const endpoint = `${providerConfig.url}/chat/completions`;
431
+ const baseUrl = providerConfig.url.replace(/\/+$/, '');
432
+ const endpoint = baseUrl.includes('api.natureco.me')
433
+ ? `${baseUrl}/api/v1/chat/completions`
434
+ : `${baseUrl}/chat/completions`;
432
435
 
433
436
  const requestBody = {
434
437
  model: providerConfig.model,
@@ -868,7 +871,10 @@ async function streamProviderCompletion(providerConfig, messages, tools) {
868
871
  }
869
872
 
870
873
  async function streamOpenAICompletion(providerConfig, messages, tools) {
871
- const endpoint = `${providerConfig.url}/chat/completions`;
874
+ const baseUrl = providerConfig.url.replace(/\/+$/, '');
875
+ const endpoint = baseUrl.includes('api.natureco.me')
876
+ ? `${baseUrl}/api/v1/chat/completions`
877
+ : `${baseUrl}/chat/completions`;
872
878
 
873
879
  const requestBody = {
874
880
  model: providerConfig.model,
@@ -1,11 +1,32 @@
1
- let promptFn;
1
+ const { select, input, password, confirm } = require('@inquirer/prompts');
2
2
 
3
3
  module.exports = {
4
4
  async prompt(questions) {
5
- if (!promptFn) {
6
- const mod = await import('inquirer');
7
- promptFn = mod.default?.prompt || mod.default || mod.prompt;
5
+ const results = {};
6
+ for (const q of questions) {
7
+ if (q.type === 'list') {
8
+ results[q.name] = await select({
9
+ message: q.message,
10
+ choices: q.choices.map(c =>
11
+ typeof c === 'string' ? { value: c, name: c } : c
12
+ )
13
+ });
14
+ } else if (q.type === 'password') {
15
+ results[q.name] = await password({ message: q.message, mask: q.mask });
16
+ } else if (q.type === 'checkbox') {
17
+ const { checkbox } = require('@inquirer/prompts');
18
+ results[q.name] = await checkbox({
19
+ message: q.message,
20
+ choices: q.choices.map(c =>
21
+ typeof c === 'string' ? { value: c, name: c } : c
22
+ )
23
+ });
24
+ } else if (q.type === 'confirm') {
25
+ results[q.name] = await confirm({ message: q.message, default: q.default });
26
+ } else {
27
+ results[q.name] = await input({ message: q.message, default: q.default });
28
+ }
8
29
  }
9
- return promptFn(questions);
30
+ return results;
10
31
  }
11
32
  };