@lvx74/openrrouter-ai-agent 1.0.6 → 1.0.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 +1 -1
- package/src/Agent.js +5 -1
- package/src/Tool.js +1 -1
- package/src/cli.js +4 -2
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lvx74/openrrouter-ai-agent",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.8",
|
4
4
|
"description": "A powerful AI agent toolkit compatible with @openai/agents for building conversational AI with tool calling support using OpenRouter",
|
5
5
|
"type": "module",
|
6
6
|
"main": "src/index.js",
|
package/src/Agent.js
CHANGED
@@ -90,7 +90,11 @@ export class Agent extends EventEmitter {
|
|
90
90
|
*/
|
91
91
|
async step() {
|
92
92
|
const toolDefinitions = this.getToolDefinitions()
|
93
|
-
|
93
|
+
if (this.verbose) {
|
94
|
+
console.log('Esecuzione step con', this.messages.length, 'messaggi e', toolDefinitions.length, 'tools')
|
95
|
+
console.log('Ultimo messaggio:', this.getLastMessage())
|
96
|
+
console.log('Tools:', toolDefinitions.map(t => t.name).join(', '))
|
97
|
+
}
|
94
98
|
const res = await this.openai.chat.completions.create({
|
95
99
|
model: this.model,
|
96
100
|
messages: this.messages,
|
package/src/Tool.js
CHANGED
package/src/cli.js
CHANGED
@@ -18,14 +18,16 @@ export function createChatInterface(agent, options = {}) {
|
|
18
18
|
historyFile = null
|
19
19
|
} = options
|
20
20
|
|
21
|
-
if (historyFile &&
|
21
|
+
if (historyFile && fs.existsSync(historyFile)) {
|
22
22
|
try {
|
23
|
-
agent.setHistory(fs.readFileSync(historyFile, 'utf8'))
|
23
|
+
agent.setHistory(JSON.parse(fs.readFileSync(historyFile, 'utf8')))
|
24
24
|
console.log(`\n📜 Cronologia caricata da ${historyFile}`)
|
25
25
|
} catch (error) {
|
26
26
|
console.error(`\n❌ Errore nel caricamento della cronologia: ${error.message}`)
|
27
27
|
return
|
28
28
|
}
|
29
|
+
}else if (historyFile) {
|
30
|
+
console.log(`\n📜 Cronologia non trovata, ne verrà creata una nuova in ${historyFile}`)
|
29
31
|
}
|
30
32
|
|
31
33
|
const rl = readline.createInterface({
|