getting tools and model

This commit is contained in:
anovazzi1 2023-02-13 21:02:20 -03:00
commit 9d9eab5db0
2 changed files with 14 additions and 2 deletions

View file

@ -49,3 +49,13 @@ export async function getTools() {
});
return Promise.all(promises);
}
export async function getModels() {
const promises = (await axios.get("http://localhost:5003/list/llms")).data.map(async (value, index) => {
const prompt = await axios.get("http://localhost:5003/templates/llm", {
params: { name: value },
});
return { name: value, type: "modelNode", ...prompt.data };
});
return Promise.all(promises);
}

View file

@ -15,7 +15,7 @@ import ChainNode from "../../CustomNodes/ChainNode";
import ToolsNode from "../../CustomNodes/ToolsNode";
import MemoryNode from "../../CustomNodes/MemoryNode";
import axios from "axios";
import {getPrompts, getChains,getAgents,getMemories} from "../../controllers/NodesServices";
import {getPrompts, getChains,getAgents,getMemories, getModels,getTools} from "../../controllers/NodesServices";
import { generateUiNode } from "../../controllers/UiGenerator";
const nodeTypes = {
@ -28,10 +28,12 @@ const nodeTypes = {
};
export default function FlowPage() {
getPrompts().then(result=>result.forEach(prompt=>console.log(generateUiNode(prompt))))
// getPrompts().then(result=>result.forEach(prompt=>console.log(prompt)))
// getChains().then(result=>console.log(result))
// getAgents().then(result=>console.log(result))
// getMemories().then(result=>console.log(result))
// getModels().then(result=>result.forEach(model=>console.log(model)))
getTools().then(result=>result.forEach(tool=>console.log(tool)))
// outside component to avoid render trigger