This commit is contained in:
Timothy Jaeryang Baek committed 2026-08-25 15:26:45 -04:00
1 parent e3a7a64d82
commit 28f2965934
1 file changed
+14 -7
+14 -7
View File
@@ -3836,7 +3836,8 @@ async def outlet_filter_handler(ctx):
Replaces the separate POST /api/chat/completed round-trip. Replaces the separate POST /api/chat/completed round-trip.
Persists outlet-modified content to DB and emits a chat:outlet event Persists outlet-modified content to DB and emits a chat:outlet event
so the frontend can sync its in-memory state. so the frontend can sync its in-memory state. Returns immediately when
the model has no filters.
For temp/API chats, messages are built from form_data plus ctx['assistant_message']. For temp/API chats, messages are built from form_data plus ctx['assistant_message'].
""" """
@@ -3858,6 +3859,17 @@ async def outlet_filter_handler(ctx):
is_unsaved_chat = not is_saved_chat_id(chat_id) is_unsaved_chat = not is_saved_chat_id(chat_id)
try: try:
filter_functions = (
await get_filter_functions(request, model, metadata.get('filter_ids', [])) if ENABLE_PLUGINS else []
)
model_id = model.get('id') if isinstance(model, dict) else model
models = request.app.state.MODELS
has_pipeline_outlet_filters = bool(
(isinstance(model, dict) and 'pipeline' in model) or get_sorted_filters(model_id, models)
)
if not filter_functions and not has_pipeline_outlet_filters:
return
messages_map = None messages_map = None
if is_unsaved_chat: if is_unsaved_chat:
@@ -3892,8 +3904,6 @@ async def outlet_filter_handler(ctx):
if not message_list: if not message_list:
return return
model_id = model.get('id') if isinstance(model, dict) else model
outlet_data = { outlet_data = {
'model': model_id, 'model': model_id,
'messages': [ 'messages': [
@@ -3917,7 +3927,6 @@ async def outlet_filter_handler(ctx):
} }
# Pipeline outlet filters # Pipeline outlet filters
models = request.app.state.MODELS
try: try:
outlet_data = await process_pipeline_outlet_filter(request, outlet_data, user, models) outlet_data = await process_pipeline_outlet_filter(request, outlet_data, user, models)
except Exception as e: except Exception as e:
@@ -3933,9 +3942,7 @@ async def outlet_filter_handler(ctx):
'__model__': model, '__model__': model,
} }
if ENABLE_PLUGINS: if filter_functions:
filter_functions = await get_filter_functions(request, model, metadata.get('filter_ids', []))
outlet_result, _ = await process_filter_functions( outlet_result, _ = await process_filter_functions(
request=request, request=request,
filter_context=None, filter_context=None,