Bug: Prompts created over the API cannot be updated or deleted/incongruency API/GUI prompt handling #1631

Closed
opened 2025-11-11 14:48:50 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @JIW-roosi on GitHub (Jul 29, 2024).

Bug Report

Description

Bug Summary:
Prompts created over the API cannot be updated or deleted, neither through the API nor through the GUI.
Prompts generated over the GUI can be deleted and modified.
Also, prompts created by API calls appear to differ from their representation in the GUI.
Prompt creation appears to be handled differently depending on whether the API or GUI has been used.

Steps to Reproduce:
Create a prompt over the API and attempt to delete or update it.

Expected Behavior:
Promt being deleted or updated.

Actual Behavior:

Attempts to update or change over the GUI result in a permission error, although admin rights are given.
Attempts to update over an API call generate a 401 Client Error: Unauthorized for url:http://host.docker.internal:3000/api/v1/prompts/command/test/update

Attempts to delete such prompts over the GUI have no effect and cause no errors. Upon refreshing the page, however, several exceptions and errors appear in the docker container's logs.
Attempts to delete over the API have no apparent effect.

The API-generated prompt with the command "test" appears as "test" in the API call but as "est" in the GUI.
There is no "/"-prefix appearing in front of the command in the GUI.

GUI-created prompts have the "/" prefix added automatically, however API calls to update them with the "/" result in a 404 not found error. They may be modified without the use of "/".

Environment

  • Open WebUI Version: [v0.3.10]

  • Ollama (if applicable): [0.1.48]

  • Operating System: [Windows 11]

  • Browser (if applicable): [Firefox 128.0.2]

Reproduction Details

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 am on the latest version of Open WebUI
  • I have included the browser console logs.
  • I have included the Docker container logs.

Logs and Screenshots

