Refactor CLI input handling to ensure userText is passed correctly and improve output formatting in cli.js. Update package.json and package-lock.json to include 'exa-js' dependency for enhanced functionality. Revise systemprompt.txt to clarify tool usage and streamline instructions.

This commit is contained in:
sebseb7
2025-08-12 03:38:23 +00:00
parent ce6933377a
commit 70fe6fccdb
6 changed files with 116 additions and 15 deletions

6
cli.js
View File

@@ -71,7 +71,7 @@ while(true){
let counter = 0;
// Block for user input before kicking off the LLM loop
const userText = await askUserForInput();
await streamOnce(new OpenAI({ apiKey: process.env.OPENAI_API_KEY }), userText || '');
await streamOnce(new OpenAI({ apiKey: process.env.OPENAI_API_KEY }), userText );
async function streamOnce(openai, userText) {
const toolsByFile = await loadTools();
let previousResponseId;
@@ -142,7 +142,7 @@ while(true){
stream.on('response.completed', async (event) => {
printIndented(10,renderUsage(event.response.usage));
if (event.response.output.filter(i => i.type === 'message').length > 0) printIndented(10, "Textresult:",event.response.output.filter(i => i.type === 'message').map(i => i.content[0].text));
if (event.response.output.filter(i => i.type === 'message').length > 0) printIndented(10,event.response.output.filter(i => i.type === 'message').map(i => i.content[0].text).join('\n'));
});
await Array.fromAsync(stream);
@@ -165,4 +165,4 @@ while(true){
//console.log('OPENAI STREAM FINISHED');
}
}
}