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

Closed
opened 2026-05-05 23:47:08 -05:00 by GiteaMirror · 2 comments
Owner

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

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

API calls (and temp chats) through openwebui are not invoking pipeline/filter outlet()

This check if not chat_id or chat_id.startswith('local:') or not message_id: in outlet_filter_handler automatically filters out API callers and temp chats. API callers do not have a chat_id nor message_id

The code below relies on a persistent chat that is not available for API callers and temp chats.

        messages_map = await Chats.get_messages_map_by_chat_id(chat_id)
        if not messages_map:
            return

        message_list = get_message_list(messages_map, message_id)
        if not message_list:
            return

Additionally, to even get to this point, a chat_id and message_id need to be manufactured and assigned to extra_params before calling inlet() in process_chat_payload

    # Generate message_id if not provided (for correlation between inlet and outlet)
    if not metadata.get('message_id'):
        metadata['message_id'] = str(uuid4())

    # Generate local chat_id if not provided (for outlet filter correlation)
    # Using 'local:' prefix ensures it's treated as temporary and not persisted
    if not metadata.get('chat_id'):
        metadata['chat_id'] = f'local:{str(uuid4())}'

    extra_params = {

(edit: it seems manufacturing a message_id and/or chat_id like this causes streaming API calls to fail and return null)

Desired Solution you'd like

For the case of API callers and temp chats, the outlet should always be called with the most recent message, not the entire chat log (there isn't one).

This means that the last message (for API callers and temp chats) should always be saved and passed along in ctx so that they can be passed to outlet() -- stream-based calls will need to have their contents captured during streaming in order for this to work. Similarly, non-streaming calls will need to have their contents captured and passed along as well.

Alternatives Considered

No known alternatives at the moment. Besides using something like litellm as another proxy layer.

Additional Context

Currently running on dev with commithash 5dae600ce7

Originally created by @pfn on GitHub (Apr 15, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/23740 ### 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 API calls (and temp chats) through openwebui are not invoking pipeline/filter `outlet()` This check `if not chat_id or chat_id.startswith('local:') or not message_id:` in `outlet_filter_handler` automatically filters out API callers and temp chats. API callers do not have a chat_id nor message_id The code below relies on a persistent chat that is not available for API callers and temp chats. ```python messages_map = await Chats.get_messages_map_by_chat_id(chat_id) if not messages_map: return message_list = get_message_list(messages_map, message_id) if not message_list: return ``` Additionally, to even get to this point, a chat_id and message_id need to be manufactured and assigned to `extra_params` before calling `inlet()` in `process_chat_payload` ```python # Generate message_id if not provided (for correlation between inlet and outlet) if not metadata.get('message_id'): metadata['message_id'] = str(uuid4()) # Generate local chat_id if not provided (for outlet filter correlation) # Using 'local:' prefix ensures it's treated as temporary and not persisted if not metadata.get('chat_id'): metadata['chat_id'] = f'local:{str(uuid4())}' extra_params = { ``` (edit: it seems manufacturing a message_id and/or chat_id like this causes streaming API calls to fail and return null) ### Desired Solution you'd like For the case of API callers and temp chats, the outlet should always be called with the most recent message, not the entire chat log (there isn't one). This means that the last message (for API callers and temp chats) should always be saved and passed along in ctx so that they can be passed to `outlet()` -- stream-based calls will need to have their contents captured during streaming in order for this to work. Similarly, non-streaming calls will need to have their contents captured and passed along as well. ### Alternatives Considered No known alternatives at the moment. Besides using something like litellm as another proxy layer. ### Additional Context Currently running on dev with commithash 5dae600ce7994e5eadd257e28f127d47d823f596
Author
Owner

@Classic298 commented on GitHub (Apr 15, 2026):

Thanks for raising this

As discussed on discord, a high priority filter that runs as first filter that creates a synthetic chat_id if none exists for a request is the solution here - then the outlet() WILL RUN.

I have updated the docs to accomondate for that and provide a minimalistic example of how to do it

0.9.0 will be the first version that allows outlet() 's to run regardless of where the request comes from - as long as a chat_id is present - which isn't the case for direct API requests but that CAN easily be made the case with a very very small high priority filter that synthesizes a chat id :)

<!-- gh-comment-id:4255406010 --> @Classic298 commented on GitHub (Apr 15, 2026): Thanks for raising this As discussed on discord, a high priority filter that runs as first filter that creates a synthetic chat_id if none exists for a request is the solution here - then the outlet() WILL RUN. I have updated the docs to accomondate for that and provide a minimalistic example of how to do it 0.9.0 will be the first version that allows outlet() 's to run regardless of where the request comes from - as long as a chat_id is present - which isn't the case for direct API requests but that CAN easily be made the case with a very very small high priority filter that synthesizes a chat id :)
Author
Owner

@pfn commented on GitHub (Apr 16, 2026):

@Classic298 I've been testing this evening and the support is not yet complete, please see my linked diff and filter function that are needed to support what you describe https://gist.github.com/pfn/cdf3631365e6bee59912016b7a953175

<!-- gh-comment-id:4257221278 --> @pfn commented on GitHub (Apr 16, 2026): @Classic298 I've been testing this evening and the support is not yet complete, please see my linked diff and filter function that are needed to support what you describe https://gist.github.com/pfn/cdf3631365e6bee59912016b7a953175
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#58723