mirror of
https://github.com/ianarawjo/ChainForge.git
synced 2025-03-14 16:26:45 +00:00
BASE_URL
This commit is contained in:
parent
f77fcfd280
commit
f225f4c91a
@ -4,6 +4,7 @@ import useStore from './store';
|
||||
import StatusIndicator from './StatusIndicatorComponent'
|
||||
import NodeLabel from './NodeLabelComponent'
|
||||
import AlertModal from './AlertModal'
|
||||
import {BASE_URL} from './store';
|
||||
|
||||
// Ace code editor
|
||||
import AceEditor from "react-ace";
|
||||
@ -80,7 +81,7 @@ const EvaluatorNode = ({ data, id }) => {
|
||||
console.log(script_paths);
|
||||
// Run evaluator in backend
|
||||
const codeTextOnRun = codeText + '';
|
||||
fetch('http://localhost:8000/execute', {
|
||||
fetch(BASE_URL + 'execute', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'},
|
||||
body: JSON.stringify({
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Handle } from 'react-flow-renderer';
|
||||
import useStore from './store';
|
||||
import {BASE_URL} from './store';
|
||||
|
||||
const bucketResponsesByLLM = (responses) => {
|
||||
let responses_by_llm = {};
|
||||
@ -30,7 +31,7 @@ const InspectorNode = ({ data, id }) => {
|
||||
console.log(input_node_ids);
|
||||
|
||||
// Grab responses associated with those ids:
|
||||
fetch('http://localhost:8000/grabResponses', {
|
||||
fetch(BASE_URL + 'grabResponses', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'},
|
||||
body: JSON.stringify({
|
||||
|
@ -8,6 +8,7 @@ import NodeLabel from './NodeLabelComponent'
|
||||
import TemplateHooks from './TemplateHooksComponent'
|
||||
import LLMList from './LLMListComponent'
|
||||
import AlertModal from './AlertModal'
|
||||
import {BASE_URL} from './store';
|
||||
|
||||
// Available LLMs
|
||||
const allLLMs = [
|
||||
@ -186,7 +187,7 @@ const PromptNode = ({ data, id }) => {
|
||||
};
|
||||
|
||||
// Run all prompt permutations through the LLM to generate + cache responses:
|
||||
fetch('http://localhost:8000/queryllm', {
|
||||
fetch(BASE_URL + 'queryllm', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'},
|
||||
body: JSON.stringify({
|
||||
|
@ -58,14 +58,6 @@ const ScriptNode = ({ data, id }) => {
|
||||
setDataPropsForNode(id, new_data);
|
||||
}, [data, id, setDataPropsForNode]);
|
||||
|
||||
// Dynamically update the y-position of the template hook <Handle>s
|
||||
const ref = useRef(null);
|
||||
const [hooksY, setHooksY] = useState(120);
|
||||
useEffect(() => {
|
||||
const node_height = ref.current.clientHeight;
|
||||
setHooksY(node_height + 70);
|
||||
}, [scriptFiles]);
|
||||
|
||||
return (
|
||||
<div className="script-node">
|
||||
<div className="node-header">
|
||||
|
@ -4,7 +4,8 @@ import useStore from './store';
|
||||
import Plot from 'react-plotly.js';
|
||||
import { hover } from '@testing-library/user-event/dist/hover';
|
||||
import { create } from 'zustand';
|
||||
import NodeLabel from './NodeLabelComponent'
|
||||
import NodeLabel from './NodeLabelComponent';
|
||||
import {BASE_URL} from './store';
|
||||
|
||||
// Helper funcs
|
||||
const truncStr = (s, maxLen) => {
|
||||
@ -54,7 +55,7 @@ const VisNode = ({ data, id }) => {
|
||||
// Grab the input node ids
|
||||
const input_node_ids = [data.input];
|
||||
|
||||
fetch('http://localhost:8000/grabResponses', {
|
||||
fetch(BASE_URL + 'grabResponses', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'},
|
||||
body: JSON.stringify({
|
||||
|
@ -33,6 +33,8 @@ const initialEdges = [
|
||||
{ id: 'e1-2', source: initprompt, target: initeval, interactionWidth: 100},
|
||||
];
|
||||
|
||||
export const BASE_URL = 'http://localhost:8000/';
|
||||
|
||||
// TypeScript only
|
||||
// type RFState = {
|
||||
// nodes: Node[];
|
||||
@ -81,7 +83,7 @@ const useStore = create((set, get) => ({
|
||||
)(get().nodes)
|
||||
});
|
||||
},
|
||||
getNode: (id) => get().nodes.find(n => n.id == id),
|
||||
getNode: (id) => get().nodes.find(n => n.id === id),
|
||||
addNode: (newnode) => {
|
||||
set({
|
||||
nodes: get().nodes.concat(newnode)
|
||||
@ -122,4 +124,4 @@ const useStore = create((set, get) => ({
|
||||
},
|
||||
}));
|
||||
|
||||
export default useStore;
|
||||
export default useStore;
|
||||
|
@ -160,8 +160,6 @@ def queryLLM():
|
||||
"""
|
||||
data = request.get_json()
|
||||
|
||||
print('got a request!', data)
|
||||
|
||||
# Check that all required info is here:
|
||||
if not set(data.keys()).issuperset({'llm', 'prompt', 'vars', 'id'}):
|
||||
return jsonify({'error': 'POST data is improper format.'})
|
||||
|
@ -9,7 +9,7 @@
|
||||
<script>
|
||||
|
||||
function test_exec() {
|
||||
const response = fetch('http://localhost:8000/execute', {
|
||||
const response = fetch(BASE_URL + 'execute', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'},
|
||||
body: JSON.stringify({
|
||||
@ -25,7 +25,7 @@
|
||||
}
|
||||
|
||||
function test_query() {
|
||||
const response = fetch('http://localhost:8000/queryllm', {
|
||||
const response = fetch(BASE_URL + 'queryllm', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'},
|
||||
body: JSON.stringify({
|
||||
|
Loading…
x
Reference in New Issue
Block a user