-
Notifications
You must be signed in to change notification settings - Fork 0
/
groq-config.html
74 lines (66 loc) · 2.7 KB
/
groq-config.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!-- Node Registration Script -->
<script type="text/javascript">
// Register the 'groq-config' node type with Node-RED
RED.nodes.registerType('groq-config', {
category: 'config', // Place the node under the 'config' category in the palette
color: '#a6bbcf', // Set the color of the node in the palette
defaults: {
name: { value: "" } // Define the 'name' property with a default empty string
},
credentials: {
apiKey: { type: "password" } // Define 'apiKey' as a password type for secure storage
},
icon: "file.png", // Set the icon for the node in the palette
label: function() {
// Set the label of the node to its name or default to "groq-config"
return this.name || "groq-config";
}
});
</script>
<!-- Node Configuration Template -->
<script type="text/x-red" data-template-name="groq-config">
<div class="form-row">
<!-- Name Input Field -->
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Configuration Name" data-name="name">
</div>
<div class="form-row">
<!-- API Key Input Field -->
<label for="node-config-input-apiKey"><i class="fa fa-key"></i> API Key</label>
<input type="password" id="node-config-input-apiKey" placeholder="Your GROQ API Key" data-name="apiKey">
</div>
</script>
<!-- Node Help Text Template -->
<script type="text/x-red" data-help-name="groq-config">
<p>Configure the GROQ API key securely.</p>
</script>
<!-- Styles for the Configuration Dialog -->
<style>
.form-row {
margin-bottom: 10px; /* Space between form rows */
}
.form-row label {
display: block; /* Make labels block elements */
margin-bottom: 5px; /* Space below labels */
}
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="password"] {
width: 100%; /* Full width inputs */
padding: 5px; /* Padding inside inputs */
box-sizing: border-box; /* Include padding in width */
}
.form-row input[type="range"] {
width: 100%; /* Full width sliders */
}
.form-row small {
display: block; /* Make small text block elements */
color: #888; /* Gray color for helper text */
margin-top: 2px; /* Small space above helper text */
}
.form-row span {
display: block; /* Make span elements block for alignment */
text-align: right; /* Align text to the right */
font-weight: bold; /* Bold text for emphasis */
}
</style>