feat: organize and creat build project
This commit is contained in:
parent
28a8f23620
commit
37c707d3d6
17 changed files with 1543 additions and 11 deletions
0
langflow/backend/__init__.py
Normal file
0
langflow/backend/__init__.py
Normal file
|
|
@ -1,7 +1,7 @@
|
|||
from fastapi import FastAPI
|
||||
from endpoints import router as endpoints_router
|
||||
from list_endpoints import router as list_router
|
||||
from signature import router as signatures_router
|
||||
from langflow.backend.endpoints import router as endpoints_router
|
||||
from langflow.backend.list_endpoints import router as list_router
|
||||
from langflow.backend.signature import router as signatures_router
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from fastapi import APIRouter
|
||||
import signature
|
||||
import list_endpoints
|
||||
import payload
|
||||
from langflow.backend import signature
|
||||
from langflow.backend import list_endpoints
|
||||
from langflow.backend import payload
|
||||
from langchain.agents.loading import load_agent_executor_from_config
|
||||
from langchain.chains.loading import load_chain_from_config
|
||||
from langchain.llms.loading import load_llm_from_config
|
||||
|
|
@ -24,7 +24,7 @@ def get_type_list():
|
|||
return all_types
|
||||
|
||||
|
||||
@router.get("/")
|
||||
@router.get("/all")
|
||||
def get_all():
|
||||
return {
|
||||
"chains": {
|
||||
|
|
@ -6,7 +6,7 @@ from langchain import prompts
|
|||
from langchain import llms
|
||||
from langchain.chains.conversation import memory as memories
|
||||
from langchain.agents.load_tools import get_all_tool_names
|
||||
import util
|
||||
from langflow.backend import util
|
||||
|
||||
|
||||
# build router
|
||||
|
|
@ -9,7 +9,7 @@ from langchain.agents.load_tools import (
|
|||
)
|
||||
from langchain.chains.conversation import memory as memories
|
||||
|
||||
import util
|
||||
from langflow.backend import util
|
||||
|
||||
# build router
|
||||
router = APIRouter(
|
||||
3
langflow/build
Executable file
3
langflow/build
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#! /bin/bash
|
||||
|
||||
cd ../space_flow && npm run build
|
||||
25
langflow/cli.py
Normal file
25
langflow/cli.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from fastapi import FastAPI
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from pathlib import Path
|
||||
|
||||
from langflow.backend.app import create_app
|
||||
|
||||
# get the directory of the current file
|
||||
path = Path(__file__).parent
|
||||
static_files_dir = path / "frontend/build"
|
||||
app = create_app()
|
||||
|
||||
app.mount(
|
||||
"/",
|
||||
StaticFiles(directory=static_files_dir, html=True),
|
||||
name="static",
|
||||
)
|
||||
|
||||
def main():
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(app, host="localhost", port=8000)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
1473
poetry.lock
generated
Normal file
1473
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
31
pyproject.toml
Normal file
31
pyproject.toml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[tool.poetry]
|
||||
name = "langflow"
|
||||
version = "0.1.0"
|
||||
description = "A Python package with a built-in web application"
|
||||
authors = ["Ibis Prevedello <ibiscp@gmail.com>"]
|
||||
packages = [
|
||||
{ include = "langflow/cli.py" },
|
||||
{ include = "langflow/backend/*.py" }
|
||||
]
|
||||
include = [{path= "langflow/frontend/build/*", format=["sdist", "wheel"]},
|
||||
{path= "langflow/frontend/build/static/js/*", format=["sdist", "wheel"]},
|
||||
{path= "langflow/frontend/build/static/css/*", format=["sdist", "wheel"]}]
|
||||
|
||||
[tool.poetry.scripts]
|
||||
langflow = "langflow.cli:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.10"
|
||||
openai = "^0.26.5"
|
||||
fastapi = "^0.91.0"
|
||||
uvicorn = "^0.20.0"
|
||||
beautifulsoup4 = "^4.11.2"
|
||||
google-search-results = "^2.4.1"
|
||||
google-api-python-client = "^2.79.0"
|
||||
langchain = {git = "https://github.com/ibiscp/langchain.git", rev = "ibis"}
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import axios from "axios";
|
||||
|
||||
export async function getAll() {
|
||||
return await axios.get("http://localhost:5003/");
|
||||
return await axios.get("http://localhost:8000/all");
|
||||
}
|
||||
|
||||
export async function sendAll(data) {
|
||||
console.log(data);
|
||||
return await axios.post("http://localhost:5003/predict", data);
|
||||
return await axios.post("http://localhost:8000/predict", data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue