🐛 fix(__main__.py): make database_url parameter optional in update_settings function

🐛 fix(llms.py): add name check before checking if "azure" is in name.lower()
🔨 refactor(test_database.py): rename updated_flow_style variable to to_update_flow_style for clarity
The update_settings function now has an optional database_url parameter to allow for more flexibility in updating settings. The llms.py file now checks if the name variable is not None before checking if "azure" is in name.lower(). In test_database.py, the updated_flow_style variable is renamed to to_update_flow_style for clarity.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-06 16:30:34 -03:00
commit 1d33933d64
3 changed files with 5 additions and 4 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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())