Skip to content

Commit f918b3a

Browse files
[autofix.ci] apply automated fixes
1 parent 82e7786 commit f918b3a

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

api/controllers/console/app/conversation.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ def delete(self, app_model):
172172
except Exception:
173173
pass
174174
try:
175-
db.session.query(MessageAgentThought).where(MessageAgentThought.message_id.in_(all_message_ids)).delete(synchronize_session=False)
175+
db.session.query(MessageAgentThought).where(
176+
MessageAgentThought.message_id.in_(all_message_ids)
177+
).delete(synchronize_session=False)
176178
except Exception:
177179
pass
178180

@@ -181,27 +183,31 @@ def delete(self, app_model):
181183
db.session.query(Message).where(Message.conversation_id == conversation.id).delete()
182184
db.session.query(MessageAnnotation).where(MessageAnnotation.conversation_id == conversation.id).delete()
183185
try:
184-
db.session.query(ConversationVariable).where(ConversationVariable.conversation_id == conversation.id).delete()
186+
db.session.query(ConversationVariable).where(
187+
ConversationVariable.conversation_id == conversation.id
188+
).delete()
185189
except Exception:
186190
pass # Table might not exist in this version
187191
try:
188-
db.session.query(ToolConversationVariables).where(ToolConversationVariables.conversation_id == conversation.id).delete()
192+
db.session.query(ToolConversationVariables).where(
193+
ToolConversationVariables.conversation_id == conversation.id
194+
).delete()
189195
except Exception:
190196
pass # Table might not exist in this version
191197
try:
192198
db.session.query(ToolFile).where(ToolFile.conversation_id == conversation.id).delete()
193199
except Exception:
194200
pass # Table might not exist in this version
195201
try:
196-
db.session.query(PinnedConversation).where(PinnedConversation.conversation_id == conversation.id).delete()
202+
db.session.query(PinnedConversation).where(
203+
PinnedConversation.conversation_id == conversation.id
204+
).delete()
197205
except Exception:
198206
pass # Table might not exist in this version
199207

200208
# Delete upload file records
201209
if upload_file_ids:
202-
db.session.query(UploadFile).where(UploadFile.id.in_(upload_file_ids)).delete(
203-
synchronize_session=False
204-
)
210+
db.session.query(UploadFile).where(UploadFile.id.in_(upload_file_ids)).delete(synchronize_session=False)
205211

206212
# Delete conversations
207213
if args["conversation_ids"]:
@@ -465,7 +471,9 @@ def delete(self, app_model):
465471
except Exception:
466472
pass
467473
try:
468-
db.session.query(MessageAgentThought).where(MessageAgentThought.message_id.in_(all_message_ids)).delete(synchronize_session=False)
474+
db.session.query(MessageAgentThought).where(
475+
MessageAgentThought.message_id.in_(all_message_ids)
476+
).delete(synchronize_session=False)
469477
except Exception:
470478
pass
471479

@@ -474,27 +482,31 @@ def delete(self, app_model):
474482
db.session.query(Message).where(Message.conversation_id == conversation.id).delete()
475483
db.session.query(MessageAnnotation).where(MessageAnnotation.conversation_id == conversation.id).delete()
476484
try:
477-
db.session.query(ConversationVariable).where(ConversationVariable.conversation_id == conversation.id).delete()
485+
db.session.query(ConversationVariable).where(
486+
ConversationVariable.conversation_id == conversation.id
487+
).delete()
478488
except Exception:
479489
pass # Table might not exist in this version
480490
try:
481-
db.session.query(ToolConversationVariables).where(ToolConversationVariables.conversation_id == conversation.id).delete()
491+
db.session.query(ToolConversationVariables).where(
492+
ToolConversationVariables.conversation_id == conversation.id
493+
).delete()
482494
except Exception:
483495
pass # Table might not exist in this version
484496
try:
485497
db.session.query(ToolFile).where(ToolFile.conversation_id == conversation.id).delete()
486498
except Exception:
487499
pass # Table might not exist in this version
488500
try:
489-
db.session.query(PinnedConversation).where(PinnedConversation.conversation_id == conversation.id).delete()
501+
db.session.query(PinnedConversation).where(
502+
PinnedConversation.conversation_id == conversation.id
503+
).delete()
490504
except Exception:
491505
pass # Table might not exist in this version
492506

493507
# Delete upload file records
494508
if upload_file_ids:
495-
db.session.query(UploadFile).where(UploadFile.id.in_(upload_file_ids)).delete(
496-
synchronize_session=False
497-
)
509+
db.session.query(UploadFile).where(UploadFile.id.in_(upload_file_ids)).delete(synchronize_session=False)
498510

499511
# Delete conversations
500512
if args["conversation_ids"]:

api/tasks/clear_conversation_task.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def clear_conversations_task(
101101
# Get all message IDs for this batch
102102
message_ids = [
103103
row[0]
104-
for row in session.query(Message.id).where(Message.conversation_id.in_(conversation_batch_ids))
104+
for row in session.query(Message.id)
105+
.where(Message.conversation_id.in_(conversation_batch_ids))
105106
.all()
106107
]
107108

0 commit comments

Comments
 (0)