node-red-contrib-ollama 0.2.3 → 0.2.4
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/nodes/ollama-chat.html
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
name: { value: 'Ollama Chat' },
|
|
7
7
|
server: { value: '', type: 'ollama-config-server', required: false },
|
|
8
8
|
model: { value: '', type: 'ollama-config-model', required: true },
|
|
9
|
+
tools: { value: '', type: 'ollama-config-tools', required: false },
|
|
9
10
|
},
|
|
10
11
|
inputs: 1,
|
|
11
12
|
outputs: 1,
|
|
@@ -31,6 +32,11 @@
|
|
|
31
32
|
<label for="node-input-model"><i class="fa fa-bookmark"></i> Model</label>
|
|
32
33
|
<input type="text" id="node-input-model" />
|
|
33
34
|
</div>
|
|
35
|
+
|
|
36
|
+
<div class="form-row">
|
|
37
|
+
<label for="node-input-tools"><i class="fa fa-cog"></i> Tools</label>
|
|
38
|
+
<input type="text" id="node-input-tools" />
|
|
39
|
+
</div>
|
|
34
40
|
</script>
|
|
35
41
|
|
|
36
42
|
<script type="text/html" data-help-name="ollama-chat">
|
|
@@ -114,6 +120,7 @@
|
|
|
114
120
|
<dd>
|
|
115
121
|
Tools for the model to use if supported.<br />
|
|
116
122
|
Requires <code>stream</code> to be set to <code>false</code>.
|
|
123
|
+
<em>Alternative to the <code>Model</code> field.</em>
|
|
117
124
|
|
|
118
125
|
<p>
|
|
119
126
|
For more information, see the Ollama API documentation:<br />
|
package/nodes/ollama-chat.js
CHANGED
|
@@ -13,7 +13,7 @@ module.exports = function( RED ) {
|
|
|
13
13
|
format,
|
|
14
14
|
stream,
|
|
15
15
|
keep_alive,
|
|
16
|
-
tools,
|
|
16
|
+
tools: payloadTools,
|
|
17
17
|
options
|
|
18
18
|
} = msg.payload
|
|
19
19
|
|
|
@@ -25,6 +25,9 @@ module.exports = function( RED ) {
|
|
|
25
25
|
const modelConfig = RED.nodes.getNode( config.model )
|
|
26
26
|
const model = ( modelConfig ) ? modelConfig.name : payloadModel
|
|
27
27
|
|
|
28
|
+
const toolsConfig = RED.nodes.getNode( config.tools )
|
|
29
|
+
const tools = ( toolsConfig ) ? toolsConfig.json : payloadTools
|
|
30
|
+
|
|
28
31
|
const response = await ollama.chat( {
|
|
29
32
|
model,
|
|
30
33
|
messages,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType( 'ollama-config-tools', {
|
|
3
|
+
category: 'config',
|
|
4
|
+
defaults: {
|
|
5
|
+
name: { value: 'Ollama Tools Config' },
|
|
6
|
+
json: { value: '' }
|
|
7
|
+
},
|
|
8
|
+
label: function() {
|
|
9
|
+
return this.name;
|
|
10
|
+
},
|
|
11
|
+
oneditprepare: function() {
|
|
12
|
+
$( '#node-config-input-json' ).typedInput( {
|
|
13
|
+
type: 'json',
|
|
14
|
+
types: [ 'json' ]
|
|
15
|
+
} )
|
|
16
|
+
}
|
|
17
|
+
} )
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script type="text/html" data-template-name="ollama-config-tools">
|
|
21
|
+
<div class="form-row">
|
|
22
|
+
<label for="node-config-input-name"><i class="fa fa-server"></i> Name</label>
|
|
23
|
+
<input type="text" id="node-config-input-name" placeholder="Ollama Tools Config" />
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="form-row">
|
|
27
|
+
<label for="node-config-input-json"><i class="fa fa-cog"></i> JSON</label>
|
|
28
|
+
<input type="text" id="node-config-input-json" placeholder="" />
|
|
29
|
+
</div>
|
|
30
|
+
</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-ollama",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
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",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"ollama-ps": "nodes/ollama-ps.js",
|
|
31
31
|
"ollama-abort": "nodes/ollama-abort.js",
|
|
32
32
|
"ollama-config-server": "nodes/ollama-config-server.js",
|
|
33
|
-
"ollama-config-model": "nodes/ollama-config-model.js"
|
|
33
|
+
"ollama-config-model": "nodes/ollama-config-model.js",
|
|
34
|
+
"ollama-config-tools": "nodes/ollama-config-tools.js"
|
|
34
35
|
}
|
|
35
36
|
},
|
|
36
37
|
"engines": {
|