Merge branch 'dev' into gpt4

This commit is contained in:
Ibis Prevedello 2023-03-20 10:10:25 -03:00
commit 0ed7c4d948
6 changed files with 23 additions and 13 deletions

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "langflow" name = "langflow"
version = "0.0.41" version = "0.0.42"
description = "A Python package with a built-in web application" description = "A Python package with a built-in web application"
authors = ["Logspace <contact@logspace.ai>"] authors = ["Logspace <contact@logspace.ai>"]
packages = [ packages = [

View file

@ -7,6 +7,9 @@ from langflow.main import create_app
import typer import typer
from fastapi.staticfiles import StaticFiles from fastapi.staticfiles import StaticFiles
from pathlib import Path from pathlib import Path
import logging
logger = logging.getLogger(__name__)
def get_number_of_workers(workers=None): def get_number_of_workers(workers=None):
@ -23,7 +26,14 @@ def replace_port(static_files_dir, host, port):
# we need to set the base url to the port that the server is running on # we need to set the base url to the port that the server is running on
# so that the frontend can make requests to the backend # so that the frontend can make requests to the backend
# This is a hacky way to do it, but it works # This is a hacky way to do it, but it works
new_string = f'setItem("port","http://{host}:{port}")'
# Check if the host is http or https
logger.info(f"host: {host}")
logger.info(f"port: {port}")
url = f"{host}:{port}" if "http" in host else f"http://{host}:{port}"
logger.info(f"url: {url}")
new_string = f'setItem("port","{url}")'
with open(static_files_dir / "index.html", "r") as f: with open(static_files_dir / "index.html", "r") as f:
index_html = f.read() index_html = f.read()
# using regex to replace the port # using regex to replace the port

View file

@ -1,12 +1,12 @@
{ {
"name": "langflow", "name": "langflow",
"version": "0.1.1", "version": "0.1.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "langflow", "name": "langflow",
"version": "0.1.1", "version": "0.1.2",
"dependencies": { "dependencies": {
"@emotion/react": "^11.10.5", "@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5", "@emotion/styled": "^11.10.5",
@ -17080,9 +17080,9 @@
} }
}, },
"node_modules/webpack": { "node_modules/webpack": {
"version": "5.75.0", "version": "5.76.2",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.75.0.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.2.tgz",
"integrity": "sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==", "integrity": "sha512-Th05ggRm23rVzEOlX8y67NkYCHa9nTNcwHPBhdg+lKG+mtiW7XgggjAeeLnADAe7mLjJ6LUNfgHAuRRh+Z6J7w==",
"dependencies": { "dependencies": {
"@types/eslint-scope": "^3.7.3", "@types/eslint-scope": "^3.7.3",
"@types/estree": "^0.0.51", "@types/estree": "^0.0.51",

View file

@ -1,6 +1,6 @@
{ {
"name": "langflow", "name": "langflow",
"version": "0.1.1", "version": "0.1.2",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@emotion/react": "^11.10.5", "@emotion/react": "^11.10.5",
@ -53,5 +53,6 @@
"last 1 firefox version", "last 1 firefox version",
"last 1 safari version" "last 1 safari version"
] ]
} },
"proxy": "http://localhost:7860"
} }

View file

@ -4,6 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<title>LangFLow</title> <title>LangFLow</title>
<script> <script>
window.sessionStorage.setItem("port","http://localhost:7860") window.sessionStorage.setItem("port","http://localhost:7860")

View file

@ -1,13 +1,11 @@
import { APIObjectType, sendAllProps } from '../../types/api/index'; import { APIObjectType, sendAllProps } from '../../types/api/index';
import axios, { AxiosResponse } from "axios"; import axios, { AxiosResponse } from "axios";
const backendUrl = window.sessionStorage.getItem('port') || "http://localhost:7860";
export async function getAll():Promise<AxiosResponse<APIObjectType>> { export async function getAll():Promise<AxiosResponse<APIObjectType>> {
return await axios.get(`${backendUrl}/all`); return await axios.get(`/all`);
} }
export async function sendAll(data:sendAllProps) { export async function sendAll(data:sendAllProps) {
console.log(data); console.log(data);
return await axios.post(`${backendUrl}/predict`, data); return await axios.post(`/predict`, data);
} }