mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-19 04:17:52 +00:00
added nodes
This commit is contained in:
parent
417cc27a6a
commit
1b61aa8149
28
web/src/nodes/LLM.js
Normal file
28
web/src/nodes/LLM.js
Normal file
@ -0,0 +1,28 @@
|
||||
import { defineNode, NodeInterface, TextInterface, SelectInterface } from "baklavajs";
|
||||
import axios from 'axios';
|
||||
import { store } from '../main'
|
||||
|
||||
export const LLMNode = defineNode({
|
||||
type: "LLMNode",
|
||||
title: "LLM",
|
||||
inputs: {
|
||||
request: () => new NodeInterface("Request", ""),
|
||||
},
|
||||
outputs: {
|
||||
response: () => new NodeInterface("Response", "")
|
||||
},
|
||||
async calculate({ request }) {
|
||||
console.log(store.state.config.personalities)
|
||||
let response = '';
|
||||
try {
|
||||
const result = await axios.post('/generate', { params: { text: request } });
|
||||
response = result.data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
return {
|
||||
display: response,
|
||||
response: response
|
||||
};
|
||||
}
|
||||
});
|
19
web/src/nodes/Multichoice.js
Normal file
19
web/src/nodes/Multichoice.js
Normal file
@ -0,0 +1,19 @@
|
||||
import { defineNode, NodeInterface, TextInputInterface } from "baklavajs";
|
||||
|
||||
|
||||
export const MultichoiceNode = defineNode({
|
||||
type: "MultichoiceNode",
|
||||
title: "Multichoice",
|
||||
inputs: {
|
||||
question: () => new NodeInterface("Question", ""),
|
||||
outputs: () =>
|
||||
new TextInputInterface("choices, one per line", "", "").setPort(
|
||||
false
|
||||
),
|
||||
},
|
||||
outputs: {
|
||||
response: () => new NodeInterface("Response", "")
|
||||
},
|
||||
|
||||
});
|
||||
|
16
web/src/nodes/TextDisplay.js
Normal file
16
web/src/nodes/TextDisplay.js
Normal file
@ -0,0 +1,16 @@
|
||||
import { defineNode, NodeInterface, TextInterface, SelectInterface } from "baklavajs";
|
||||
import axios from 'axios';
|
||||
import { store } from '../main'
|
||||
|
||||
export const TextDisplayNode = defineNode({
|
||||
type: "TextDisplayNode",
|
||||
title: "TextDisplay",
|
||||
inputs: {
|
||||
text2display: () => new NodeInterface("Input", ""),
|
||||
},
|
||||
outputs: {
|
||||
response: () => new TextInterface("Text", "")
|
||||
},
|
||||
async calculate({ request }) {
|
||||
}
|
||||
});
|
32
web/src/nodes/Yes_No.js
Normal file
32
web/src/nodes/Yes_No.js
Normal file
@ -0,0 +1,32 @@
|
||||
import { defineNode, NodeInterface, TextInterface, SelectInterface } from "baklavajs";
|
||||
import axios from 'axios';
|
||||
import { store } from '../main'
|
||||
|
||||
export const LLMNode = defineNode({
|
||||
type: "LLMNode",
|
||||
title: "LLM",
|
||||
inputs: {
|
||||
input: () => new NodeInterface("Input", ""),
|
||||
question: () => new NodeInterface("Question", "").setPort(
|
||||
false
|
||||
),
|
||||
},
|
||||
outputs: {
|
||||
yes: () => new NodeInterface("Yes", ""),
|
||||
no: () => new NodeInterface("No", "")
|
||||
},
|
||||
async calculate({ request }) {
|
||||
console.log(store.state.config.personalities)
|
||||
let response = '';
|
||||
try {
|
||||
const result = await axios.get('/yes_no', { params: { text: request } });
|
||||
response = result.data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
return {
|
||||
display: response,
|
||||
response: response
|
||||
};
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user