fix(chat): 修改智能体列表

This commit is contained in:
sophie committed 2026-06-29 15:26:11 +08:00
1 parent cafce5cfa9
commit 7e4a2037d8
8 files changed
+71 -17

No files matched your search

+7
View File
@@ -1320,6 +1320,8 @@ def _apply_chat_logs_report_filters(query):
query = query.filter(Agent.name.cast(db.String).ilike(f'%{value}%'))
elif key == 'username':
query = query.filter(User.username.cast(db.String).ilike(f'%{value}%'))
elif key == 'real_name':
query = query.filter(User.real_name.cast(db.String).ilike(f'%{value}%'))
elif hasattr(ChatLog, key):
col = getattr(ChatLog, key)
query = query.filter(col.cast(db.String).ilike(f'%{value}%'))
@@ -1391,6 +1393,11 @@ def get_table_count(table):
"""
Return total row count for admin report tables.
"""
if table == 'chat_logs':
query = _apply_chat_logs_report_filters(_chat_logs_report_query())
total = query.count()
return jsonify({'table': table, 'total': int(total or 0)})
model_map = {'users': User, 'agents': Agent, 'chat_logs': ChatLog, 'feedbacks': Feedback, 'permission_requests': PermissionRequest, 'departments': Department, 'quick_questions': QuickQuestion, 'user_homepage_configs': UserHomepageConfig, 'user_favorite_agents': UserFavoriteAgent, 'user_default_agents': UserDefaultAgent}
model = model_map.get(table)
if not model: