node-red-contrib-ollama 0.5.2 → 0.6.0
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/CHANGELOG.md +24 -0
- package/examples/Example.json +2 -2
- package/nodes/ollama-abort.js +4 -1
- package/nodes/ollama-chat.js +17 -6
- package/nodes/ollama-copy.js +4 -1
- package/nodes/ollama-create.js +4 -1
- package/nodes/ollama-delete.js +4 -1
- package/nodes/ollama-embed.js +5 -2
- package/nodes/ollama-generate.js +16 -5
- package/nodes/ollama-list.js +4 -1
- package/nodes/ollama-ps.js +4 -1
- package/nodes/ollama-pull.js +15 -4
- package/nodes/ollama-push.js +15 -4
- package/nodes/ollama-show.js +5 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
6
|
|
|
7
|
+
## [0.6.0] - 2026-09-13
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `ollama-chat`, `ollama-generate`, `ollama-pull` and `ollama-push` now emit one output message per streamed chunk when `stream` is `true`, instead of a single message with an unusable raw iterator as `payload` ([#17](https://github.com/jakubburkiewicz/node-red-contrib-ollama/issues/17)). Non-streaming behavior (the default) is unchanged.
|
|
12
|
+
|
|
13
|
+
## [0.5.5] - 2026-09-13
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- The "Embeddings" node in the example flow using a stale node type (`ollama-embeddings` instead of `ollama-embed`) and a payload shaped for `ollama-generate` instead of `ollama-embed` ([#18](https://github.com/jakubburkiewicz/node-red-contrib-ollama/issues/18)).
|
|
18
|
+
|
|
19
|
+
## [0.5.4] - 2026-09-13
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- `msg.payload.host` being silently ignored on all nodes when the node's Server field is set to "none", instead of being used to reach the Ollama instance directly ([#28](https://github.com/jakubburkiewicz/node-red-contrib-ollama/issues/28), [#20](https://github.com/jakubburkiewicz/node-red-contrib-ollama/issues/20)).
|
|
24
|
+
|
|
25
|
+
## [0.5.3] - 2026-09-13
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- `msg.payload.tools` being ignored by the `ollama-chat` node ([#29](https://github.com/jakubburkiewicz/node-red-contrib-ollama/issues/29)) and the same operator-precedence bug affecting `msg.payload.options` in `ollama-chat`, `ollama-generate`, `ollama-embed` and `ollama-show`.
|
|
30
|
+
|
|
7
31
|
## [0.5.2] - 2026-09-13
|
|
8
32
|
|
|
9
33
|
### Fixed
|
package/examples/Example.json
CHANGED
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
},
|
|
255
255
|
{
|
|
256
256
|
"id": "66e2fb897f54a093",
|
|
257
|
-
"type": "ollama-
|
|
257
|
+
"type": "ollama-embed",
|
|
258
258
|
"z": "3bccaf6e46d3dbf5",
|
|
259
259
|
"name": "Embeddings",
|
|
260
260
|
"x": 450,
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
"once": false,
|
|
281
281
|
"onceDelay": 0.1,
|
|
282
282
|
"topic": "",
|
|
283
|
-
"payload": "{\"model\":\"llama2\",\"
|
|
283
|
+
"payload": "{\"model\":\"llama2\",\"input\":\"Why is the sky blue?\"}",
|
|
284
284
|
"payloadType": "json",
|
|
285
285
|
"x": 270,
|
|
286
286
|
"y": 320,
|
package/nodes/ollama-abort.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = function( RED ) {
|
|
|
10
10
|
|
|
11
11
|
// Construct host URL
|
|
12
12
|
let host = null
|
|
13
|
-
if (
|
|
13
|
+
if ( server ) {
|
|
14
14
|
if ( server.useCloud ) {
|
|
15
15
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
16
16
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -30,6 +30,9 @@ module.exports = function( RED ) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
} else {
|
|
34
|
+
// No server configured - allow msg.payload.host directly
|
|
35
|
+
host = msg?.payload?.host || null
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
// Ollama Cloud configuration
|
package/nodes/ollama-chat.js
CHANGED
|
@@ -15,7 +15,7 @@ module.exports = function( RED ) {
|
|
|
15
15
|
|
|
16
16
|
// Construct host URL
|
|
17
17
|
let host = null
|
|
18
|
-
if (
|
|
18
|
+
if ( server ) {
|
|
19
19
|
if ( server.useCloud ) {
|
|
20
20
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
21
21
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -35,6 +35,9 @@ module.exports = function( RED ) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
} else {
|
|
39
|
+
// No server configured - allow msg.payload.host directly
|
|
40
|
+
host = msg?.payload?.host || null
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
// Ollama Cloud configuration
|
|
@@ -99,10 +102,10 @@ module.exports = function( RED ) {
|
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
const toolsConfig = RED.nodes.getNode( config.tools )
|
|
102
|
-
const tools = msg?.payload?.tools || ( toolsConfig
|
|
105
|
+
const tools = msg?.payload?.tools || ( toolsConfig ? JSON.parse( toolsConfig.json ) : null )
|
|
103
106
|
|
|
104
107
|
const optionsConfig = RED.nodes.getNode( config.options )
|
|
105
|
-
const options = msg?.payload?.options || ( optionsConfig
|
|
108
|
+
const options = msg?.payload?.options || ( optionsConfig ? JSON.parse( optionsConfig.json ) : null )
|
|
106
109
|
|
|
107
110
|
ollama.chat( {
|
|
108
111
|
model,
|
|
@@ -114,9 +117,17 @@ module.exports = function( RED ) {
|
|
|
114
117
|
tools,
|
|
115
118
|
options
|
|
116
119
|
} )
|
|
117
|
-
.then( response => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
.then( async response => {
|
|
121
|
+
if ( stream ) {
|
|
122
|
+
for await ( const part of response ) {
|
|
123
|
+
const chunkMsg = RED.util.cloneMessage( msg )
|
|
124
|
+
chunkMsg.payload = part
|
|
125
|
+
node.send( chunkMsg )
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
msg.payload = response
|
|
129
|
+
node.send( msg )
|
|
130
|
+
}
|
|
120
131
|
} )
|
|
121
132
|
.catch( error => {
|
|
122
133
|
node.error( error )
|
package/nodes/ollama-copy.js
CHANGED
|
@@ -13,7 +13,7 @@ module.exports = function( RED ) {
|
|
|
13
13
|
|
|
14
14
|
// Construct host URL
|
|
15
15
|
let host = null
|
|
16
|
-
if (
|
|
16
|
+
if ( server ) {
|
|
17
17
|
if ( server.useCloud ) {
|
|
18
18
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
19
19
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -33,6 +33,9 @@ module.exports = function( RED ) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
} else {
|
|
37
|
+
// No server configured - allow msg.payload.host directly
|
|
38
|
+
host = msg?.payload?.host || null
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
// Ollama Cloud configuration
|
package/nodes/ollama-create.js
CHANGED
|
@@ -22,7 +22,7 @@ module.exports = function( RED ) {
|
|
|
22
22
|
|
|
23
23
|
// Construct host URL
|
|
24
24
|
let host = null
|
|
25
|
-
if (
|
|
25
|
+
if ( server ) {
|
|
26
26
|
if ( server.useCloud ) {
|
|
27
27
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
28
28
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -42,6 +42,9 @@ module.exports = function( RED ) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
} else {
|
|
46
|
+
// No server configured - allow msg.payload.host directly
|
|
47
|
+
host = msg?.payload?.host || null
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
// Ollama Cloud configuration
|
package/nodes/ollama-delete.js
CHANGED
|
@@ -12,7 +12,7 @@ module.exports = function( RED ) {
|
|
|
12
12
|
|
|
13
13
|
// Construct host URL
|
|
14
14
|
let host = null
|
|
15
|
-
if (
|
|
15
|
+
if ( server ) {
|
|
16
16
|
if ( server.useCloud ) {
|
|
17
17
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
18
18
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -32,6 +32,9 @@ module.exports = function( RED ) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
} else {
|
|
36
|
+
// No server configured - allow msg.payload.host directly
|
|
37
|
+
host = msg?.payload?.host || null
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
// Ollama Cloud configuration
|
package/nodes/ollama-embed.js
CHANGED
|
@@ -15,7 +15,7 @@ module.exports = function( RED ) {
|
|
|
15
15
|
|
|
16
16
|
// Construct host URL
|
|
17
17
|
let host = null
|
|
18
|
-
if (
|
|
18
|
+
if ( server ) {
|
|
19
19
|
if ( server.useCloud ) {
|
|
20
20
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
21
21
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -35,6 +35,9 @@ module.exports = function( RED ) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
} else {
|
|
39
|
+
// No server configured - allow msg.payload.host directly
|
|
40
|
+
host = msg?.payload?.host || null
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
// Ollama Cloud configuration
|
|
@@ -93,7 +96,7 @@ module.exports = function( RED ) {
|
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
const optionsConfig = RED.nodes.getNode( config.options )
|
|
96
|
-
const options = msg?.payload?.options || ( optionsConfig
|
|
99
|
+
const options = msg?.payload?.options || ( optionsConfig ? JSON.parse( optionsConfig.json ) : null )
|
|
97
100
|
|
|
98
101
|
ollama.embed( {
|
|
99
102
|
model,
|
package/nodes/ollama-generate.js
CHANGED
|
@@ -21,7 +21,7 @@ module.exports = function( RED ) {
|
|
|
21
21
|
|
|
22
22
|
// Construct host URL
|
|
23
23
|
let host = null
|
|
24
|
-
if (
|
|
24
|
+
if ( server ) {
|
|
25
25
|
if ( server.useCloud ) {
|
|
26
26
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
27
27
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -41,6 +41,9 @@ module.exports = function( RED ) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
} else {
|
|
45
|
+
// No server configured - allow msg.payload.host directly
|
|
46
|
+
host = msg?.payload?.host || null
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
// Ollama Cloud configuration
|
|
@@ -167,7 +170,7 @@ module.exports = function( RED ) {
|
|
|
167
170
|
}
|
|
168
171
|
|
|
169
172
|
const optionsConfig = RED.nodes.getNode( config.options )
|
|
170
|
-
const options = msg?.payload?.options || ( optionsConfig
|
|
173
|
+
const options = msg?.payload?.options || ( optionsConfig ? JSON.parse( optionsConfig.json ) : null )
|
|
171
174
|
|
|
172
175
|
ollama.generate( {
|
|
173
176
|
model,
|
|
@@ -183,9 +186,17 @@ module.exports = function( RED ) {
|
|
|
183
186
|
keep_alive,
|
|
184
187
|
options
|
|
185
188
|
} )
|
|
186
|
-
.then( response => {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
.then( async response => {
|
|
190
|
+
if ( stream ) {
|
|
191
|
+
for await ( const part of response ) {
|
|
192
|
+
const chunkMsg = RED.util.cloneMessage( msg )
|
|
193
|
+
chunkMsg.payload = part
|
|
194
|
+
node.send( chunkMsg )
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
msg.payload = response
|
|
198
|
+
node.send( msg )
|
|
199
|
+
}
|
|
189
200
|
} )
|
|
190
201
|
.catch( error => {
|
|
191
202
|
node.error( error )
|
package/nodes/ollama-list.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = function( RED ) {
|
|
|
10
10
|
|
|
11
11
|
// Construct host URL
|
|
12
12
|
let host = null
|
|
13
|
-
if (
|
|
13
|
+
if ( server ) {
|
|
14
14
|
if ( server.useCloud ) {
|
|
15
15
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
16
16
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -30,6 +30,9 @@ module.exports = function( RED ) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
} else {
|
|
34
|
+
// No server configured - allow msg.payload.host directly
|
|
35
|
+
host = msg?.payload?.host || null
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
// Ollama Cloud configuration
|
package/nodes/ollama-ps.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = function( RED ) {
|
|
|
10
10
|
|
|
11
11
|
// Construct host URL
|
|
12
12
|
let host = null
|
|
13
|
-
if (
|
|
13
|
+
if ( server ) {
|
|
14
14
|
if ( server.useCloud ) {
|
|
15
15
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
16
16
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -30,6 +30,9 @@ module.exports = function( RED ) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
} else {
|
|
34
|
+
// No server configured - allow msg.payload.host directly
|
|
35
|
+
host = msg?.payload?.host || null
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
// Ollama Cloud configuration
|
package/nodes/ollama-pull.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = function( RED ) {
|
|
|
14
14
|
|
|
15
15
|
// Construct host URL
|
|
16
16
|
let host = null
|
|
17
|
-
if (
|
|
17
|
+
if ( server ) {
|
|
18
18
|
if ( server.useCloud ) {
|
|
19
19
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
20
20
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -34,6 +34,9 @@ module.exports = function( RED ) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
} else {
|
|
38
|
+
// No server configured - allow msg.payload.host directly
|
|
39
|
+
host = msg?.payload?.host || null
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
// Ollama Cloud configuration
|
|
@@ -70,9 +73,17 @@ module.exports = function( RED ) {
|
|
|
70
73
|
insecure,
|
|
71
74
|
stream
|
|
72
75
|
} )
|
|
73
|
-
.then( response => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
.then( async response => {
|
|
77
|
+
if ( stream ) {
|
|
78
|
+
for await ( const part of response ) {
|
|
79
|
+
const chunkMsg = RED.util.cloneMessage( msg )
|
|
80
|
+
chunkMsg.payload = part
|
|
81
|
+
node.send( chunkMsg )
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
msg.payload = response
|
|
85
|
+
node.send( msg )
|
|
86
|
+
}
|
|
76
87
|
} )
|
|
77
88
|
.catch( error => {
|
|
78
89
|
node.error( error )
|
package/nodes/ollama-push.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = function( RED ) {
|
|
|
14
14
|
|
|
15
15
|
// Construct host URL
|
|
16
16
|
let host = null
|
|
17
|
-
if (
|
|
17
|
+
if ( server ) {
|
|
18
18
|
if ( server.useCloud ) {
|
|
19
19
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
20
20
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -34,6 +34,9 @@ module.exports = function( RED ) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
} else {
|
|
38
|
+
// No server configured - allow msg.payload.host directly
|
|
39
|
+
host = msg?.payload?.host || null
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
// Ollama Cloud configuration
|
|
@@ -70,9 +73,17 @@ module.exports = function( RED ) {
|
|
|
70
73
|
insecure,
|
|
71
74
|
stream
|
|
72
75
|
} )
|
|
73
|
-
.then( response => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
.then( async response => {
|
|
77
|
+
if ( stream ) {
|
|
78
|
+
for await ( const part of response ) {
|
|
79
|
+
const chunkMsg = RED.util.cloneMessage( msg )
|
|
80
|
+
chunkMsg.payload = part
|
|
81
|
+
node.send( chunkMsg )
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
msg.payload = response
|
|
85
|
+
node.send( msg )
|
|
86
|
+
}
|
|
76
87
|
} )
|
|
77
88
|
.catch( error => {
|
|
78
89
|
node.error( error )
|
package/nodes/ollama-show.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = function( RED ) {
|
|
|
14
14
|
|
|
15
15
|
// Construct host URL
|
|
16
16
|
let host = null
|
|
17
|
-
if (
|
|
17
|
+
if ( server ) {
|
|
18
18
|
if ( server.useCloud ) {
|
|
19
19
|
// For Ollama Cloud, always use the configured host (https://ollama.com)
|
|
20
20
|
// NEVER allow msg.payload.host override when using API key authentication
|
|
@@ -34,6 +34,9 @@ module.exports = function( RED ) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
} else {
|
|
38
|
+
// No server configured - allow msg.payload.host directly
|
|
39
|
+
host = msg?.payload?.host || null
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
// Ollama Cloud configuration
|
|
@@ -92,7 +95,7 @@ module.exports = function( RED ) {
|
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
const optionsConfig = RED.nodes.getNode( config.options )
|
|
95
|
-
const options = msg?.payload?.options || ( optionsConfig
|
|
98
|
+
const options = msg?.payload?.options || ( optionsConfig ? JSON.parse( optionsConfig.json ) : null )
|
|
96
99
|
|
|
97
100
|
ollama.show( {
|
|
98
101
|
model,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-ollama",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Add AI functionality to your flows! This module includes a set of nodes that enable easy communication with Ollama, enriching your projects with intelligent solutions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|