From 1d33933d6429c763a27b5a09a951da01d0ec9e10 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 6 Jun 2023 16:30:34 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(=5F=5Fmain=5F=5F.py):=20make?= =?UTF-8?q?=20database=5Furl=20parameter=20optional=20in=20update=5Fsettin?= =?UTF-8?q?gs=20function=20=F0=9F=90=9B=20fix(llms.py):=20add=20name=20che?= =?UTF-8?q?ck=20before=20checking=20if=20"azure"=20is=20in=20name.lower()?= =?UTF-8?q?=20=F0=9F=94=A8=20refactor(test=5Fdatabase.py):=20rename=20upda?= =?UTF-8?q?ted=5Fflow=5Fstyle=20variable=20to=20to=5Fupdate=5Fflow=5Fstyle?= =?UTF-8?q?=20for=20clarity=20The=20update=5Fsettings=20function=20now=20h?= =?UTF-8?q?as=20an=20optional=20database=5Furl=20parameter=20to=20allow=20?= =?UTF-8?q?for=20more=20flexibility=20in=20updating=20settings.=20The=20ll?= =?UTF-8?q?ms.py=20file=20now=20checks=20if=20the=20name=20variable=20is?= =?UTF-8?q?=20not=20None=20before=20checking=20if=20"azure"=20is=20in=20na?= =?UTF-8?q?me.lower().=20In=20test=5Fdatabase.py,=20the=20updated=5Fflow?= =?UTF-8?q?=5Fstyle=20variable=20is=20renamed=20to=20to=5Fupdate=5Fflow=5F?= =?UTF-8?q?style=20for=20clarity.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/__main__.py | 3 ++- src/backend/langflow/template/frontend_node/llms.py | 2 +- tests/test_database.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/backend/langflow/__main__.py b/src/backend/langflow/__main__.py index 543c59f32..7e7fa076b 100644 --- a/src/backend/langflow/__main__.py +++ b/src/backend/langflow/__main__.py @@ -1,6 +1,7 @@ import multiprocessing import platform from pathlib import Path +from typing import Optional import typer from fastapi.staticfiles import StaticFiles @@ -18,7 +19,7 @@ def get_number_of_workers(workers=None): return workers -def update_settings(config: str, dev: bool = False, database_url: str = None): +def update_settings(config: str, dev: bool = False, database_url: Optional[str] = None): """Update the settings from a config file.""" if config: settings.update_from_yaml(config, dev=dev) diff --git a/src/backend/langflow/template/frontend_node/llms.py b/src/backend/langflow/template/frontend_node/llms.py index 39e82422f..c2aedb45e 100644 --- a/src/backend/langflow/template/frontend_node/llms.py +++ b/src/backend/langflow/template/frontend_node/llms.py @@ -66,5 +66,5 @@ class LLMFrontendNode(FrontendNode): field.show = True LLMFrontendNode.format_openai_field(field) - if "azure" in name.lower(): + if name and "azure" in name.lower(): LLMFrontendNode.format_azure_field(field) diff --git a/tests/test_database.py b/tests/test_database.py index e4ba26387..8b680129f 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -299,9 +299,9 @@ def test_update_flow_style(client: TestClient): flow_style = FlowStyleCreate(color="red", emoji="🔴") response = client.post("api/v1/flow_styles/", json=flow_style.dict()) created_flow_style = FlowStyleRead(**response.json()) - updated_flow_style = FlowStyleUpdate(color="blue") + to_update_flow_style = FlowStyleUpdate(color="blue") response = client.patch( - f"api/v1/flow_styles/{created_flow_style.id}", json=updated_flow_style.dict() + f"api/v1/flow_styles/{created_flow_style.id}", json=to_update_flow_style.dict() ) assert response.status_code == 200 updated_flow_style = FlowStyleRead(**response.json())