nyxora 1.1.3 → 1.1.6

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.
@@ -27,9 +27,13 @@ function getOpenAI() {
27
27
  }
28
28
  // Get API key from config (UI) or fallback to .env
29
29
  let apiKey = '';
30
- if (config.llm.api_keys && config.llm.api_keys.length > 0) {
30
+ let configuredKeys = config.llm.api_keys;
31
+ if (typeof configuredKeys === 'string') {
32
+ configuredKeys = [configuredKeys];
33
+ }
34
+ if (Array.isArray(configuredKeys) && configuredKeys.length > 0) {
31
35
  // Filter out empty keys
32
- const keys = config.llm.api_keys.filter(k => k.trim() !== '');
36
+ const keys = configuredKeys.filter(k => typeof k === 'string' && k.trim() !== '');
33
37
  if (keys.length > 0) {
34
38
  currentKeyIndex = currentKeyIndex % keys.length;
35
39
  apiKey = keys[currentKeyIndex];
@@ -111,8 +115,13 @@ async function processUserInput(input, role = 'user') {
111
115
  // Format messages for OpenAI
112
116
  const messages = [
113
117
  { role: 'system', content: getSystemPrompt() },
114
- ...history.map(m => {
115
- const msg = { role: m.role, content: m.content || "" };
118
+ ...history
119
+ .filter(m => !(m.role === 'tool' && !m.tool_call_id))
120
+ .map(m => {
121
+ let role = m.role;
122
+ if (role === 'system')
123
+ role = 'user';
124
+ const msg = { role, content: m.content || "" };
116
125
  if (m.name)
117
126
  msg.name = m.name;
118
127
  if (m.tool_call_id)
@@ -195,8 +204,13 @@ async function processUserInput(input, role = 'user') {
195
204
  // Second call to get the final answer after tool execution
196
205
  const secondMessages = [
197
206
  { role: 'system', content: getSystemPrompt() },
198
- ...exports.logger.getHistory().map(m => {
199
- const msg = { role: m.role, content: m.content || "" };
207
+ ...exports.logger.getHistory()
208
+ .filter(m => !(m.role === 'tool' && !m.tool_call_id))
209
+ .map(m => {
210
+ let role = m.role;
211
+ if (role === 'system')
212
+ role = 'user';
213
+ const msg = { role, content: m.content || "" };
200
214
  if (m.name)
201
215
  msg.name = m.name;
202
216
  if (m.tool_call_id)
@@ -119,6 +119,8 @@ app.post('/api/transactions/:id/approve', async (req, res) => {
119
119
  // Add programmatic beautiful message directly to chat
120
120
  const prettyMsg = (0, formatter_1.formatTransactionSuccess)(tx, result);
121
121
  reasoning_1.logger.addEntry({ role: 'assistant', content: `✅ Transaction processed:\n\n${prettyMsg}` });
122
+ // Add tool message so the UI can render the beautiful JSON widget!
123
+ reasoning_1.logger.addEntry({ role: 'tool', name: tx.type === 'swap' ? 'swap_token' : 'transfer_native', content: result });
122
124
  // Background update to LLM
123
125
  (0, reasoning_1.processUserInput)(`Transaction ${id} was APPROVED and EXECUTED by the user via Dashboard. Result: ${result}`, 'system').catch(() => { });
124
126
  res.json({ success: true, result });
@@ -81,6 +81,9 @@ function startTelegramBot() {
81
81
  transactionManager_1.txManager.updateStatus(txId, 'executed', result);
82
82
  const prettyMsg = (0, formatter_1.formatTransactionSuccess)(tx, result);
83
83
  bot.sendMessage(chatId, `✅ Transaction processed:\n\n${prettyMsg}`);
84
+ // Sync with dashboard
85
+ reasoning_1.logger.addEntry({ role: 'assistant', content: `✅ Transaction processed:\n\n${prettyMsg}` });
86
+ reasoning_1.logger.addEntry({ role: 'tool', name: tx.type === 'swap' ? 'swap_token' : 'transfer_native', content: result });
84
87
  // Background update to LLM
85
88
  (0, reasoning_1.processUserInput)(`Transaction ${txId} was APPROVED via Telegram. Result: ${result}`, 'system').catch(() => { });
86
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nyxora",
3
- "version": "1.1.3",
3
+ "version": "1.1.6",
4
4
  "description": "",
5
5
  "main": "dist/gateway/cli.js",
6
6
  "files": [