node-red-contrib-ollama 0.5.0 → 0.5.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.
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: jakubburkiewicz
package/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
+
7
+ ## [0.5.2] - 2026-09-13
8
+
9
+ ### Fixed
10
+
11
+ - `ollama-embed` node ignoring the "Truncate" setting due to a config property name typo.
12
+ - All nodes emitting an output message with an empty payload after a failed Ollama call, instead of only reporting the error.
13
+
14
+ ## [0.5.1] - 2026-09-13
15
+
16
+ ### Fixed
17
+
18
+ - `ollama-abort` node crashing the Node-RED process due to incorrect handling of the synchronous `abort()` call.
@@ -42,13 +42,15 @@ module.exports = function( RED ) {
42
42
 
43
43
  const ollama = new Ollama( ollamaConfig )
44
44
 
45
- const response = await ollama.abort()
46
- .catch( error => {
47
- node.error( error )
48
- } )
49
-
50
- msg.payload = response
51
- node.send( msg )
45
+ // Unlike the other client methods, abort() is synchronous and
46
+ // returns nothing - it just cancels ongoing streamed requests.
47
+ try {
48
+ ollama.abort()
49
+ msg.payload = { status: 'success' }
50
+ node.send( msg )
51
+ } catch ( error ) {
52
+ node.error( error )
53
+ }
52
54
  } )
53
55
  }
54
56
 
@@ -104,7 +104,7 @@ module.exports = function( RED ) {
104
104
  const optionsConfig = RED.nodes.getNode( config.options )
105
105
  const options = msg?.payload?.options || ( optionsConfig ) ? JSON.parse( optionsConfig.json ) : null
106
106
 
107
- const response = await ollama.chat( {
107
+ ollama.chat( {
108
108
  model,
109
109
  messages,
110
110
  format,
@@ -114,12 +114,13 @@ module.exports = function( RED ) {
114
114
  tools,
115
115
  options
116
116
  } )
117
+ .then( response => {
118
+ msg.payload = response
119
+ node.send( msg )
120
+ } )
117
121
  .catch( error => {
118
122
  node.error( error )
119
123
  } )
120
-
121
- msg.payload = response
122
- node.send( msg )
123
124
  } )
124
125
  }
125
126
 
@@ -75,16 +75,17 @@ module.exports = function( RED ) {
75
75
  }
76
76
  }
77
77
 
78
- const response = await ollama.copy( {
78
+ ollama.copy( {
79
79
  source,
80
80
  destination
81
81
  } )
82
+ .then( response => {
83
+ msg.payload = response
84
+ node.send( msg )
85
+ } )
82
86
  .catch( error => {
83
87
  node.error( error )
84
88
  } )
85
-
86
- msg.payload = response
87
- node.send( msg )
88
89
  } )
89
90
  }
90
91
 
@@ -59,13 +59,14 @@ module.exports = function( RED ) {
59
59
  }
60
60
  }
61
61
 
62
- const response = await ollama.delete( { model } )
62
+ ollama.delete( { model } )
63
+ .then( response => {
64
+ msg.payload = response
65
+ node.send( msg )
66
+ } )
63
67
  .catch( error => {
64
68
  node.error( error )
65
69
  } )
66
-
67
- msg.payload = response
68
- node.send( msg )
69
70
  } )
70
71
  }
71
72
 
