forked from abrenneke/rivet-plugin-example-python-exec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
45 lines (36 loc) · 1.59 KB
/
index.ts
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
// It is important that you only import types from @ironclad/rivet-core, and not
// any of the actual Rivet code. Rivet is passed into the initializer function as
// a parameter, and you can use it to access any Rivet functionality you need.
import type { RivetPlugin, RivetPluginInitializer } from "@ironclad/rivet-core";
import runOllama from "./nodes/RunOllama";
// A Rivet plugin must default export a plugin initializer function. This takes in the Rivet library as its
// only parameter. This function must return a valid RivetPlugin object.
const initializer: RivetPluginInitializer = (rivet) => {
// Initialize any nodes in here in the same way, by passing them the Rivet library.
const node = runOllama(rivet);
// The plugin object is the definition for your plugin.
const plugin: RivetPlugin = {
// The ID of your plugin should be unique across all plugins.
id: "rivet-ollama",
// The name of the plugin is what is displayed in the Rivet UI.
name: "Ollama",
// Define all configuration settings in the configSpec object.
configSpec: {},
// Define any additional context menu groups your plugin adds here.
// contextMenuGroups: [
// {
// id: "ollama",
// label: "Ollama",
// },
// ],
// Register any additional nodes your plugin adds here. This is passed a `register`
// function, which you can use to register your nodes.
register: (register) => {
register(node);
},
};
// Make sure to return your plugin definition.
return plugin;
};
// Make sure to default export your plugin.
export default initializer;