Slash commands throw console error for {{CLIPBOARD}} on unsecured http (non-localhost) #2431

Closed
opened 2025-11-11 15:07:01 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @lewismoten on GitHub (Oct 22, 2024).

Bug Report

Installation Method

Installed via docker. Full notes here: https://lewismoten3.wordpress.com/2024/10/21/setting-up-llm-on-raspberry-pi/

Environment

  • Open WebUI Version: v0.3.32

  • Ollama (if applicable): 0.3.14

  • Operating System: Ubuntu 24.04.1 LTS

  • Browser (if applicable): Chrome 129.0.6668.101 (Official Build) (arm64)

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.
  • [n/a] 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:

  • List of prompts should disappear
  • Prompt textbox should be populated with the prompt content
  • No error should appear on the console

Actual Behavior:

  • List of prompts appear frozen
  • Prompt textbox is not populated
  • Error appears on console

Description

Bug Summary:

During a chat, type forward slash in the prompt. A list of prompts are displayed. Click Enter, or arrow keys, tab key, or click the command with your mouse. Nothing happens. When viewing the console, an error appears each time.

Reproduction Details

Steps to Reproduce:

  • create a prompt in the workspace/prompts
  • open a chat
  • in the prompt box, type forward slash character "/"
  • Click Enter - nothing happens
  • Click prompt with mouse - nothing happens
  • Use arrow keys - nothing happens
  • Click escape key - console.log says 'Escape", but list of prompts remain
  • Click backspace - forward slash erased, prompt list disappears
  • type forward slash character "/" again
  • same behavior
  • refresh the browser window
  • same behaviors
  • try typing out the name of the prompt and hitting enter

Logs and Screenshots

Browser Console Logs:

Prompts.svelte:45 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'readText')
    at d (Prompts.svelte:45:52)
    at Array._ (Prompts.svelte:153:9)
    at HTMLButtonElement.d (Prompts.svelte:165:22)
    at HTMLTextAreaElement.ge (MessageInput.svelte:589:34)
d @ Prompts.svelte:45
_ @ Prompts.svelte:153
d @ Prompts.svelte:165
ge @ MessageInput.svelte:589Understand this error

See the code base here:
https://github.com/open-webui/open-webui/blob/c2d1a3164e0a310f77a88ede2938c6adb58a334f/src/lib/components/chat/MessageInput/Commands/Prompts.svelte#L45

The issue appears to be with the clipboard. There needs to be a check to verify navigator.clipboard is defined - especially if Open WebUI is running over http instead of https, and its not accessed via localhost. For security reasons, navigator.clipboard is not available when you're on a non-secure connection.

if (command.content.includes('{{CLIPBOARD}}')) {
			const clipboardText = await navigator.clipboard.readText().catch((err) => {
				toast.error($i18n.t('Failed to read clipboard contents'));
				return '{{CLIPBOARD}}';
			});

Docker Container Logs:
n/a

Screenshots/Screen Recordings (if applicable):
Screenshot 2024-10-22 at 7 17 49 AM

Screenshot 2024-10-22 at 7 29 26 AM

Screenshot 2024-10-22 at 7 36 22 AM

Additional Information

I only have one prompt that I had setup after watching a Video about them, and followed the instructions to create the prompt. See Matt Williams: Is Open Webui The Ultimate Ollama Frontend Choice?

This is the export of that prompt:

prompt-export-1729595990930.json

Originally created by @lewismoten on GitHub (Oct 22, 2024). # Bug Report ## Installation Method Installed via docker. Full notes here: https://lewismoten3.wordpress.com/2024/10/21/setting-up-llm-on-raspberry-pi/ ## Environment - **Open WebUI Version:** v0.3.32 - **Ollama (if applicable):** 0.3.14 - **Operating System:** Ubuntu 24.04.1 LTS - **Browser (if applicable):** Chrome 129.0.6668.101 (Official Build) (arm64) **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. - [n/a] 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: - List of prompts should disappear - Prompt textbox should be populated with the prompt content - No error should appear on the console ## Actual Behavior: - List of prompts appear frozen - Prompt textbox is not populated - Error appears on console ## Description **Bug Summary:** During a chat, type forward slash in the prompt. A list of prompts are displayed. Click Enter, or arrow keys, tab key, or click the command with your mouse. Nothing happens. When viewing the console, an error appears each time. ## Reproduction Details **Steps to Reproduce:** - create a prompt in the workspace/prompts - open a chat - in the prompt box, type forward slash character "/" - Click Enter - nothing happens - Click prompt with mouse - nothing happens - Use arrow keys - nothing happens - Click escape key - console.log says 'Escape", but list of prompts remain - Click backspace - forward slash erased, prompt list disappears - type forward slash character "/" again - same behavior - refresh the browser window - same behaviors - try typing out the name of the prompt and hitting enter ## Logs and Screenshots **Browser Console Logs:** ``` Prompts.svelte:45 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'readText') at d (Prompts.svelte:45:52) at Array._ (Prompts.svelte:153:9) at HTMLButtonElement.d (Prompts.svelte:165:22) at HTMLTextAreaElement.ge (MessageInput.svelte:589:34) d @ Prompts.svelte:45 _ @ Prompts.svelte:153 d @ Prompts.svelte:165 ge @ MessageInput.svelte:589Understand this error ``` See the code base here: https://github.com/open-webui/open-webui/blob/c2d1a3164e0a310f77a88ede2938c6adb58a334f/src/lib/components/chat/MessageInput/Commands/Prompts.svelte#L45 The issue appears to be with the clipboard. There needs to be a check to verify navigator.clipboard is defined - especially if Open WebUI is running over http instead of https, and its not accessed via localhost. For security reasons, navigator.clipboard is not available when you're on a non-secure connection. ```js if (command.content.includes('{{CLIPBOARD}}')) { const clipboardText = await navigator.clipboard.readText().catch((err) => { toast.error($i18n.t('Failed to read clipboard contents')); return '{{CLIPBOARD}}'; }); ``` **Docker Container Logs:** n/a **Screenshots/Screen Recordings (if applicable):** ![Screenshot 2024-10-22 at 7 17 49 AM](https://github.com/user-attachments/assets/c7631864-f980-4c02-bc48-4a1e37549cc7) ![Screenshot 2024-10-22 at 7 29 26 AM](https://github.com/user-attachments/assets/9b20ab87-c318-4d6e-ab24-f4318076fd32) ![Screenshot 2024-10-22 at 7 36 22 AM](https://github.com/user-attachments/assets/fc6cc408-f11d-4289-ab53-3e2f11d6df94) ## Additional Information I only have one prompt that I had setup after watching a Video about them, and followed the instructions to create the prompt. See [Matt Williams: Is Open Webui The Ultimate Ollama Frontend Choice?](https://www.youtube.com/watch?v=16fWf0VVeIo) This is the export of that prompt: [prompt-export-1729595990930.json](https://github.com/user-attachments/files/17475258/prompt-export-1729595990930.json)
Author
Owner

@lewismoten commented on GitHub (Oct 22, 2024):

See here for a potential fix (untested)
https://github.com/open-webui/open-webui/commit/50c5bf558b2a826e6dcb29513ba2799c8b60761f

@lewismoten commented on GitHub (Oct 22, 2024): See here for a potential fix (untested) https://github.com/open-webui/open-webui/commit/50c5bf558b2a826e6dcb29513ba2799c8b60761f
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#2431