Merge remote-tracking branch 'origin/main' into dev
This commit is contained in:
commit
dd6d510be3
7 changed files with 64 additions and 19 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -255,4 +255,5 @@ langflow.db
|
||||||
|
|
||||||
/tmp/*
|
/tmp/*
|
||||||
src/backend/langflow/frontend/
|
src/backend/langflow/frontend/
|
||||||
.docker
|
.docker
|
||||||
|
scratchpad*
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "langflow"
|
name = "langflow"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
description = "A Python package with a built-in web application"
|
description = "A Python package with a built-in web application"
|
||||||
authors = ["Logspace <contact@logspace.ai>"]
|
authors = ["Logspace <contact@logspace.ai>"]
|
||||||
maintainers = [
|
maintainers = [
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
"""Add unique constraints
|
||||||
|
|
||||||
|
Revision ID: 006b3990db50
|
||||||
|
Revises: 1ef9c4f3765d
|
||||||
|
Create Date: 2023-12-13 18:55:52.587360
|
||||||
|
|
||||||
|
"""
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa # noqa: F401
|
||||||
|
import sqlmodel # noqa: F401
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = '006b3990db50'
|
||||||
|
down_revision: Union[str, None] = '1ef9c4f3765d'
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('apikey', schema=None) as batch_op:
|
||||||
|
batch_op.create_unique_constraint('uq_apikey_id', ['id'])
|
||||||
|
|
||||||
|
with op.batch_alter_table('flow', schema=None) as batch_op:
|
||||||
|
batch_op.create_unique_constraint('uq_flow_id', ['id'])
|
||||||
|
|
||||||
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||||
|
batch_op.create_unique_constraint('uq_user_id', ['id'])
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||||
|
batch_op.drop_constraint('uq_user_id', type_='unique')
|
||||||
|
|
||||||
|
with op.batch_alter_table('flow', schema=None) as batch_op:
|
||||||
|
batch_op.drop_constraint('uq_flow_id', type_='unique')
|
||||||
|
|
||||||
|
with op.batch_alter_table('apikey', schema=None) as batch_op:
|
||||||
|
batch_op.drop_constraint('uq_apikey_id', type_='unique')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
@ -178,7 +178,6 @@ async def stream_build(
|
||||||
time_elapsed = format_elapsed_time(time.perf_counter() - start_time)
|
time_elapsed = format_elapsed_time(time.perf_counter() - start_time)
|
||||||
update_build_status(cache_service, flow_id, BuildStatus.FAILURE)
|
update_build_status(cache_service, flow_id, BuildStatus.FAILURE)
|
||||||
|
|
||||||
|
|
||||||
vertex_id = vertex.parent_node_id if vertex.parent_is_top_level else vertex.id
|
vertex_id = vertex.parent_node_id if vertex.parent_is_top_level else vertex.id
|
||||||
if vertex_id in graph.top_level_vertices:
|
if vertex_id in graph.top_level_vertices:
|
||||||
response = {
|
response = {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
from langflow.services.cache.service import InMemoryCache, RedisCache, BaseCacheService
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from langflow.services.cache.service import BaseCacheService, InMemoryCache, RedisCache
|
||||||
from langflow.services.factory import ServiceFactory
|
from langflow.services.factory import ServiceFactory
|
||||||
from langflow.utils.logger import logger
|
from langflow.utils.logger import logger
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from langflow.services.settings.service import SettingsService
|
from langflow.services.settings.service import SettingsService
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,17 @@ from typing import TYPE_CHECKING
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from alembic import command, util
|
from alembic import command, util
|
||||||
from alembic.config import Config
|
from alembic.config import Config
|
||||||
|
from loguru import logger
|
||||||
|
from sqlalchemy import inspect
|
||||||
|
from sqlalchemy.exc import OperationalError
|
||||||
|
from sqlmodel import Session, SQLModel, create_engine, select, text
|
||||||
|
|
||||||
from langflow.services.base import Service
|
from langflow.services.base import Service
|
||||||
from langflow.services.database import models # noqa
|
from langflow.services.database import models # noqa
|
||||||
from langflow.services.database.models.user.crud import get_user_by_username
|
from langflow.services.database.models.user.crud import get_user_by_username
|
||||||
from langflow.services.database.utils import Result, TableResults
|
from langflow.services.database.utils import Result, TableResults
|
||||||
from langflow.services.deps import get_settings_service
|
from langflow.services.deps import get_settings_service
|
||||||
from langflow.services.utils import teardown_superuser
|
from langflow.services.utils import teardown_superuser
|
||||||
from loguru import logger
|
|
||||||
from sqlalchemy import inspect
|
|
||||||
from sqlalchemy.exc import OperationalError
|
|
||||||
from sqlmodel import Session, SQLModel, create_engine, select, text
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from sqlalchemy.engine import Engine
|
from sqlalchemy.engine import Engine
|
||||||
|
|
@ -147,16 +148,18 @@ class DatabaseService(Service):
|
||||||
try:
|
try:
|
||||||
command.check(alembic_cfg)
|
command.check(alembic_cfg)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
if isinstance(exc, util.exc.CommandError) or isinstance(exc, util.exc.AutogenerateDiffsDetected):
|
if isinstance(exc, (util.exc.CommandError, util.exc.AutogenerateDiffsDetected)):
|
||||||
command.upgrade(alembic_cfg, "head")
|
command.upgrade(alembic_cfg, "head")
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
command.check(alembic_cfg)
|
command.check(alembic_cfg)
|
||||||
except util.exc.AutogenerateDiffsDetected:
|
except util.exc.AutogenerateDiffsDetected as e:
|
||||||
logger.exception("AutogenerateDiffsDetected: {exc}")
|
logger.exception("AutogenerateDiffsDetected: {exc}")
|
||||||
if not fix:
|
if not fix:
|
||||||
raise RuntimeError("Something went wrong running migrations. Please, run `langflow migration --fix`")
|
raise RuntimeError(
|
||||||
|
"Something went wrong running migrations. Please, run `langflow migration --fix`"
|
||||||
|
) from e
|
||||||
|
|
||||||
if fix:
|
if fix:
|
||||||
self.try_downgrade_upgrade_until_success(alembic_cfg)
|
self.try_downgrade_upgrade_until_success(alembic_cfg)
|
||||||
|
|
|
||||||
|
|
@ -69,14 +69,10 @@ class TemplateField(BaseModel):
|
||||||
|
|
||||||
@field_serializer("file_path")
|
@field_serializer("file_path")
|
||||||
def serialize_file_path(self, value):
|
def serialize_file_path(self, value):
|
||||||
if self.field_type == "file":
|
return value if self.field_type == "file" else ""
|
||||||
return value
|
|
||||||
return ""
|
|
||||||
|
|
||||||
@field_serializer("field_type")
|
@field_serializer("field_type")
|
||||||
def serialize_field_type(self, value, _info):
|
def serialize_field_type(self, value, _info):
|
||||||
if value == "float":
|
if value == "float" and self.range_spec is None:
|
||||||
# check if range_spec is set
|
self.range_spec = RangeSpec()
|
||||||
if self.range_spec is None:
|
|
||||||
self.range_spec = RangeSpec()
|
|
||||||
return value
|
return value
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue