feat: add password field

This commit is contained in:
Ibis Prevedello 2023-03-08 21:21:50 -03:00
commit ba5dbbd7cd
5 changed files with 18 additions and 12 deletions

View file

@ -6,7 +6,7 @@ WORKDIR /app
RUN apt-get update && apt-get install git -y RUN apt-get update && apt-get install git -y
COPY --from=backend_build /app/dist/*.whl /app/ COPY --from=backend_build /app/dist/*.whl /app/
RUN pip install langflow-0.0.21-py3-none-any.whl RUN pip install langflow-*.whl
RUN rm *.whl RUN rm *.whl
EXPOSE 80 EXPOSE 80

View file

@ -51,4 +51,4 @@ RUN poetry add "git+https://github.com/ibiscp/langchain.git#ibis"
COPY *.py langflow/backend/ COPY *.py langflow/backend/
RUN rm langflow/backend/dev.py RUN rm langflow/backend/dev.py
RUN poetry build RUN poetry build -f wheel

View file

@ -259,33 +259,32 @@ def format_dict(d):
if "Mapping" in _type: if "Mapping" in _type:
_type = _type.replace("Mapping", "dict") _type = _type.replace("Mapping", "dict")
# Change type from str to Tool
value["type"] = "Tool" if key == "allowed_tools" else _type value["type"] = "Tool" if key == "allowed_tools" else _type
# Show if required # Show or not field
value["show"] = bool( value["show"] = bool(
(value["required"] and key not in ["input_variables"]) (value["required"] and key not in ["input_variables"])
or key or key
in [ in [
"allowed_tools", "allowed_tools",
# "Memory",
"memory", "memory",
"prefix", "prefix",
"examples", "examples",
"temperature", "temperature",
] ]
or "api_key" in key or any(text in key for text in ["password", "token", "api", "key"])
) )
# Add password field
value["password"] = any(text in key for text in ["password", "token", "api", "key"])
# Add multline # Add multline
value["multiline"] = key in ["suffix", "prefix", "template", "examples"] value["multiline"] = key in ["suffix", "prefix", "template", "examples"]
# Replace default value with actual value # Replace default value with actual value
# if _type in ["str", "bool"]:
# value["value"] = value.get("default", "")
# if "default" in value:
# value.pop("default")
if "default" in value: if "default" in value:
value["value"] = value["default"] value["value"] = value["default"]
value.pop("default") value.pop("default")
# Filter out keys that should not be shown
return d return d

View file

@ -1,13 +1,12 @@
[tool.poetry] [tool.poetry]
name = "langflow-backend" name = "langflow-backend"
version = "0.0.21" version = "0.0.22"
description = "Backend for Langflow" description = "Backend for Langflow"
authors = ["Ibis Prevedello <ibiscp@gmail.com>", "Gabriel Almeida <gabrielf.almeida90@gmail.com>"] authors = ["Ibis Prevedello <ibiscp@gmail.com>", "Gabriel Almeida <gabrielf.almeida90@gmail.com>"]
packages = [ packages = [
{ include = "langflow_backend" }, { include = "langflow_backend" },
] ]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.9" python = "^3.9"
openai = "^0.26.5" openai = "^0.26.5"

8
langflow/backend/run Executable file
View file

@ -0,0 +1,8 @@
#! /bin/bash
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
poetry add --editable ../../../langchain