refac: langflow_backend -> langflow
This commit is contained in:
parent
aa8e1aee8a
commit
70dbc7eb1e
104 changed files with 174 additions and 50 deletions
|
|
@ -63,7 +63,7 @@ make run_backend
|
|||
```
|
||||
For the frontend, you will need to install the dependencies and start the development server.
|
||||
```bash
|
||||
cd langflow/frontend
|
||||
cd src/frontend
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ COPY pyproject.toml ./
|
|||
COPY ./langflow ./langflow
|
||||
|
||||
# Copy files from frontend
|
||||
COPY --from=frontend_build /app/build /app/langflow/frontend/build/
|
||||
COPY --from=frontend_build /app/build /app/src/frontend/build/
|
||||
|
||||
RUN pip install .
|
||||
|
||||
|
|
|
|||
12
Makefile
12
Makefile
|
|
@ -21,23 +21,23 @@ lint:
|
|||
poetry run ruff . --fix
|
||||
|
||||
install_frontend:
|
||||
cd langflow/frontend && npm install
|
||||
cd src/frontend && npm install
|
||||
|
||||
run_frontend:
|
||||
cd langflow/frontend && npm start
|
||||
cd src/frontend && npm start
|
||||
|
||||
run_backend:
|
||||
poetry run uvicorn langflow_backend.main:app --port 5003 --reload
|
||||
poetry run uvicorn langflow.main:app --port 5003 --reload
|
||||
|
||||
build_frontend:
|
||||
cd langflow/frontend && CI='' npm run build
|
||||
cd src/frontend && CI='' npm run build
|
||||
cp -r src/frontend/build src/backend/langflow/frontend
|
||||
|
||||
build:
|
||||
make install_frontend
|
||||
make build_frontend
|
||||
cp -r langflow/frontend/build langflow/backend/langflow_backend/frontend
|
||||
poetry build --format sdist
|
||||
rm -rf langflow/backend/langflow_backend/frontend
|
||||
rm -rf src/backend/langflow/frontend
|
||||
|
||||
publish:
|
||||
make build
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/bash
|
||||
|
||||
cd langflow/frontend
|
||||
cd src/frontend
|
||||
docker build -t logspace/frontend_build -f build.Dockerfile .
|
||||
cd ../backend
|
||||
docker build -t logspace/backend_build -f build.Dockerfile .
|
||||
|
|
|
|||
|
|
@ -15,4 +15,4 @@ COPY ./ ./
|
|||
# Install dependencies
|
||||
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi
|
||||
|
||||
CMD ["uvicorn", "langflow_backend.main:app", "--host", "0.0.0.0", "--port", "5003", "--reload"]
|
||||
CMD ["uvicorn", "langflow.main:app", "--host", "0.0.0.0", "--port", "5003", "--reload"]
|
||||
|
|
@ -9,16 +9,16 @@ services:
|
|||
- "5003:5003"
|
||||
volumes:
|
||||
- ./:/app
|
||||
command: bash -c "uvicorn langflow_backend.main:app --host 0.0.0.0 --port 5003 --reload"
|
||||
command: bash -c "uvicorn langflow.main:app --host 0.0.0.0 --port 5003 --reload"
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./langflow/frontend
|
||||
context: ./src/frontend
|
||||
dockerfile: ./dev.Dockerfile
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./langflow/frontend:/app
|
||||
- ./src/frontend:/app
|
||||
# Set process.env.BACKEND to the backend service
|
||||
environment:
|
||||
- BACKEND="http://backend:5003"
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
from langflow_backend.interface.loading import load_flow_from_json # noqa
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
FROM node:14-alpine as frontend_build
|
||||
ARG BACKEND
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
RUN npm install
|
||||
CMD ["npm", "start"]
|
||||
|
|
@ -4,14 +4,14 @@ version = "0.0.33"
|
|||
description = "A Python package with a built-in web application"
|
||||
authors = ["Logspace <contact@logspace.ai>"]
|
||||
packages = [
|
||||
{ include = "langflow_backend", from = "langflow/backend" },
|
||||
{ include = "langflow", from = "src/backend" },
|
||||
]
|
||||
include = ["langflow/backend/langflow_backend/*", "langflow/backend/langflow_backend/**/*"]
|
||||
include = ["src/backend/langflow/*", "src/backend/langflow/**/*"]
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
langflow = "langflow_backend.__main__:main"
|
||||
langflow = "langflow.__main__:main"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ __pycache__/
|
|||
notebooks
|
||||
|
||||
# frontend
|
||||
langflow_backend/frontend
|
||||
src/frontend
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
|
@ -6,7 +6,7 @@ WORKDIR /app
|
|||
RUN apt-get update && apt-get install git -y
|
||||
|
||||
COPY --from=backend_build /app/dist/*.whl /app/
|
||||
RUN pip install langflow_backend-*.whl
|
||||
RUN pip install langflow-*.whl
|
||||
RUN rm *.whl
|
||||
|
||||
EXPOSE 80
|
||||
|
|
@ -43,7 +43,7 @@ RUN curl -sSL https://install.python-poetry.org | python3 -
|
|||
# copy project requirement files here to ensure they will be cached.
|
||||
WORKDIR /app
|
||||
COPY poetry.lock pyproject.toml ./
|
||||
COPY langflow_backend/ ./langflow_backend
|
||||
COPY langflow/ ./langflow
|
||||
|
||||
# poetry install
|
||||
RUN poetry install --without dev
|
||||
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
docker build -t logspace/backend_build -f build.Dockerfile .
|
||||
VERSION=$(toml get --toml-path pyproject.toml tool.poetry.version)
|
||||
docker build --build-arg VERSION=$VERSION -t ibiscp/langflow_backend:$VERSION .
|
||||
docker push ibiscp/langflow_backend:$VERSION
|
||||
docker build --build-arg VERSION=$VERSION -t ibiscp/langflow:$VERSION .
|
||||
docker push ibiscp/langflow:$VERSION
|
||||
1
src/backend/langflow/__init__.py
Normal file
1
src/backend/langflow/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from langflow.interface.loading import load_flow_from_json # noqa
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import multiprocessing
|
||||
import platform
|
||||
|
||||
from langflow_backend.main import create_app
|
||||
from langflow.main import create_app
|
||||
|
||||
import typer
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
|
@ -44,7 +44,7 @@ def serve(
|
|||
|
||||
uvicorn.run(app, host=host, port=port, log_level="info")
|
||||
else:
|
||||
from langflow_backend.server import LangflowApplication
|
||||
from langflow.server import LangflowApplication
|
||||
|
||||
LangflowApplication(app, options).run()
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from fastapi import APIRouter, HTTPException
|
||||
from langflow_backend.interface.types import build_langchain_types_dict
|
||||
from langflow_backend.interface.run import process_data_graph
|
||||
from langflow.interface.types import build_langchain_types_dict
|
||||
from langflow.interface.run import process_data_graph
|
||||
from typing import Any, Dict
|
||||
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from fastapi import APIRouter
|
||||
|
||||
from langflow_backend.interface.listing import list_type
|
||||
from langflow.interface.listing import list_type
|
||||
|
||||
# build router
|
||||
router = APIRouter(
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
from langflow_backend.interface.signature import get_signature
|
||||
from langflow.interface.signature import get_signature
|
||||
|
||||
# build router
|
||||
router = APIRouter(
|
||||
15
src/backend/langflow/frontend/asset-manifest.json
Normal file
15
src/backend/langflow/frontend/asset-manifest.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"files": {
|
||||
"main.css": "/static/css/main.4028c70d.css",
|
||||
"main.js": "/static/js/main.8d80b6b5.js",
|
||||
"static/js/787.f861006f.chunk.js": "/static/js/787.f861006f.chunk.js",
|
||||
"index.html": "/index.html",
|
||||
"main.4028c70d.css.map": "/static/css/main.4028c70d.css.map",
|
||||
"main.8d80b6b5.js.map": "/static/js/main.8d80b6b5.js.map",
|
||||
"787.f861006f.chunk.js.map": "/static/js/787.f861006f.chunk.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.4028c70d.css",
|
||||
"static/js/main.8d80b6b5.js"
|
||||
]
|
||||
}
|
||||
1
src/backend/langflow/frontend/index.html
Normal file
1
src/backend/langflow/frontend/index.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>LangFLow</title><script defer="defer" src="/static/js/main.8d80b6b5.js"></script><link href="/static/css/main.4028c70d.css" rel="stylesheet"></head><body id="body" style="width:100%;height:100%"><noscript>You need to enable JavaScript to run this app.</noscript><div style="width:100vw;height:100vh" id="root"></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";(self.webpackChunklangflow=self.webpackChunklangflow||[]).push([[787],{787:function(e,n,t){t.r(n),t.d(n,{getCLS:function(){return y},getFCP:function(){return g},getFID:function(){return C},getLCP:function(){return P},getTTFB:function(){return D}});var i,r,a,o,u=function(e,n){return{name:e,value:void 0===n?-1:n,delta:0,entries:[],id:"v2-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},c=function(e,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if("first-input"===e&&!("PerformanceEventTiming"in self))return;var t=new PerformanceObserver((function(e){return e.getEntries().map(n)}));return t.observe({type:e,buffered:!0}),t}}catch(e){}},f=function(e,n){var t=function t(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(e(i),n&&(removeEventListener("visibilitychange",t,!0),removeEventListener("pagehide",t,!0)))};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},s=function(e){addEventListener("pageshow",(function(n){n.persisted&&e(n)}),!0)},m=function(e,n,t){var i;return function(r){n.value>=0&&(r||t)&&(n.delta=n.value-(i||0),(n.delta||void 0===i)&&(i=n.value,e(n)))}},v=-1,p=function(){return"hidden"===document.visibilityState?0:1/0},d=function(){f((function(e){var n=e.timeStamp;v=n}),!0)},l=function(){return v<0&&(v=p(),d(),s((function(){setTimeout((function(){v=p(),d()}),0)}))),{get firstHiddenTime(){return v}}},g=function(e,n){var t,i=l(),r=u("FCP"),a=function(e){"first-contentful-paint"===e.name&&(f&&f.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=e.startTime,r.entries.push(e),t(!0)))},o=window.performance&&performance.getEntriesByName&&performance.getEntriesByName("first-contentful-paint")[0],f=o?null:c("paint",a);(o||f)&&(t=m(e,r,n),o&&a(o),s((function(i){r=u("FCP"),t=m(e,r,n),requestAnimationFrame((function(){requestAnimationFrame((function(){r.value=performance.now()-i.timeStamp,t(!0)}))}))})))},h=!1,T=-1,y=function(e,n){h||(g((function(e){T=e.value})),h=!0);var t,i=function(n){T>-1&&e(n)},r=u("CLS",0),a=0,o=[],v=function(e){if(!e.hadRecentInput){var n=o[0],i=o[o.length-1];a&&e.startTime-i.startTime<1e3&&e.startTime-n.startTime<5e3?(a+=e.value,o.push(e)):(a=e.value,o=[e]),a>r.value&&(r.value=a,r.entries=o,t())}},p=c("layout-shift",v);p&&(t=m(i,r,n),f((function(){p.takeRecords().map(v),t(!0)})),s((function(){a=0,T=-1,r=u("CLS",0),t=m(i,r,n)})))},E={passive:!0,capture:!0},w=new Date,L=function(e,n){i||(i=n,r=e,a=new Date,F(removeEventListener),S())},S=function(){if(r>=0&&r<a-w){var e={entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+r};o.forEach((function(n){n(e)})),o=[]}},b=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){var t=function(){L(e,n),r()},i=function(){r()},r=function(){removeEventListener("pointerup",t,E),removeEventListener("pointercancel",i,E)};addEventListener("pointerup",t,E),addEventListener("pointercancel",i,E)}(n,e):L(n,e)}},F=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,b,E)}))},C=function(e,n){var t,a=l(),v=u("FID"),p=function(e){e.startTime<a.firstHiddenTime&&(v.value=e.processingStart-e.startTime,v.entries.push(e),t(!0))},d=c("first-input",p);t=m(e,v,n),d&&f((function(){d.takeRecords().map(p),d.disconnect()}),!0),d&&s((function(){var a;v=u("FID"),t=m(e,v,n),o=[],r=-1,i=null,F(addEventListener),a=p,o.push(a),S()}))},k={},P=function(e,n){var t,i=l(),r=u("LCP"),a=function(e){var n=e.startTime;n<i.firstHiddenTime&&(r.value=n,r.entries.push(e),t())},o=c("largest-contentful-paint",a);if(o){t=m(e,r,n);var v=function(){k[r.id]||(o.takeRecords().map(a),o.disconnect(),k[r.id]=!0,t(!0))};["keydown","click"].forEach((function(e){addEventListener(e,v,{once:!0,capture:!0})})),f(v,!0),s((function(i){r=u("LCP"),t=m(e,r,n),requestAnimationFrame((function(){requestAnimationFrame((function(){r.value=performance.now()-i.timeStamp,k[r.id]=!0,t(!0)}))}))}))}},D=function(e){var n,t=u("TTFB");n=function(){try{var n=performance.getEntriesByType("navigation")[0]||function(){var e=performance.timing,n={entryType:"navigation",startTime:0};for(var t in e)"navigationStart"!==t&&"toJSON"!==t&&(n[t]=Math.max(e[t]-e.navigationStart,0));return n}();if(t.value=t.delta=n.responseStart,t.value<0||t.value>performance.now())return;t.entries=[n],e(t)}catch(e){}},"complete"===document.readyState?setTimeout(n,0):addEventListener("load",(function(){return setTimeout(n,0)}))}}}]);
|
||||
//# sourceMappingURL=787.f861006f.chunk.js.map
|
||||
File diff suppressed because one or more lines are too long
3
src/backend/langflow/frontend/static/js/main.8d80b6b5.js
Normal file
3
src/backend/langflow/frontend/static/js/main.8d80b6b5.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,100 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Lodash <https://lodash.com/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim/with-selector.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @mui/styled-engine v5.11.9
|
||||
*
|
||||
* @license MIT
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @remix-run/router v1.3.2
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* React Router DOM v6.8.1
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
|||
from langchain import chains, agents, prompts, llms
|
||||
from langflow_backend.custom import customs
|
||||
from langflow_backend.utils import util, allowed_components
|
||||
from langflow.custom import customs
|
||||
from langflow.utils import util, allowed_components
|
||||
from langchain.agents.load_tools import get_all_tool_names
|
||||
from langchain.chains.conversation import memory as memories
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
import json
|
||||
from typing import Any, Dict, Optional
|
||||
from langflow_backend.interface.types import get_type_list
|
||||
from langflow.interface.types import get_type_list
|
||||
from langchain.agents.loading import load_agent_from_config
|
||||
from langchain.chains.loading import load_chain_from_config
|
||||
from langchain.llms.loading import load_llm_from_config
|
||||
from langflow_backend.utils import payload
|
||||
from langflow_backend.utils import util
|
||||
from langflow.utils import payload
|
||||
from langflow.utils import util
|
||||
from langchain.llms.base import BaseLLM
|
||||
|
||||
from langchain.agents.agent import AgentExecutor
|
||||
|
|
@ -2,7 +2,7 @@ import contextlib
|
|||
import io
|
||||
import re
|
||||
from typing import Any, Dict
|
||||
from langflow_backend.interface import loading
|
||||
from langflow.interface import loading
|
||||
|
||||
|
||||
def process_data_graph(data_graph: Dict[str, Any]):
|
||||
|
|
@ -8,8 +8,8 @@ from langchain.agents.load_tools import (
|
|||
get_all_tool_names,
|
||||
)
|
||||
|
||||
from langflow_backend.utils import util
|
||||
from langflow_backend.custom import customs
|
||||
from langflow.utils import util
|
||||
from langflow.custom import customs
|
||||
|
||||
|
||||
def get_signature(name: str, object_type: str):
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from langflow_backend.interface.listing import list_type
|
||||
from langflow_backend.interface.signature import get_signature
|
||||
from langflow.interface.listing import list_type
|
||||
from langflow.interface.signature import get_signature
|
||||
|
||||
|
||||
def get_type_list():
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from fastapi import FastAPI
|
||||
from langflow_backend.api.endpoints import router as endpoints_router
|
||||
from langflow_backend.api.list_endpoints import router as list_router
|
||||
from langflow_backend.api.signature import router as signatures_router
|
||||
from langflow.api.endpoints import router as endpoints_router
|
||||
from langflow.api.list_endpoints import router as list_router
|
||||
from langflow.api.signature import router as signatures_router
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
|
||||
|
|
@ -3,6 +3,6 @@
|
|||
poetry remove langchain
|
||||
docker build -t logspace/backend_build -f build.Dockerfile .
|
||||
VERSION=$(toml get --toml-path pyproject.toml tool.poetry.version)
|
||||
docker build --build-arg VERSION=$VERSION -t ibiscp/langflow_backend:$VERSION .
|
||||
docker run -p 5003:80 -d ibiscp/langflow_backend:$VERSION
|
||||
docker build --build-arg VERSION=$VERSION -t ibiscp/langflow:$VERSION .
|
||||
docker run -p 5003:80 -d ibiscp/langflow:$VERSION
|
||||
poetry add --editable ../../../langchain
|
||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue