Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global variables implementation #1548

Merged
merged 91 commits into from Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 90 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
86ccae8
Feat: make text input capable of support dropdown inputs also
igorrCarvalho Feb 5, 2024
ccb7947
Merge branch 'dropdownInput' into globalVariables
igorrCarvalho Feb 5, 2024
5eef277
Remove blank space
igorrCarvalho Feb 5, 2024
1be52e2
Fix: arrow icon dont appear in dropdown
igorrCarvalho Feb 5, 2024
0a0f35c
Add global variable API functions
anovazzi1 Feb 5, 2024
c1d9e12
Add global variables store using Zustand
anovazzi1 Feb 5, 2024
f30c1df
Feat: make input dropdown filter with text
igorrCarvalho Feb 5, 2024
e4e5b06
fix(App.tsx): import getGlobalVariables function from API controller …
anovazzi1 Feb 5, 2024
911d681
feat(addNewVariableButton.tsx): implement form logic to handle saving…
anovazzi1 Feb 5, 2024
4a1c9f8
Add global variable functionality and display on Global Variables page
anovazzi1 Feb 5, 2024
d0dcb32
Refactor global variables page and add delete functionality
anovazzi1 Feb 5, 2024
476a670
Add global variables support to InputComponent
anovazzi1 Feb 5, 2024
1558934
Add delete_credential endpoint to API
ogabrielluiz Feb 6, 2024
84f4c32
Refactor Credential model to use Optional for provider field
ogabrielluiz Feb 6, 2024
937a504
Add load_from_db_fields attribute to Vertex class
ogabrielluiz Feb 7, 2024
108d0b2
Refactor class instantiation and update params with load_from_db_fields
ogabrielluiz Feb 7, 2024
ec1fe03
Update TemplateField class in base.py
ogabrielluiz Feb 7, 2024
45e2405
feat(parameterComponent): add support for global variables in paramet…
anovazzi1 Feb 7, 2024
a91668b
fix(parameterComponent): add options prop to ParameterComponent to di…
anovazzi1 Feb 8, 2024
b76eb65
Refactor API functions and update global variables types
anovazzi1 Feb 8, 2024
9c24aff
Refactor globalVariablesStore to use optional provider
anovazzi1 Feb 8, 2024
326a0f9
Refactor getGlobalVariables function to store data in globalVariables…
anovazzi1 Feb 8, 2024
021612f
Add provider field to AddNewVariableButton component
anovazzi1 Feb 8, 2024
c724d11
Refactor registerGlobalVariable function signature
anovazzi1 Feb 8, 2024
928ba60
Refactor credential creation logic
ogabrielluiz Feb 8, 2024
3d2a764
fix(parameterComponent): fix logic for setting load_from_db property …
anovazzi1 Feb 8, 2024
6b73ad2
Fix loading.py to handle custom component keys properly
ogabrielluiz Feb 9, 2024
56133bc
Update update_params_with_load_from_db_fields signature to include ty…
ogabrielluiz Feb 9, 2024
b57173d
Add docs to CustomComponent
ogabrielluiz Feb 9, 2024
06f0e0e
Added dropdown and global page
lucaseduoli Mar 18, 2024
c57aadb
Fix merge conflicts in backend code
ogabrielluiz Mar 18, 2024
9bcd74c
Refactor code formatting and style
ogabrielluiz Mar 18, 2024
6c9a87b
Merge branch 'zustand/io/migration' into globalVariables
lucaseduoli Mar 18, 2024
e38cf0d
Changed component.py to fix bug
lucaseduoli Mar 18, 2024
735d5ed
Add imports and update log level in run_langflow function
ogabrielluiz Mar 19, 2024
50d27ee
Remove duplicate import statements and unused imports
ogabrielluiz Mar 19, 2024
d003be4
Updated global variables to ShadCN and updated logic to show variable…
lucaseduoli Mar 20, 2024
1b61025
Fixed logic when options are present but its not global variables.
lucaseduoli Mar 20, 2024
6dc4599
Changed icons for other options that are not global variable
lucaseduoli Mar 20, 2024
41cbd91
Deleted variables page
lucaseduoli Mar 20, 2024
ea21106
Implemented Delete function
lucaseduoli Mar 21, 2024
ca46044
Fixed position on command when filtering
lucaseduoli Mar 21, 2024
ba9124c
Formatting
lucaseduoli Mar 21, 2024
99561d0
Merge remote-tracking branch 'origin/zustand/io/migration' into globa…
lucaseduoli Mar 21, 2024
1604680
Formatting
lucaseduoli Mar 21, 2024
178db4b
Fix merge bug
lucaseduoli Mar 21, 2024
3b7cae8
Update delete_credential function to return status code 204
ogabrielluiz Mar 21, 2024
69735b0
Refactor addNewVariableButtonComponent and API registerGlobalVariable
ogabrielluiz Mar 21, 2024
7f34516
Change key to name
ogabrielluiz Mar 21, 2024
fbe346c
Refactor globalVariables key names in GlobalVariablesStore
ogabrielluiz Mar 21, 2024
df62170
Implemented error alerts and function to clean deleted global variables
lucaseduoli Mar 22, 2024
ad8e016
Fixed error message appearing when deleting field
lucaseduoli Mar 22, 2024
0f867dc
Merge remote-tracking branch 'origin/zustand/io/migration' into globa…
lucaseduoli Mar 22, 2024
cded4aa
Refactor build_template_config method to use eval_custom_component_code
ogabrielluiz Mar 22, 2024
002da17
Remove unecessary method
ogabrielluiz Mar 22, 2024
479d6ec
Refactor template_config generation in Component class
ogabrielluiz Mar 22, 2024
b121a03
Update description for AddNewVariableButton component
ogabrielluiz Mar 22, 2024
fe2f30d
Added global input component to modularize
lucaseduoli Mar 22, 2024
7aa3c5f
Added type into new Global input component
lucaseduoli Mar 22, 2024
2ba305b
Add Variable model and remove Credential model
ogabrielluiz Mar 25, 2024
6d258a7
Add variables_router to APIRouter
ogabrielluiz Mar 25, 2024
8292cb8
Update global variable type in API and store
ogabrielluiz Mar 25, 2024
f8bd698
Remove UTC import and fix datetime function call
anovazzi1 Mar 25, 2024
dc531de
fix datetime utc for python<3.11
anovazzi1 Mar 25, 2024
bb3461c
Refactor Variable model in database
ogabrielluiz Mar 25, 2024
0175fc4
Add support for loading template field from the database
ogabrielluiz Mar 26, 2024
f741b97
Fix capitalization in error messages
ogabrielluiz Mar 26, 2024
5db74fb
Changed provider to type and hid field
lucaseduoli Mar 26, 2024
42739a2
Added types
lucaseduoli Mar 26, 2024
ae7d827
Fixed type to always exist
lucaseduoli Mar 26, 2024
1315137
put optional label on type
lucaseduoli Mar 26, 2024
d123d5b
Added editNode variable on global variables for inputs
lucaseduoli Mar 26, 2024
ff8c3d7
Fixed input of global variables
lucaseduoli Mar 26, 2024
95f5c44
Merge remote-tracking branch 'origin/zustand/io/migration' into globa…
ogabrielluiz Mar 26, 2024
0385cfb
Add setup_devcontainer target to Makefile
ogabrielluiz Mar 26, 2024
00322ed
Refactor Makefile to include conditional statements for environment v…
ogabrielluiz Mar 26, 2024
5326155
Add VariableService and related files
ogabrielluiz Mar 26, 2024
16e91a0
Update mypy configuration to include namespace packages
ogabrielluiz Mar 27, 2024
a92dcaf
Update agent.py and experimental components
ogabrielluiz Mar 27, 2024
257f802
Update function signature and import statements
ogabrielluiz Mar 27, 2024
d54e450
Refactor code and fix bugs
ogabrielluiz Mar 27, 2024
827d6be
Add new langflow helper functions and remove base model component
ogabrielluiz Mar 27, 2024
73a23ca
Add new files and modify existing files
ogabrielluiz Mar 27, 2024
b603d73
Add version module and update imports
ogabrielluiz Mar 27, 2024
56a485e
Update packages include path in pyproject.toml
ogabrielluiz Mar 27, 2024
2bc6d99
Update Poetry version to 1.8.2
ogabrielluiz Mar 27, 2024
eaf2479
Update function signature, refactor code, add new langflow helper fun…
ogabrielluiz Mar 27, 2024
fc432f2
Update poetry version to 1.8.2 in Dockerfiles
ogabrielluiz Mar 27, 2024
a08b84c
Merge branch 'fix_lint_problems' into globalVariables
ogabrielluiz Mar 27, 2024
1434081
Merge branch 'zustand/io/migration' into globalVariables
ogabrielluiz Mar 27, 2024
75d1c83
Merge branch 'zustand/io/migration' into globalVariables
ogabrielluiz Mar 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/lint.yml
Expand Up @@ -14,15 +14,14 @@ on:
- "src/backend/**"

env:
POETRY_VERSION: "1.7.0"
POETRY_VERSION: "1.8.2"

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -15,7 +15,7 @@ on:
- "src/backend/**"

env:
POETRY_VERSION: "1.5.0"
POETRY_VERSION: "1.8.2"

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -32,7 +32,7 @@ format:

lint:
make install_backend
poetry run mypy src/backend
poetry run mypy --namespace-packages -p "langflow"
poetry run ruff . --fix

install_frontend:
Expand Down
2 changes: 1 addition & 1 deletion base.Dockerfile
Expand Up @@ -23,7 +23,7 @@ ENV PYTHONUNBUFFERED=1 \
\
# poetry
# https://python-poetry.org/docs/configuration/#using-environment-variables
POETRY_VERSION=1.7.1 \
POETRY_VERSION=1.8.2 \
# make poetry install to this location
POETRY_HOME="/opt/poetry" \
# make poetry create the virtual environment in the project's root
Expand Down
2 changes: 1 addition & 1 deletion build_and_push.Dockerfile
Expand Up @@ -23,7 +23,7 @@ ENV PYTHONUNBUFFERED=1 \
\
# poetry
# https://python-poetry.org/docs/configuration/#using-environment-variables
POETRY_VERSION=1.7.1 \
POETRY_VERSION=1.8.2 \
# make poetry install to this location
POETRY_HOME="/opt/poetry" \
# make poetry create the virtual environment in the project's root
Expand Down
2 changes: 1 addition & 1 deletion deploy/base.Dockerfile
Expand Up @@ -23,7 +23,7 @@ ENV PYTHONUNBUFFERED=1 \
\
# poetry
# https://python-poetry.org/docs/configuration/#using-environment-variables
POETRY_VERSION=1.5.1 \
POETRY_VERSION=1.8.2 \
# make poetry install to this location
POETRY_HOME="/opt/poetry" \
# make poetry create the virtual environment in the project's root
Expand Down
7 changes: 6 additions & 1 deletion src/backend/base/langflow/__main__.py
Expand Up @@ -285,7 +285,12 @@ def run_langflow(host, port, log_level, options, app):
# MacOS requires an env variable to be set to use gunicorn
import uvicorn

