@manny-est/node-red-flowpilot 0.2.1 → 0.2.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.
- package/flowpilot.html +21 -6
- package/package.json +1 -1
package/flowpilot.html
CHANGED
|
@@ -1036,6 +1036,21 @@
|
|
|
1036
1036
|
// Note: no leading slash. Node-RED serves admin endpoints under a base
|
|
1037
1037
|
// path (httpAdminRoot) that may not be "/". A relative URL respects it.
|
|
1038
1038
|
|
|
1039
|
+
// jQuery's $.ajax (used by ajaxJson) gets the admin-API auth token
|
|
1040
|
+
// attached automatically by Node-RED's editor via $.ajaxSetup, but raw
|
|
1041
|
+
// fetch() calls (used for SSE streaming below) do not. On instances with
|
|
1042
|
+
// adminAuth enabled, an unauthenticated fetch() gets a 401 even though
|
|
1043
|
+
// ajaxJson() calls (preflight, models, settings) succeed.
|
|
1044
|
+
function fetchHeaders() {
|
|
1045
|
+
var headers = { "Content-Type": "application/json" };
|
|
1046
|
+
var tokens = RED.settings.get("auth-tokens");
|
|
1047
|
+
if (tokens && tokens.access_token) {
|
|
1048
|
+
headers.Authorization = "Bearer " + tokens.access_token;
|
|
1049
|
+
headers["Node-RED-API-Version"] = "v2";
|
|
1050
|
+
}
|
|
1051
|
+
return headers;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1039
1054
|
function ajaxJson(method, url, payload, onSuccess, onError) {
|
|
1040
1055
|
$.ajax({
|
|
1041
1056
|
url: url,
|
|
@@ -2348,7 +2363,7 @@
|
|
|
2348
2363
|
|
|
2349
2364
|
fetch("flowpilot/chat", {
|
|
2350
2365
|
method: "POST",
|
|
2351
|
-
headers:
|
|
2366
|
+
headers: fetchHeaders(),
|
|
2352
2367
|
body: JSON.stringify(payload)
|
|
2353
2368
|
}).then(function (resp) {
|
|
2354
2369
|
if (!resp.ok) {
|
|
@@ -2728,7 +2743,7 @@
|
|
|
2728
2743
|
|
|
2729
2744
|
fetch("flowpilot/" + endpoint, {
|
|
2730
2745
|
method: "POST",
|
|
2731
|
-
headers:
|
|
2746
|
+
headers: fetchHeaders(),
|
|
2732
2747
|
body: JSON.stringify(payload)
|
|
2733
2748
|
}).then(function (resp) {
|
|
2734
2749
|
if (!resp.ok) {
|
|
@@ -4934,7 +4949,7 @@
|
|
|
4934
4949
|
border-radius: 4px;
|
|
4935
4950
|
border: 1px solid var(--red-ui-form-input-border-color, #ccc);
|
|
4936
4951
|
background: var(--red-ui-form-input-background, #fff);
|
|
4937
|
-
color: var(--red-ui-form-
|
|
4952
|
+
color: var(--red-ui-form-text-color, #333);
|
|
4938
4953
|
font-family: inherit;
|
|
4939
4954
|
font-size: 13px;
|
|
4940
4955
|
}
|
|
@@ -5280,7 +5295,7 @@
|
|
|
5280
5295
|
border-radius: 5px;
|
|
5281
5296
|
border: 1px solid var(--red-ui-form-input-border-color, #ccc);
|
|
5282
5297
|
background: var(--red-ui-form-input-background, #fff);
|
|
5283
|
-
color: var(--red-ui-form-
|
|
5298
|
+
color: var(--red-ui-form-text-color, #333);
|
|
5284
5299
|
}
|
|
5285
5300
|
|
|
5286
5301
|
.fp-provider-actions {
|
|
@@ -5500,7 +5515,7 @@
|
|
|
5500
5515
|
border-radius: 6px;
|
|
5501
5516
|
border: 1px solid var(--red-ui-form-input-border-color, #ccc);
|
|
5502
5517
|
background: var(--red-ui-form-input-background, #fff);
|
|
5503
|
-
color: var(--red-ui-form-
|
|
5518
|
+
color: var(--red-ui-form-text-color, #333);
|
|
5504
5519
|
font-family: inherit;
|
|
5505
5520
|
font-size: 14px;
|
|
5506
5521
|
box-shadow: 0 0 0 1px rgba(255, 152, 0, 0.35);
|
|
@@ -5592,7 +5607,7 @@
|
|
|
5592
5607
|
box-sizing: border-box;
|
|
5593
5608
|
border: 1px solid var(--red-ui-form-input-border-color, #ccc);
|
|
5594
5609
|
background: var(--red-ui-form-input-background, #fff);
|
|
5595
|
-
color: var(--red-ui-form-
|
|
5610
|
+
color: var(--red-ui-form-text-color, #333);
|
|
5596
5611
|
border-radius: 5px;
|
|
5597
5612
|
padding: 8px;
|
|
5598
5613
|
}
|