Docker Container Logs:
2024-07-29 13:25:15 INFO: 127.0.0.1:34446 - "GET /health HTTP/1.1" 200 OK
2024-07-29 13:25:30 INFO: 172.17.0.1:60636 - "POST /api/v1/prompts/command/est/update HTTP/1.1" 401 Unauthorized
2024-07-29 13:25:30 ERROR: Exception in ASGI application
2024-07-29 13:25:30 + Exception Group Traceback (most recent call last):
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 87, in collapse_excgroups
2024-07-29 13:25:30 | yield
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 190, in call
2024-07-29 13:25:30 | async with anyio.create_task_group() as task_group:
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 680, in aexit
2024-07-29 13:25:30 | raise BaseExceptionGroup(
2024-07-29 13:25:30 | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
2024-07-29 13:25:30 +-+---------------- 1 ----------------
2024-07-29 13:25:30 | Traceback (most recent call last):
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
2024-07-29 13:25:30 | result = await app( # type: ignore[func-returns-value]
2024-07-29 13:25:30 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in call
2024-07-29 13:25:30 | return await self.app(scope, receive, send)
2024-07-29 13:25:30 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
2024-07-29 13:25:30 | await super().call(scope, receive, send)
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in call
2024-07-29 13:25:30 | await self.middleware_stack(scope, receive, send)
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in call
2024-07-29 13:25:30 | raise exc
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
2024-07-29 13:25:30 | await self.app(scope, receive, _send)
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-29 13:25:30 | with collapse_excgroups():
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-29 13:25:30 | self.gen.throw(typ, value, traceback)
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-29 13:25:30 | raise exc
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-29 13:25:30 | response = await self.dispatch_func(request, call_next)
2024-07-29 13:25:30 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-29 13:25:30 | File "/app/backend/main.py", line 915, in update_embedding_function
2024-07-29 13:25:30 | response = await call_next(request)
2024-07-29 13:25:30 | ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 166, in call_next
2024-07-29 13:25:30 | raise RuntimeError("No response returned.")
2024-07-29 13:25:30 | RuntimeError: No response returned.
2024-07-29 13:25:30 +------------------------------------
2024-07-29 13:25:30
2024-07-29 13:25:30 During handling of the above exception, another exception occurred:
2024-07-29 13:25:30
2024-07-29 13:25:30 Traceback (most recent call last):
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
2024-07-29 13:25:30 result = await app( # type: ignore[func-returns-value]
2024-07-29 13:25:30 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in call
2024-07-29 13:25:30 return await self.app(scope, receive, send)
2024-07-29 13:25:30 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
2024-07-29 13:25:30 await super().call(scope, receive, send)
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in call
2024-07-29 13:25:30 await self.middleware_stack(scope, receive, send)
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in call
2024-07-29 13:25:30 raise exc
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
2024-07-29 13:25:30 await self.app(scope, receive, _send)
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-29 13:25:30 with collapse_excgroups():
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-29 13:25:30 self.gen.throw(typ, value, traceback)
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-29 13:25:30 raise exc
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-29 13:25:30 response = await self.dispatch_func(request, call_next)
2024-07-29 13:25:30 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-29 13:25:30 File "/app/backend/main.py", line 915, in update_embedding_function
2024-07-29 13:25:30 response = await call_next(request)
2024-07-29 13:25:30 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 166, in call_next
2024-07-29 13:25:30 raise RuntimeError("No response returned.")
2024-07-29 13:25:30 RuntimeError: No response returned.

Screenshots (if applicable):

openwebui-prompts-api openwebui prompts gui openwebui prompts ui

Installation Method

Docker method outlined in the "getting started" section.

Additional Information

Python error messages:
Adding prompt test_prompt...
prompt ./data/custom_prompts/test_prompt.json added successfully.
Traceback (most recent call last):
File "/workspaces/redactedworspace/owui_prompt_manager.py", line 102, in validate_prompt
response.raise_for_status()
File "/home/vscode/.local/lib/python3.11/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://host.docker.internal:3000/api/v1/prompts/command/test/update

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/workspaces/redactedworspace/owui_prompt_manager.py", line 144, in
main()
File "/workspaces/redactedworspace/owui_prompt_manager.py", line 140, in main
openwebui.validate_prompt(prompt_file_path)
File "/workspaces/redactedworspace/owui_prompt_manager.py", line 105, in validate_prompt
raise Exception(f"HTTP error occurred: {err}")
Exception: HTTP error occurred: 401 Client Error: Unauthorized for url: http://host.docker.internal:3000/api/v1/prompts/command/test/update

Note

If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!

Originally created by @JIW-roosi on GitHub (Jul 29, 2024). # Bug Report ## Description **Bug Summary:** Prompts created over the API cannot be updated or deleted, neither through the API nor through the GUI. Prompts generated over the GUI can be deleted and modified. Also, prompts created by API calls appear to differ from their representation in the GUI. Prompt creation appears to be handled differently depending on whether the API or GUI has been used. **Steps to Reproduce:** Create a prompt over the API and attempt to delete or update it. **Expected Behavior:** Promt being deleted or updated. **Actual Behavior:** Attempts to update or change over the GUI result in a permission error, although admin rights are given. Attempts to update over an API call generate a 401 Client Error: Unauthorized for url:http://host.docker.internal:3000/api/v1/prompts/command/test/update Attempts to delete such prompts over the GUI have no effect and cause no errors. Upon refreshing the page, however, several exceptions and errors appear in the docker container's logs. Attempts to delete over the API have no apparent effect. The API-generated prompt with the command "test" appears as "test" in the API call but as "est" in the GUI. There is no "/"-prefix appearing in front of the command in the GUI. GUI-created prompts have the "/" prefix added automatically, however API calls to update them with the "/" result in a 404 not found error. They may be modified without the use of "/". ## Environment - **Open WebUI Version:** [v0.3.10] - **Ollama (if applicable):** [0.1.48] - **Operating System:** [Windows 11] - **Browser (if applicable):** [Firefox 128.0.2] ## Reproduction Details **Confirmation:** - [x] 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. - [x] I am on the latest version of Open WebUI - [ ] I have included the browser console logs. - [x] I have included the Docker container logs. ## Logs and Screenshots **Docker Container Logs:** 2024-07-29 13:25:15 INFO: 127.0.0.1:34446 - "GET /health HTTP/1.1" 200 OK 2024-07-29 13:25:30 INFO: 172.17.0.1:60636 - "POST /api/v1/prompts/command/est/update HTTP/1.1" 401 Unauthorized 2024-07-29 13:25:30 ERROR: Exception in ASGI application 2024-07-29 13:25:30 + Exception Group Traceback (most recent call last): 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 87, in collapse_excgroups 2024-07-29 13:25:30 | yield 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 190, in __call__ 2024-07-29 13:25:30 | async with anyio.create_task_group() as task_group: 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 680, in __aexit__ 2024-07-29 13:25:30 | raise BaseExceptionGroup( 2024-07-29 13:25:30 | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) 2024-07-29 13:25:30 +-+---------------- 1 ---------------- 2024-07-29 13:25:30 | Traceback (most recent call last): 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi 2024-07-29 13:25:30 | result = await app( # type: ignore[func-returns-value] 2024-07-29 13:25:30 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ 2024-07-29 13:25:30 | return await self.app(scope, receive, send) 2024-07-29 13:25:30 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ 2024-07-29 13:25:30 | await super().__call__(scope, receive, send) 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ 2024-07-29 13:25:30 | await self.middleware_stack(scope, receive, send) 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ 2024-07-29 13:25:30 | raise exc 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ 2024-07-29 13:25:30 | await self.app(scope, receive, _send) 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-29 13:25:30 | with collapse_excgroups(): 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-29 13:25:30 | self.gen.throw(typ, value, traceback) 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-29 13:25:30 | raise exc 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-29 13:25:30 | response = await self.dispatch_func(request, call_next) 2024-07-29 13:25:30 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-29 13:25:30 | File "/app/backend/main.py", line 915, in update_embedding_function 2024-07-29 13:25:30 | response = await call_next(request) 2024-07-29 13:25:30 | ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-29 13:25:30 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 166, in call_next 2024-07-29 13:25:30 | raise RuntimeError("No response returned.") 2024-07-29 13:25:30 | RuntimeError: No response returned. 2024-07-29 13:25:30 +------------------------------------ 2024-07-29 13:25:30 2024-07-29 13:25:30 During handling of the above exception, another exception occurred: 2024-07-29 13:25:30 2024-07-29 13:25:30 Traceback (most recent call last): 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi 2024-07-29 13:25:30 result = await app( # type: ignore[func-returns-value] 2024-07-29 13:25:30 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ 2024-07-29 13:25:30 return await self.app(scope, receive, send) 2024-07-29 13:25:30 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ 2024-07-29 13:25:30 await super().__call__(scope, receive, send) 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ 2024-07-29 13:25:30 await self.middleware_stack(scope, receive, send) 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ 2024-07-29 13:25:30 raise exc 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ 2024-07-29 13:25:30 await self.app(scope, receive, _send) 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-29 13:25:30 with collapse_excgroups(): 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-29 13:25:30 self.gen.throw(typ, value, traceback) 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-29 13:25:30 raise exc 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-29 13:25:30 response = await self.dispatch_func(request, call_next) 2024-07-29 13:25:30 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-29 13:25:30 File "/app/backend/main.py", line 915, in update_embedding_function 2024-07-29 13:25:30 response = await call_next(request) 2024-07-29 13:25:30 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-29 13:25:30 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 166, in call_next 2024-07-29 13:25:30 raise RuntimeError("No response returned.") 2024-07-29 13:25:30 RuntimeError: No response returned. **Screenshots (if applicable):** <img width="497" alt="openwebui-prompts-api" src="https://github.com/user-attachments/assets/ab7091b3-ce42-4f70-bbb8-6d7b3720517b"> <img width="995" alt="openwebui prompts gui" src="https://github.com/user-attachments/assets/d9dfe68a-45fc-4cbe-af2f-7fe2f854c402"> <img width="867" alt="openwebui prompts ui" src="https://github.com/user-attachments/assets/00716e98-4cbd-4757-848e-e5888961feb7"> ## Installation Method Docker method outlined in the "getting started" section. ## Additional Information Python error messages: Adding prompt test_prompt... prompt ./data/custom_prompts/test_prompt.json added successfully. Traceback (most recent call last): File "/workspaces/redactedworspace/owui_prompt_manager.py", line 102, in validate_prompt response.raise_for_status() File "/home/vscode/.local/lib/python3.11/site-packages/requests/models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://host.docker.internal:3000/api/v1/prompts/command/test/update During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/workspaces/redactedworspace/owui_prompt_manager.py", line 144, in <module> main() File "/workspaces/redactedworspace/owui_prompt_manager.py", line 140, in main openwebui.validate_prompt(prompt_file_path) File "/workspaces/redactedworspace/owui_prompt_manager.py", line 105, in validate_prompt raise Exception(f"HTTP error occurred: {err}") Exception: HTTP error occurred: 401 Client Error: Unauthorized for url: http://host.docker.internal:3000/api/v1/prompts/command/test/update ## Note If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#1631