issue: filter_functions can just return form_data, but the source code shows filter_function can reutrn form_data ang flags #5584

Closed
opened 2025-11-11 16:25:14 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @zhanghaochen-817 on GitHub (Jun 18, 2025).

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.3.11

Ollama Version (if applicable)

v0.1.32

Operating System

windows 10

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

filter_functions not oly can return form_data, but also can return flags

Actual Behavior

filter_functions can just return form_data, but the source code shows filter_function can reutrn form_data ang flags.
I will show the source code:
step1:
in backend/openwebui/utils/middleware.py-->def process_chat_payload():
` try:
filter_functions = [
Functions.get_function_by_id(filter_id)
for filter_id in get_sorted_filter_ids(model)
]

    form_data, flags = await process_filter_functions(  #openweui自定义的filter
        request=request,
        filter_functions=filter_functions,
        filter_type="inlet",
        form_data=form_data,
        extra_params=extra_params,
    )

except Exception as e:
    raise Exception(f"Error: {e}")`

we can see filter_function can return 'form_data' and 'flags', so i step into process_filter_functions function.
Step2:
in backend/openwebui/utils/filter.py-->def process_filter_functions():
`

Execute handler

        if inspect.iscoroutinefunction(handler):
            form_data = await handler(**params)
        else:
            form_data = handler(**params)
 .....

return form_data, {}
`
we can see function process_filter_functions just return {}, so the flags only can be {}.

Steps to Reproduce

1.start with windows10 instsall
2.install with source code
3.start_window.bat

Logs & Screenshots

no error, just some questions

Additional Information

No response

Originally created by @zhanghaochen-817 on GitHub (Jun 18, 2025). ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.3.11 ### Ollama Version (if applicable) v0.1.32 ### Operating System windows 10 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior filter_functions not oly can return form_data, but also can return flags ### Actual Behavior filter_functions can just return form_data, but the source code shows filter_function can reutrn form_data ang flags. I will show the source code: **step1:** in backend/openwebui/utils/middleware.py-->def process_chat_payload(): ` try: filter_functions = [ Functions.get_function_by_id(filter_id) for filter_id in get_sorted_filter_ids(model) ] form_data, flags = await process_filter_functions( #openweui自定义的filter request=request, filter_functions=filter_functions, filter_type="inlet", form_data=form_data, extra_params=extra_params, ) except Exception as e: raise Exception(f"Error: {e}")` we can see filter_function can return 'form_data' and 'flags', so i step into process_filter_functions function. **Step2:** in backend/openwebui/utils/filter.py-->def process_filter_functions(): ` # Execute handler if inspect.iscoroutinefunction(handler): form_data = await handler(**params) else: form_data = handler(**params) ..... return form_data, {} ` we can see function process_filter_functions just return {}, so the flags only can be {}. ### Steps to Reproduce 1.start with windows10 instsall 2.install with source code 3.start_window.bat ### Logs & Screenshots no error, just some questions ### Additional Information _No response_
GiteaMirror added the bug label 2025-11-11 16:25:14 -06:00
Author
Owner

@zhanghaochen-817 commented on GitHub (Jun 18, 2025):

Dear developer, i wish you can read this issue and replay me. thanks.

@zhanghaochen-817 commented on GitHub (Jun 18, 2025): Dear developer, i wish you can read this issue and replay me. thanks.
Author
Owner

@tjbck commented on GitHub (Jun 18, 2025):

NOT an issue.

@tjbck commented on GitHub (Jun 18, 2025): NOT an issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#5584