@flowfuse/nr-assistant
Advanced tools
Comparing version 0.1.2-b3dc6d0-202407160719.0 to 0.1.2
20
index.js
@@ -66,7 +66,19 @@ module.exports = (RED) => { | ||
}).catch((error) => { | ||
const errorData = { status: 'error', message: 'Request to FlowFuse Assistant was unsuccessful', body: error.response?.body } | ||
let body = error.response?.body | ||
if (typeof body === 'string') { | ||
try { | ||
body = JSON.parse(body) | ||
} catch (e) { | ||
// ignore | ||
} | ||
} | ||
let message = 'FlowFuse Assistant request was unsuccessful' | ||
const errorData = { status: 'error', message, body } | ||
const errorCode = error.response?.statusCode || 500 | ||
res.status(errorCode).json({ status: 'error', message: errorData }) | ||
console.warn('nr-assistant error:', error) | ||
RED.log.warn('FlowFuse Assistant request was unsuccessful') | ||
res.status(errorCode).json(errorData) | ||
RED.log.trace('nr-assistant error:', error) | ||
if (body && typeof body === 'object' && body.error) { | ||
message = `${message}: ${body.error}` | ||
} | ||
RED.log.warn(message) | ||
}) | ||
@@ -73,0 +85,0 @@ }) |
{ | ||
"name": "@flowfuse/nr-assistant", | ||
"version": "0.1.2-b3dc6d0-202407160719.0", | ||
"version": "0.1.2", | ||
"description": "FlowFuse Node-RED assistant plugin", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,3 +28,3 @@ # FlowFuse Node-RED Assistant | ||
"assistant": { | ||
"enabled": true | ||
"enabled": true, | ||
"url": "https://", // URL of the AI service | ||
@@ -31,0 +31,0 @@ "token": "", // API token for the AI service |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64773
84