mirror of
https://github.com/langgenius/dify.git
synced 2026-02-09 23:20:12 -05:00
Compare commits
15 Commits
main
...
feat/remov
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdca0d3789 | ||
|
|
29ce6fd2cd | ||
|
|
476cab18df | ||
|
|
c7fbc44257 | ||
|
|
a15f80dda3 | ||
|
|
5858545abe | ||
|
|
7193bdec8c | ||
|
|
3b24678d2a | ||
|
|
231581f67e | ||
|
|
5e9f4bface | ||
|
|
2707db383f | ||
|
|
c35ecf77ca | ||
|
|
e1777d0f09 | ||
|
|
979dec1dbc | ||
|
|
74202586da |
@@ -343,9 +343,7 @@ class CompletionConversationApi(Resource):
|
||||
current_user, _ = current_account_with_tenant()
|
||||
args = CompletionConversationQuery.model_validate(request.args.to_dict(flat=True)) # type: ignore
|
||||
|
||||
query = sa.select(Conversation).where(
|
||||
Conversation.app_id == app_model.id, Conversation.mode == "completion", Conversation.is_deleted.is_(False)
|
||||
)
|
||||
query = sa.select(Conversation).where(Conversation.app_id == app_model.id, Conversation.mode == "completion")
|
||||
|
||||
if args.keyword:
|
||||
from libs.helper import escape_like_pattern
|
||||
@@ -460,7 +458,7 @@ class ChatConversationApi(Resource):
|
||||
.subquery()
|
||||
)
|
||||
|
||||
query = sa.select(Conversation).where(Conversation.app_id == app_model.id, Conversation.is_deleted.is_(False))
|
||||
query = sa.select(Conversation).where(Conversation.app_id == app_model.id)
|
||||
|
||||
if args.keyword:
|
||||
from libs.helper import escape_like_pattern
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
"""remove unused is_deleted from conversations
|
||||
|
||||
Revision ID: e5d7a95e676f
|
||||
Revises: 288345cd01d1
|
||||
Create Date: 2025-11-27 18:27:09.006691
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "e5d7a95e676f"
|
||||
down_revision = "9d77545f524e"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
conversations = sa.table("conversations", sa.column("is_deleted", sa.Boolean))
|
||||
op.execute(sa.delete(conversations).where(conversations.c.is_deleted == sa.true()))
|
||||
|
||||
with op.batch_alter_table("conversations", schema=None) as batch_op:
|
||||
batch_op.drop_column("is_deleted")
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table("conversations", schema=None) as batch_op:
|
||||
batch_op.add_column(
|
||||
sa.Column(
|
||||
"is_deleted",
|
||||
sa.BOOLEAN(),
|
||||
server_default=sa.text("false"),
|
||||
autoincrement=False,
|
||||
nullable=False,
|
||||
)
|
||||
)
|
||||
@@ -745,8 +745,6 @@ class Conversation(Base):
|
||||
"MessageAnnotation", backref="conversation", lazy="select", passive_deletes="all"
|
||||
)
|
||||
|
||||
is_deleted: Mapped[bool] = mapped_column(sa.Boolean, nullable=False, server_default=sa.text("false"))
|
||||
|
||||
@property
|
||||
def inputs(self) -> dict[str, Any]:
|
||||
inputs = self._inputs.copy()
|
||||
|
||||
@@ -49,7 +49,6 @@ class ConversationService:
|
||||
return InfiniteScrollPagination(data=[], limit=limit, has_more=False)
|
||||
|
||||
stmt = select(Conversation).where(
|
||||
Conversation.is_deleted == False,
|
||||
Conversation.app_id == app_model.id,
|
||||
Conversation.from_source == ("api" if isinstance(user, EndUser) else "console"),
|
||||
Conversation.from_end_user_id == (user.id if isinstance(user, EndUser) else None),
|
||||
@@ -168,7 +167,6 @@ class ConversationService:
|
||||
Conversation.from_source == ("api" if isinstance(user, EndUser) else "console"),
|
||||
Conversation.from_end_user_id == (user.id if isinstance(user, EndUser) else None),
|
||||
Conversation.from_account_id == (user.id if isinstance(user, Account) else None),
|
||||
Conversation.is_deleted == False,
|
||||
)
|
||||
.first()
|
||||
)
|
||||
|
||||
@@ -149,7 +149,6 @@ class TestWebConversationService:
|
||||
from_end_user_id=user.id if isinstance(user, EndUser) else None,
|
||||
from_account_id=user.id if isinstance(user, Account) else None,
|
||||
dialogue_count=0,
|
||||
is_deleted=False,
|
||||
)
|
||||
|
||||
from extensions.ext_database import db
|
||||
|
||||
@@ -184,7 +184,6 @@ class ConversationServiceTestDataFactory:
|
||||
conversation.from_source = from_source
|
||||
conversation.from_end_user_id = kwargs.get("from_end_user_id")
|
||||
conversation.from_account_id = kwargs.get("from_account_id")
|
||||
conversation.is_deleted = kwargs.get("is_deleted", False)
|
||||
conversation.name = kwargs.get("name", "Test Conversation")
|
||||
conversation.status = kwargs.get("status", "normal")
|
||||
conversation.created_at = kwargs.get("created_at", datetime.now(UTC))
|
||||
|
||||
Reference in New Issue
Block a user