@@ -6,7 +6,7 @@ module.exports = function( RED ) {
6
6
 
7
7
  this.modelType = config.modelType || 'str'
8
8
  this.inputType = config.inputType || 'str'
9
- this.thuncate = config.thuncate || false
9
+ this.truncate = config.truncate || false
10
10
  this.keepAliveType = config.keepAliveType || 'str'
11
11
 
12
12
  const node = this
@@ -95,19 +95,20 @@ module.exports = function( RED ) {
95
95
  const optionsConfig = RED.nodes.getNode( config.options )
96
96
  const options = msg?.payload?.options || ( optionsConfig ) ? JSON.parse( optionsConfig.json ) : null
97
97
 
98
- const response = await ollama.embed( {
98
+ ollama.embed( {
99
99
  model,
100
100
  input,
101
101
  truncate,
102
102
  keep_alive,
103
103
  options
104
104
  } )
105
+ .then( response => {
106
+ msg.payload = response
107
+ node.send( msg )
108
+ } )
105
109
  .catch( error => {
106
110
  node.error( error )
107
111
  } )
108
-
109
- msg.payload = response
110
- node.send( msg )
111
112
  } )
112
113
  }
113
114
 
@@ -169,7 +169,7 @@ module.exports = function( RED ) {
169
169
  const optionsConfig = RED.nodes.getNode( config.options )
170
170
  const options = msg?.payload?.options || ( optionsConfig ) ? JSON.parse( optionsConfig.json ) : null
171
171
 
172
- const response = await ollama.generate( {
172
+ ollama.generate( {
173
173
  model,
174
174
  prompt,
175
175
  suffix,
@@ -183,12 +183,13 @@ module.exports = function( RED ) {
183
183
  keep_alive,
184
184
  options
185
185
  } )
186
+ .then( response => {
187
+ msg.payload = response
188
+ node.send( msg )
189
+ } )
186
190
  .catch( error => {
187
191
  node.error( error )
188
192
  } )
189
-
190
- msg.payload = response
191
- node.send( msg )
192
193
  } )
193
194
  }
194
195
 
@@ -42,13 +42,14 @@ module.exports = function( RED ) {
42
42
 
43
43
  const ollama = new Ollama( ollamaConfig )
44
44
 
45
- const response = await ollama.list()
45
+ ollama.list()
46
+ .then( response => {
47
+ msg.payload = response
48
+ node.send( msg )
49
+ } )
46
50
  .catch( error => {
47
51
  node.error( error )
48
52
  } )
49
-
50
- msg.payload = response
51
- node.send( msg )
52
53
  } )
53
54
  }
54
55
 
@@ -42,13 +42,14 @@ module.exports = function( RED ) {
42
42
 
43
43
  const ollama = new Ollama( ollamaConfig )
44
44
 
45
- const response = await ollama.ps()
45
+ ollama.ps()
46
+ .then( response => {
47
+ msg.payload = response
48
+ node.send( msg )
49
+ } )
46
50
  .catch( error => {
47
51
  node.error( error )
48
52
  } )
49
-
50
- msg.payload = response
51
- node.send( msg )
52
53
  } )
53
54
  }
54
55
 
@@ -65,17 +65,18 @@ module.exports = function( RED ) {
65
65
 
66
66
  const stream = ( msg?.payload?.stream !== undefined ) ? msg?.payload?.stream : node.stream
67
67
 
68
- const response = await ollama.pull( {
68
+ ollama.pull( {
69
69
  model,
70
70
  insecure,
71
71
  stream
72
72
  } )
73
+ .then( response => {
74
+ msg.payload = response
75
+ node.send( msg )
76
+ } )
73
77
  .catch( error => {
74
78
  node.error( error )
75
79
  } )
76
-
77
- msg.payload = response
78
- node.send( msg )
79
80
  } )
80
81
  }
81
82
 
@@ -65,17 +65,18 @@ module.exports = function( RED ) {
65
65
 
66
66
  const stream = ( msg?.payload?.stream !== undefined ) ? msg?.payload?.stream : node.stream
67
67
 
68
- const response = await ollama.push( {
68
+ ollama.push( {
69
69
  model,
70
70
  insecure,
71
71
  stream
72
72
  } )
73
+ .then( response => {
74
+ msg.payload = response
75
+ node.send( msg )
76
+ } )
73
77
  .catch( error => {
74
78
  node.error( error )
75
79
  } )
76
-
77
- msg.payload = response
78
- node.send( msg )
79
80
  } )
80
81
  }
81
82
 
@@ -94,18 +94,19 @@ module.exports = function( RED ) {
94
94
  const optionsConfig = RED.nodes.getNode( config.options )
95
95
  const options = msg?.payload?.options || ( optionsConfig ) ? JSON.parse( optionsConfig.json ) : null
96
96
 
97
- const response = await ollama.show( {
97
+ ollama.show( {
98
98
  model,
99
99
  system,
100
100
  template,
101
101
  options
102
102
  } )
103
+ .then( response => {
104
+ msg.payload = response
105
+ node.send( msg )
106
+ } )
103
107
  .catch( error => {
104
108
  node.error( error )
105
109
  } )
106
-
107
- msg.payload = response
108
- node.send( msg )
109
110
  } )
110
111
  }
111
112
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-ollama",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
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",