fix: ensure unique flow names when assigning to superuser and avoid adding starter projects (#4751)

* fix: ensure unique flow names when assigning to superuser

* refactor: Creates a new function with logic to rename flows

* refactor: simplify function

* Extract STARTER_FOLDER constants to a separate module

* Filter orphaned flows by excluding those in the starter folder

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Ítalo Johnny 2024-11-21 14:35:32 -03:00 • committed by GitHub
commit e728e40561
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 76 additions and 51 deletions

View file

@ -17,7 +17,7 @@ from dotenv import load_dotenv
from fastapi.testclient import TestClient
from httpx import ASGITransport, AsyncClient
from langflow.graph import Graph
from langflow.initial_setup.setup import STARTER_FOLDER_NAME
from langflow.initial_setup.constants import STARTER_FOLDER_NAME
from langflow.services.auth.utils import get_password_hash
from langflow.services.database.models.api_key.model import ApiKey
from langflow.services.database.models.flow.model import Flow, FlowCreate

View file

@ -3,11 +3,9 @@ from datetime import datetime
from pathlib import Path
import pytest
from langflow.custom.directory_reader.utils import (
abuild_custom_component_list_from_path,
)
from langflow.custom.directory_reader.utils import abuild_custom_component_list_from_path
from langflow.initial_setup.constants import STARTER_FOLDER_NAME
from langflow.initial_setup.setup import (
STARTER_FOLDER_NAME,
get_project_data,
load_starter_projects,
update_projects_components_with_latest_component_versions,