mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-05 02:57:57 -05:00
refac: skip background work for accounts that were deactivated meanwhile (#33801)
Follow-up generation after a response and replies to channel mentions are now skipped when the account that triggered them has been deactivated in the meantime.
This commit is contained in:
1 parent
88cf7f209c
commit
dd42f4e913
2 files changed
+9
-2
No files matched your search
@@ -59,7 +59,7 @@ from open_webui.utils.apps import (
|
||||
has_app_access,
|
||||
send_app_mention,
|
||||
)
|
||||
from open_webui.utils.auth import get_admin_user, get_verified_user
|
||||
from open_webui.utils.auth import get_admin_user, get_verified_user, get_verified_user_by_id
|
||||
from open_webui.utils.channels import extract_mentions, replace_mentions
|
||||
from open_webui.utils.files import get_image_base64_from_file_id
|
||||
from open_webui.utils.models import (
|
||||
@@ -1152,7 +1152,7 @@ async def send_notification(request, channel, message, active_user_ids, db=None)
|
||||
|
||||
async def app_channel_reply_handler(channel_id, message_id, user_id):
|
||||
"""Committed human messages only; errors never cause the human POST to retry."""
|
||||
if not await Config.get('apps.enable'):
|
||||
if not await Config.get('apps.enable') or not await get_verified_user_by_id(user_id):
|
||||
return
|
||||
async with get_async_db() as db:
|
||||
message = await db.get(Message, message_id)
|
||||
@@ -1228,6 +1228,9 @@ async def app_channel_reply_handler(channel_id, message_id, user_id):
|
||||
|
||||
|
||||
async def model_response_handler(request, channel, message, user, db=None):
|
||||
if not await get_verified_user_by_id(user.id):
|
||||
return
|
||||
|
||||
MODELS = {model['id']: model for model in await get_filtered_models(await get_all_models(request, user=user), user)}
|
||||
|
||||
mentions = extract_mentions(message.content)
|
||||
|
||||
@@ -86,6 +86,7 @@ from open_webui.utils.access_control.files import get_owner_accessible_folder_fi
|
||||
from open_webui.utils.access_control.folders import has_folder_access
|
||||
from open_webui.utils.ask_user import stage_ask_user_tool_calls
|
||||
from open_webui.utils.audit import log_model_usage
|
||||
from open_webui.utils.auth import get_verified_user_by_id
|
||||
from open_webui.utils.chat import generate_chat_completion
|
||||
from open_webui.utils.chat_id import is_saved_chat_id, is_temporary_chat_id
|
||||
from open_webui.utils.code_interpreter import execute_code_jupyter
|
||||
@@ -3549,6 +3550,9 @@ async def background_tasks_handler(ctx):
|
||||
tasks = ctx['tasks']
|
||||
event_emitter = ctx['event_emitter']
|
||||
|
||||
if not await get_verified_user_by_id(user.id):
|
||||
return
|
||||
|
||||
message = None
|
||||
messages = []
|
||||
|
||||
|
||||
Reference in new issue
Block a user