[GH-ISSUE #7216] User location not being sent in chat messages #30190

Closed
opened 2026-04-25 04:28:57 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @ProjectMoon on GitHub (Nov 22, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7216

Bug Report

Installation Method

Docker

Environment

  • Open WebUI Version: 0.4.3

  • Ollama (if applicable): 0.4.3

  • Operating System: Gentoo Linux

  • Browser (if applicable): Firefox

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on 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 the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

When allow user location is enabled, the user's location gets sent with each chat message, assuming the model is requesting access to location via its system prompt.

Actual Behavior:

The location is not sent. The model can use whatever location is cached when the setting was toggled, but otherwise, it is not sent.

Description

Bug Summary:
I have narrowed this down to how the web UI decides whether or not to send location. It seems to send it (and all the other templating variables) when there's a system prompt with the variables in it. Specifically Chat.svelte around line 1093:

params?.system || $settings.system || (responseMessage?.userContext ?? null)

When one of these conditions trigger, the web UI will template the prompt, and that also means getting user location.

I CAN get the Web UI to send user location with every message by changing the chat control's system prompt directly. If I put User's location is {{USER_LOCATION}} in the chat controls system prompt, behavior works as expected.

This leads me to believe that Chat.svelte doesn't have access to the model's system prompt as defined in OpenWebUI, for some reason.

Reproduction Details

Steps to Reproduce:

  1. Create a model with {{USER_LOCATION}} in the system prompt.
  2. Make sure location setting is on.
  3. Send a message.
  4. Expected behavior: browser's location-in-use icon shows up.
  5. Actual: location not sent with the request.

Be careful not to confuse the cached location with acquiring a new location (getAndUpdateUserLocation).

To clarify further:

  • This was all tested on Firefox. Chromium and Gnome Web didn't work for other, unrelated reasons.
  • Model has a system prompt in OpenWebUI with {{USER_LOCATION}}, and allow user location is on in user's settings: The current location (i.e. a call to navigator.geoLocation) is not sent with each chat message.
    • Any cached location, from when allow user location is first enabled, gets sent. Which is nice, but not the expected behavior.
    • The OpenWebUI system prompt does seem to be applied when the prompt actually gets to ollama. It's just seemingly not available/not set in the web client for the conditional above to work properly.
  • Chat controls' system prompt is set to something with {{USER_LOCATION}} and allow user location is on in user's settings: Current location is sent with every chat message (expected behavior).
Originally created by @ProjectMoon on GitHub (Nov 22, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/7216 # Bug Report ## Installation Method Docker ## Environment - **Open WebUI Version:** 0.4.3 - **Ollama (if applicable):** 0.4.3 - **Operating System:** Gentoo Linux - **Browser (if applicable):** Firefox **Confirmation:** - [x] I have read and followed all the instructions provided in the README.md. - [x] I am on 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 the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: When allow user location is enabled, the user's location gets sent with each chat message, assuming the model is requesting access to location via its system prompt. ## Actual Behavior: The location is not sent. The model can use whatever location is cached when the setting was toggled, but otherwise, it is not sent. ## Description **Bug Summary:** I have narrowed this down to how the web UI decides whether or not to send location. It seems to send it (and all the other templating variables) when there's a system prompt with the variables in it. Specifically Chat.svelte around line 1093: ```typescript params?.system || $settings.system || (responseMessage?.userContext ?? null) ``` When one of these conditions trigger, the web UI will template the prompt, and that also means getting user location. I CAN get the Web UI to send user location with every message by changing the chat control's system prompt directly. If I put `User's location is {{USER_LOCATION}}` in the chat controls system prompt, behavior works as expected. This leads me to believe that Chat.svelte doesn't have access to the model's system prompt as defined in OpenWebUI, for some reason. ## Reproduction Details **Steps to Reproduce:** 1. Create a model with `{{USER_LOCATION}}` in the system prompt. 2. Make sure location setting is on. 3. Send a message. 4. Expected behavior: browser's location-in-use icon shows up. 5. Actual: location not sent with the request. Be careful not to confuse the cached location with acquiring a new location (`getAndUpdateUserLocation`). To clarify further: - This was all tested on Firefox. Chromium and Gnome Web didn't work for other, unrelated reasons. - **Model has a system prompt in OpenWebUI with `{{USER_LOCATION}}`, and allow user location is on in user's settings**: The current location (i.e. a call to `navigator.geoLocation`) is not sent with each chat message. - Any cached location, from when allow user location is first enabled, gets sent. Which is nice, but not the expected behavior. - The OpenWebUI system prompt **does** seem to be applied when the prompt actually gets to ollama. It's just seemingly not available/not set in the web client for the conditional above to work properly. - **Chat controls' system prompt is set to something with `{{USER_LOCATION}}` and allow user location is on in user's settings**: Current location is sent with every chat message (expected behavior).
Author
Owner

@tjbck commented on GitHub (Dec 1, 2024):

Intended behaviour here, the user would have to explicitly grant permission for the system to have access to their location. With that being said, if there's a workaround for this, would consider accepting a PR!

<!-- gh-comment-id:2509606967 --> @tjbck commented on GitHub (Dec 1, 2024): Intended behaviour here, the user would have to explicitly grant permission for the system to have access to their location. With that being said, if there's a workaround for this, would consider accepting a PR!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#30190