Update Dockerfiles, main.py, constants.py, and package versions (#1691)

* Update Dockerfiles to include user creation and use --user flag for pip install

* Add JavaScriptMIMETypeMiddleware to main.py

* Update constants.py and run.py files

* Update package versions in poetry.lock and pyproject.toml files

* Refactor Dockerfile to optimize image building process

* Fix import error in main.py

* Update Dockerfiles to use logspace/langflow image
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-04-12 16:39:22 -03:00 • committed by GitHub
commit 1a021321a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 31 additions and 123 deletions

View file

@ -5,6 +5,7 @@ Revises: 63b9c451fd30
Create Date: 2024-03-25 09:40:02.743453
"""
from typing import Sequence, Union
import sqlalchemy as sa

View file

@ -5,7 +5,7 @@ Revises: e3bc869fa272
Create Date: 2024-04-11 19:23:10.697335
"""
from calendar import c
from typing import Sequence, Union
import sqlalchemy as sa

View file

@ -6,6 +6,7 @@ Constants:
- NODE_FORMAT_ATTRIBUTES: A list of attributes used for formatting nodes.
- FIELD_FORMAT_ATTRIBUTES: A list of attributes used for formatting fields.
"""
STREAM_INFO_TEXT = "Stream the response from the model. Streaming works only in Chat."
NODE_FORMAT_ATTRIBUTES = ["beta", "icon", "display_name", "description"]

View file

@ -1,9 +1,5 @@
from typing import Dict, Tuple
from loguru import logger
from langflow.graph import Graph
def get_memory_key(langchain_object):
"""

View file

@ -11,6 +11,7 @@ from fastapi.responses import FileResponse
from fastapi.staticfiles import StaticFiles
from loguru import logger
from rich import print as rprint
from starlette.middleware.base import BaseHTTPMiddleware
from langflow.api import router
from langflow.initial_setup.setup import create_or_update_starter_projects
@ -20,8 +21,16 @@ from langflow.services.utils import initialize_services, teardown_services
from langflow.utils.logger import configure
class JavaScriptMIMETypeMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request: Request, call_next):
response = await call_next(request)
if "files/" not in request.url.path and request.url.path.endswith(".js") and response.status_code == 200:
response.headers["Content-Type"] = "text/javascript"
return response
def get_lifespan(fix_migration=False, socketio_server=None):
from langflow.version import __version__
from langflow.version import __version__ # type: ignore
@asynccontextmanager
async def lifespan(app: FastAPI):
@ -62,6 +71,7 @@ def create_app():
allow_methods=["*"],
allow_headers=["*"],
)
app.add_middleware(JavaScriptMIMETypeMiddleware)
@app.middleware("http")
async def flatten_query_string_lists(request: Request, call_next):

View file

@ -1146,13 +1146,13 @@ extended-testing = ["lxml (>=5.1.0,<6.0.0)"]
[[package]]
name = "langsmith"
version = "0.1.45"
version = "0.1.46"
description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform."
optional = false
python-versions = "<4.0,>=3.8.1"
files = [
{file = "langsmith-0.1.45-py3-none-any.whl", hash = "sha256:5a5b7fafe767fa28826c925f175875c09bf5368bfdb141286381a94bf737e6ef"},
{file = "langsmith-0.1.45.tar.gz", hash = "sha256:713206107df636db1edf30867d64b92495afb1f09d2fee0857a77b7a8ee083d5"},
{file = "langsmith-0.1.46-py3-none-any.whl", hash = "sha256:459b76b25fe3b86e7bf5521f4dc8c3f796de288ceb3e0d05c99db4d509edaabf"},
{file = "langsmith-0.1.46.tar.gz", hash = "sha256:a5a96259e411641633561575b567c2139bede997f7104eeedb59cb9511416d1b"},
]
[package.dependencies]

View file

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