[GH-ISSUE #23770] feat: recent dev changes for outlet_filter_handler do not completely handle the API caller use-case #58731

Open
opened 2026-05-05 23:48:11 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @pfn on GitHub (Apr 16, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23770

Check Existing Issues

  • I have searched for all existing open AND closed issues and discussions for similar requests. I have found none that is comparable to my request.

Verify Feature Scope

  • I have read through and understood the scope definition for feature requests in the Issues section. I believe my feature request meets the definition and belongs in the Issues section instead of the Discussions.

Problem Description

Continuing the discussion from #23740 which is closed prematurely.

I have to apply the following diff to middleware.py in addition to running a fairly carefully crafted filter function in order for API calls to track outlet() correctly https://gist.github.com/pfn/cdf3631365e6bee59912016b7a953175

With this filter and the diff in place, both non-streaming and streaming API calls through openwebui work for me. Without the filter active and the diff, neither API call use-case works. The diff is primarily required for the streaming use-case. The filter is required for both streaming and non-streaming API calls.

Desired Solution you'd like

I'm relatively happy with how the linked gist solves the problem. If it could be made more elegant, I would like that.

Alternatives Considered

N/A

Additional Context

Discussed in discord.

pfn0 [SJBH], — 7:18 PM
not sure what it is yet (looking at the code, event_emitter shouldn't be the problem)
ctx = await build_chat_response_context(request, form_data, user, model, metadata, tasks, events)
main.py:1851 @Classic this brings event_emitter to life
pfn0 [SJBH], — 7:50 PM
@Classic final finding: streaming_chat_response_handler -> w/o event_emitter -> does not ever call outlet_filter_handler (and if outlet_filter_handler is force-called, assistant_message is not available)

Originally created by @pfn on GitHub (Apr 16, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/23770 ### Check Existing Issues - [x] I have searched for all existing **open AND closed** issues and discussions for similar requests. I have found none that is comparable to my request. ### Verify Feature Scope - [x] I have read through and understood the scope definition for feature requests in the Issues section. I believe my feature request meets the definition and belongs in the Issues section instead of the Discussions. ### Problem Description Continuing the discussion from #23740 which is closed prematurely. I have to apply the following diff to middleware.py in addition to running a fairly carefully crafted filter function in order for API calls to track outlet() correctly https://gist.github.com/pfn/cdf3631365e6bee59912016b7a953175 With this filter and the diff in place, both non-streaming and streaming API calls through openwebui work for me. Without the filter active and the diff, neither API call use-case works. The diff is primarily required for the streaming use-case. The filter is required for both streaming and non-streaming API calls. ### Desired Solution you'd like I'm relatively happy with how the linked gist solves the problem. If it could be made more elegant, I would like that. ### Alternatives Considered N/A ### Additional Context Discussed in discord. > pfn0 [SJBH], — 7:18 PM > not sure what it is yet (looking at the code, event_emitter shouldn't be the problem) > ctx = await build_chat_response_context(request, form_data, user, model, metadata, tasks, events) > main.py:1851 @Classic this brings event_emitter to life > pfn0 [SJBH], — 7:50 PM > @Classic final finding: streaming_chat_response_handler -> w/o event_emitter -> does not ever call outlet_filter_handler (and if outlet_filter_handler is force-called, assistant_message is not available)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#58731