@react-frameui/loki-ai 1.0.0 → 1.0.2

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.
@@ -111,14 +111,18 @@ Assistant:`;
111
111
  // Initial pass (Non-streaming to catch JSON better, or standard)
112
112
  // We use generated promise wrapper to allow abort
113
113
  let initialResponse = await provider.generate(fullPrompt, undefined, options.signal);
114
- // Check for JSON tool call
115
- const toolRegex = /```json\s*(\{.*"tool":.*\})\s*```/s;
114
+ // Check for empty response
115
+ if (!initialResponse || initialResponse.trim() === '') {
116
+ throw new Error('LLM returned an empty response. Check if the model is loaded correctly.');
117
+ }
118
+ // Check for JSON tool call (support both markdown block and raw JSON)
119
+ const toolRegex = /(?:```json\s*)?(\{.*"tool":.*\})(?:\s*```)?/s;
116
120
  const match = initialResponse.match(toolRegex);
117
121
  if (match) {
118
122
  try {
119
123
  const toolCall = JSON.parse(match[1]);
120
124
  if (options.onToken)
121
- options.onToken(`[Executing ${toolCall.tool}...] `);
125
+ options.onToken(`\u001b[33m[Executing ${toolCall.tool}...]\u001b[0m\n`);
122
126
  const toolResult = await (0, toolRegistry_1.executeToolCall)(toolCall.tool, toolCall.args);
123
127
  fullPrompt += `\n${initialResponse}\n\nTool Output: ${toolResult}\n\nAssistant (Interpreting result):`;
124
128
  // Final Response
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-frameui/loki-ai",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "LOKI - Local Omni Knowledge Interface. A powerful CLI AI assistant with tools, memory, WhatsApp integration, and more.",
5
5
  "keywords": [
6
6
  "ai",
@@ -71,4 +71,4 @@
71
71
  "engines": {
72
72
  "node": ">=18.0.0"
73
73
  }
74
- }
74
+ }