Ollama WebUI

最後更新: 2024-05-09

目錄

 


介紹

 

HomePage: https://www.openwebui.com/

Github: https://github.com/open-webui/open-webui

  • Supports various LLM runners(OpenAI-compatible APIs)
  • Responsive Design
  • Full Markdown and LaTeX Support
  • Local and Remote RAG Integration ("#")
  • load documents directly into the chat ("#")
  • Concurrent Model Utilization
  • Easily create Ollama modelfiles via the web UI
  • Text-to-Speech
  • "FUNCTIONS" FEATURE
    utilize filters (middleware) and pipe (model) functions directly within the WebUI
  • Multiple Ollama Instance Load Balancing
  • Backend Reverse Proxy Support

Model Management

  • Model Builder: Easily create Ollama models directly from Open WebUI.
  • Fine-Tuned Control with Advanced Parameters.
    (seed, temperature, frequency penalty, context length, ...)
  • uploading GGUF files directly from Open WebUI

 

 


Install By podman

 

create-open-webui.sh

#!/bin/bash

NAME="open-webui"
LOG_FILE=/var/log/container/${NAME}.log
IMAGE=ghcr.io/open-webui/open-webui:main

podman run -tid -p 3000:8080 \
  --add-host=ollama:192.168.200.18 \
  -e OLLAMA_BASE_URL=http://ollama:11434 \
  -e ENABLE_SIGNUP=False \
  -e ENABLE_COMMUNITY_SHARING=False \
  -v /data/open-webui:/app/backend/data \
  --restart always \
  --name $NAME \
  --log-driver=k8s-file \
  --log-opt path=$LOG_FILE \
  --log-opt max-size=1mb \
  $IMAGE

 


Setup

 

Admin Creation

The very first account to sign up on Open WebUI will be granted Administrator privileges.

Notes:

  • User Registrations: Pending status by default
  • WEBUI_AUTH 可以定左 Login

 


Reverse-proxy Open WebUI via Nginx

 

server {
    ...
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires 1w;
        log_not_found off;
        proxy_pass http://127.0.0.1:3000;
        proxy_cache          MyCache;
        proxy_cache_valid    200  7d;
        add_header X-Cache-Status $upstream_cache_status;
    }
    location / {
        ## ACL
        #auth_basic "Restricted";
        #auth_basic_user_file htpasswd.txt;
        #add_header Cache-Control no-cache;
        include proxy_params;
        proxy_pass http://127.0.0.1:3000;
        ## My Settings
        include snippets/websocket.conf;
        include snippets/proxy_settings.conf;
    }
}

 


Settings

 

ENABLE_SIGNUP (Default: True)

Description: Toggles user account creation.

DEFAULT_MODELS

Description: Sets a default Language Model.

WEBUI_AUTH (Default Setting: True)

Description: This setting enables or disables authentication. If set to False, authentication is disabled.
If there are already users registered, you cannot disable authentication directly.

OLLAMA_BASE_URL

Default: http://localhost:11434

ENABLE_COMMUNITY_SHARING (Default: True)

Description: Controls whether users are shown the share to community button.

ENABLE_MODEL_FILTER (Default: False)

Description: Toggles Language Model filtering.

MODEL_FILTER_LIST

Description: Sets the Language Model filter list, semicolon-separated

Example: llama3:instruct;gemma:instruct

 

Ollama Settings

  • use_mmap

 

  • use_mlock

 

  • num_thread

ollama run llama3

>>> /set parameter num_thread 96
Set parameter 'num_thread' to '96'
  • num_gpu

 

Webui Settings

  • Keep Alive         # 相當於 ollama 的 OLLAMA_KEEP_ALIVE

 

  • Request Mode    # Default / JSON

JSON:

This gives you more control. You send your prompt and instructions as a structured JSON

This can be useful for complex requests or if you need to pass specific parameters to the model.

 


Upgrade

 

podman images                                                     # 查看現有 version

podman pull ghcr.io/open-webui/open-webui:main    # 下載新 version

podman rm -f open-webui                                       # Stop & Remove

# Create New One (每人的 cmd 可能不一樣)

mycli

# 測試正常後再刪除舊的 image

podman image prune

 


Keyboard shortcuts

 

ctrl+/                                 Show shortcuts menu

ctrl+shift+o                        new chat

ctrl+shift+backspace           Delete chat

ctrl+shift+s                        toggle sidebar

ctrl+.                                 toggle settings

ctrl+shift+;                       Copy last code block

 


Input Command

 

"/"       access preset prompts

"@"     Select specify model by name within a chat

"#"     RAG (Attach file / Followed by the URL. To incorporate web content directly)

Keyboard Shortcut

  • Open new chat: Ctrl+Shift+O
  • Focus chat input: Shift+Esc
  • Toggle sidebar: Ctrl+Shift+S

 


Reset Admin Password

 

# -b     Use batch mode
# -n     Display the results on stdout
# -B     Use bcrypt encryption for passwords.
# -C     This flag is only allowed in combination with -B
#        It sets the computing time used for the bcrypt algorithm
#        (higher is more secure but slower, default: 5, valid: 4 to 17)
# ""     Username

htpasswd -bnBC 10 "" your-new-password | tr -d ':\n'

sqlite3 backend/data/webui.db

SQL:

UPDATE auth SET password='YOUR_HASH' WHERE email='[email protected]';

Remark: Tables schema

sqlite> .tables

auth            document        memory          prompt          user
chat            file            migratehistory  tag
chatidtag       function        model           tool

sqlite> .schema user

# user tables

select name, email, role from user;

 


UI Usage
 

Archive all chat

Settings > Chats > Archive All Chats

 


Generatin info

 

e.g.

response_token/s: 7.63 tokens
prompt_token/s: 23.79 tokens
total_duration: 17626.09ms
load_duration: 53.27ms
prompt_eval_count: 97
prompt_eval_duration: 4077.97ms
eval_count: 102
eval_duration: 13361.3ms
approximate_total: 17s

response_token/s

prompt_token/s

prompt_eval_count

eval_count

 


Workspace

 

在 workspace 內可以加入以下強化

Knowledge

To add documents here, upload them to the "Documents"

Tools

To select toolkits here, add them to the "Tools"

Filters

To select filters here, add them to the "Functions"

Actions

To select actions here, add them to the "Functions"

 


Local and Remote RAG Integration

 

[1] Local

Documents can be loaded into the workspace area,
 after which they can be accessed using the "#" symbol before a query

[2] Remote (Web Browsing, Web Search Capabilities)

By starting the prompt with "#", followed by a URL for web content integration.

 


 

Creative Commons license icon Creative Commons license icon