Merge branch 'feature/store' of github.com:logspace-ai/langflow into feature/store
This commit is contained in:
commit
3584fab652
5 changed files with 34 additions and 10 deletions
|
|
@ -12,7 +12,8 @@ from dotenv import load_dotenv
|
|||
from langflow.main import setup_app
|
||||
from langflow.services.database.utils import session_getter
|
||||
from langflow.services.deps import get_db_service, get_settings_service
|
||||
from langflow.services.utils import initialize_services, initialize_settings_service
|
||||
from langflow.services.utils import (initialize_services,
|
||||
initialize_settings_service)
|
||||
from langflow.utils.logger import configure, logger
|
||||
from multiprocess import Process, cpu_count # type: ignore
|
||||
from rich import box
|
||||
|
|
@ -96,6 +97,27 @@ def update_settings(
|
|||
settings_service.settings.update_settings(STORE=False)
|
||||
|
||||
|
||||
|
||||
def version_callback(value: bool):
|
||||
"""
|
||||
Show the version and exit.
|
||||
"""
|
||||
from langflow import __version__
|
||||
if value:
|
||||
typer.echo(f"Langflow Version: {__version__}")
|
||||
raise typer.Exit()
|
||||
|
||||
@app.callback()
|
||||
def main_entry_point(
|
||||
version: bool = typer.Option(None, "--version", callback=version_callback, is_eager=True, help="Show the version and exit.")
|
||||
):
|
||||
"""
|
||||
Main entry point for the Langflow CLI.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@app.command()
|
||||
def run(
|
||||
host: str = typer.Option("127.0.0.1", help="Host to bind the server to.", envvar="LANGFLOW_HOST"),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from typing import TYPE_CHECKING
|
||||
from langflow.services.plugins.service import PluginService
|
||||
|
||||
from langflow.services.factory import ServiceFactory
|
||||
from langflow.services.plugins.service import PluginService
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langflow.services.settings.service import SettingsService
|
||||
|
|
@ -12,5 +13,4 @@ class PluginServiceFactory(ServiceFactory):
|
|||
|
||||
def create(self, settings_service: "SettingsService"):
|
||||
service = PluginService(settings_service)
|
||||
service.load_plugins()
|
||||
return service
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from typing import TYPE_CHECKING, Union
|
|||
|
||||
from langflow.services.base import Service
|
||||
from langflow.services.plugins.base import BasePlugin, CallbackPlugin
|
||||
from loguru import logger
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langflow.services.settings.service import SettingsService
|
||||
|
|
@ -18,6 +19,7 @@ class PluginService(Service):
|
|||
# plugin_dir = settings_service.settings.PLUGIN_DIR
|
||||
self.plugin_dir = os.path.dirname(__file__)
|
||||
self.plugins_base_module = "langflow.services.plugins"
|
||||
self.load_plugins()
|
||||
|
||||
def load_plugins(self):
|
||||
base_files = ["base.py", "service.py", "factory.py", "__init__.py"]
|
||||
|
|
@ -32,7 +34,7 @@ class PluginService(Service):
|
|||
if inspect.isclass(attr) and issubclass(attr, BasePlugin) and attr not in [CallbackPlugin, BasePlugin]:
|
||||
self.register_plugin(plugin_name, attr())
|
||||
except Exception as exc:
|
||||
print(f"Error loading plugin {plugin_name}: {exc}")
|
||||
logger.error(f"Error loading plugin {plugin_name}: {exc}")
|
||||
|
||||
def register_plugin(self, plugin_name, plugin_instance):
|
||||
self.plugins[plugin_name] = plugin_instance
|
||||
|
|
|
|||
|
|
@ -260,12 +260,12 @@ def get_default_imports(code_string):
|
|||
"""
|
||||
Returns a dictionary of default imports for the dynamic class constructor.
|
||||
"""
|
||||
typing_module = importlib.import_module("typing")
|
||||
default_imports = {
|
||||
"Optional": importlib.import_module("typing").Optional,
|
||||
"List": importlib.import_module("typing").List,
|
||||
"Dict": importlib.import_module("typing").Dict,
|
||||
"Union": importlib.import_module("typing").Union,
|
||||
# Add more imports from the typing module as needed
|
||||
"Optional": typing_module.Optional,
|
||||
"List": typing_module.List,
|
||||
"Dict": typing_module.Dict,
|
||||
"Union": typing_module.Union,
|
||||
}
|
||||
|
||||
langflow_imports = list(CUSTOM_COMPONENT_SUPPORTED_TYPES.keys())
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export default function ExtraSidebar(): JSX.Element {
|
|||
setFilterData(data);
|
||||
setSearch("");
|
||||
}
|
||||
}, [getFilterEdge]);
|
||||
}, [getFilterEdge, data]);
|
||||
|
||||
useEffect(() => {
|
||||
handleSearchInput(search);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue