mirror of
https://github.com/langgenius/dify.git
synced 2026-01-08 07:14:14 +00:00
Compare commits
13 Commits
chore/refa
...
feat/remov
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4919e138e2 | ||
|
|
eadf137b75 | ||
|
|
4ad79538e2 | ||
|
|
5efe443d85 | ||
|
|
53c6c27a98 | ||
|
|
26c2ad3d2b | ||
|
|
b31b0446dd | ||
|
|
ab142a302e | ||
|
|
62f2288460 | ||
|
|
4e8e53c579 | ||
|
|
d3490ebb0f | ||
|
|
b8885fa029 | ||
|
|
8e666b4704 |
@@ -338,9 +338,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:
|
||||
query = query.join(Message, Message.conversation_id == Conversation.id).where(
|
||||
@@ -452,7 +450,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:
|
||||
keyword_filter = f"%{args.keyword}%"
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
"""remove unused is_deleted from conversations
|
||||
|
||||
Revision ID: e5d7a95e676f
|
||||
Revises: d57accd375ae
|
||||
Create Date: 2025-11-27 18:27:09.006691
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "e5d7a95e676f"
|
||||
down_revision = "d57accd375ae"
|
||||
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)
|
||||
)
|
||||
@@ -676,8 +676,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()
|
||||
|
||||
@@ -47,7 +47,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),
|
||||
@@ -166,7 +165,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
|
||||
|
||||
Reference in New Issue
Block a user