uvicorn.run(app, host=host, port=port, log_level=log_level)
uvicorn.run(
app,
host=host,
port=port,
log_level=log_level.lower(),
)
else:
from langflow.server import LangflowApplication

Expand Down
199 changes: 0 additions & 199 deletions src/backend/base/langflow/alembic/helpers/flow.py

This file was deleted.

34 changes: 0 additions & 34 deletions src/backend/base/langflow/alembic/helpers/record.py

This file was deleted.

@@ -0,0 +1,65 @@
"""Replace Credential table with Variable

Revision ID: 1a110b568907
Revises: 63b9c451fd30
Create Date: 2024-03-25 09:40:02.743453

"""
from typing import Sequence, Union

import sqlalchemy as sa
import sqlmodel
from alembic import op
from sqlalchemy.engine.reflection import Inspector

# revision identifiers, used by Alembic.
revision: str = "1a110b568907"
down_revision: Union[str, None] = "63b9c451fd30"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
conn = op.get_bind()
inspector = Inspector.from_engine(conn) # type: ignore
table_names = inspector.get_table_names()
# ### commands auto generated by Alembic - please adjust! ###
if "variable" not in table_names:
op.create_table(
"variable",
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
sa.Column("value", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
sa.Column("type", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
sa.Column("id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column("created_at", sa.DateTime(), nullable=False),
sa.Column("updated_at", sa.DateTime(), nullable=True),
sa.Column("user_id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.ForeignKeyConstraint(["user_id"], ["user.id"], name="fk_variable_user_id"),
sa.PrimaryKeyConstraint("id"),
)
if "credential" in table_names:
op.drop_table("credential")
# ### end Alembic commands ###


def downgrade() -> None:
conn = op.get_bind()
inspector = Inspector.from_engine(conn) # type: ignore
table_names = inspector.get_table_names()
# ### commands auto generated by Alembic - please adjust! ###
if "credential" not in table_names:
op.create_table(
"credential",
sa.Column("name", sa.VARCHAR(), nullable=True),
sa.Column("value", sa.VARCHAR(), nullable=True),
sa.Column("provider", sa.VARCHAR(), nullable=True),
sa.Column("user_id", sa.CHAR(length=32), nullable=False),
sa.Column("id", sa.CHAR(length=32), nullable=False),
sa.Column("created_at", sa.DATETIME(), nullable=False),
sa.Column("updated_at", sa.DATETIME(), nullable=True),
sa.ForeignKeyConstraint(["user_id"], ["user.id"], name="fk_credential_user_id"),
sa.PrimaryKeyConstraint("id"),
)
if "variable" in table_names:
op.drop_table("variable")
# ### end Alembic commands ###