natureco-cli 2.23.21 → 2.23.23
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/commands/code.js +13 -6
package/package.json
CHANGED
package/src/commands/code.js
CHANGED
|
@@ -194,15 +194,16 @@ async function generateCommitMessage(diff, providerConfig) {
|
|
|
194
194
|
|
|
195
195
|
async function streamMessage(providerConfig, messages, tools) {
|
|
196
196
|
const result = await streamProviderCompletion(providerConfig, messages, tools);
|
|
197
|
+
if (!result) return { text: '', toolCalls: [] };
|
|
197
198
|
if (result.type === 'text') {
|
|
198
199
|
return { text: result.content, toolCalls: [] };
|
|
199
200
|
}
|
|
200
|
-
const toolCalls = result
|
|
201
|
+
const toolCalls = result?.message?.tool_calls?.map(tc => ({
|
|
201
202
|
id: tc.id,
|
|
202
203
|
name: tc.function.name,
|
|
203
204
|
input: (() => { try { return JSON.parse(tc.function.arguments); } catch { return {}; } })(),
|
|
204
|
-
}));
|
|
205
|
-
return { text: result
|
|
205
|
+
})) || [];
|
|
206
|
+
return { text: result?.message?.content || '', toolCalls };
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
// ── Tool execution ────────────────────────────────────────────────────────────
|
|
@@ -602,7 +603,7 @@ ${indexPrompt}`;
|
|
|
602
603
|
}
|
|
603
604
|
}
|
|
604
605
|
|
|
605
|
-
if (userMessage === 'exit' || userMessage === 'quit') {
|
|
606
|
+
if (userMessage === 'exit' || userMessage === 'quit' || userMessage === 'çıkış' || userMessage === 'q') {
|
|
606
607
|
showSummary();
|
|
607
608
|
process.exit(0);
|
|
608
609
|
}
|
|
@@ -628,6 +629,12 @@ ${indexPrompt}`;
|
|
|
628
629
|
return;
|
|
629
630
|
}
|
|
630
631
|
|
|
632
|
+
if (!streamResult) {
|
|
633
|
+
console.log(chalk.red('\nNo response received\n'));
|
|
634
|
+
conversationMessages.pop();
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
|
|
631
638
|
const assistantMsg = { role: 'assistant', content: streamResult.text || '' };
|
|
632
639
|
if (streamResult.toolCalls?.length) {
|
|
633
640
|
assistantMsg.tool_calls = streamResult.toolCalls.map(tc => ({
|
|
@@ -645,7 +652,7 @@ ${indexPrompt}`;
|
|
|
645
652
|
break;
|
|
646
653
|
}
|
|
647
654
|
|
|
648
|
-
console.log(chalk.yellow(`\n🔧 ${streamResult
|
|
655
|
+
console.log(chalk.yellow(`\n🔧 ${streamResult?.toolCalls?.length ?? 0} tool çalıştırılıyor...\n`));
|
|
649
656
|
|
|
650
657
|
for (let ti = 0; ti < streamResult.toolCalls.length; ti++) {
|
|
651
658
|
const toolCall = streamResult.toolCalls[ti];
|
|
@@ -718,7 +725,7 @@ ${indexPrompt}`;
|
|
|
718
725
|
}
|
|
719
726
|
|
|
720
727
|
async function promptLoop() {
|
|
721
|
-
rl.question('', async (msg) => {
|
|
728
|
+
rl.question(chalk.gray('> '), async (msg) => {
|
|
722
729
|
process.stdout.write('\x1b[1A\x1b[2K');
|
|
723
730
|
try {
|
|
724
731
|
await handleMessage(msg);
|