@flowfuse/nr-assistant
Advanced tools
Comparing version 0.1.0 to 0.1.1-1e916c9-202407091341.0
@@ -30,5 +30,5 @@ module.exports = (RED) => { | ||
RED.httpAdmin.post('/nr-assistant/:method', RED.auth.needsPermission('write'), function (req, res) { | ||
const method = req.params.method || 'fn' | ||
const method = req.params.method | ||
// limit method to prevent path traversal | ||
if (/[^a-zA-Z0-9-_]/.test(method)) { | ||
if (!method || typeof method !== 'string' || /[^a-z0-9-_]/.test(method)) { | ||
res.status(400) | ||
@@ -39,4 +39,3 @@ res.json({ status: 'error', message: 'Invalid method' }) | ||
const input = req.body | ||
const prompt = input.prompt | ||
if (!input.prompt) { | ||
if (!input || !input.prompt || typeof input.prompt !== 'string') { | ||
res.status(400) | ||
@@ -47,3 +46,3 @@ res.json({ status: 'error', message: 'prompt is required' }) | ||
const body = { | ||
prompt, // this is the prompt to the AI | ||
prompt: input.prompt, // this is the prompt to the AI | ||
promptHint: input.promptHint, // this is used to let the AI know what we are generating (`function node? Node JavaScript? flow?) | ||
@@ -50,0 +49,0 @@ context: input.context, // this is used to provide additional context to the AI (e.g. the selected text of the function node) |
{ | ||
"name": "@flowfuse/nr-assistant", | ||
"version": "0.1.0", | ||
"version": "0.1.1-1e916c9-202407091341.0", | ||
"description": "FlowFuse Node-RED assistant plugin", | ||
@@ -47,2 +47,2 @@ "main": "index.js", | ||
} | ||
} | ||
} |
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
58595
10
72