标签 OpenWebUI 下的文章
OpenWebUI (owu) 配置分享
用了 openwebui 大半年了。从一开始的毛胚房到现在的精装修。踩了很多坑,也一步步的看着 openwebui 更强大更好用。我把我理解的各项功能的好用配置分享给大家交流一下
安装
我是在群晖上通过 docker 方式安装的
docker image prune
docker pull ghcr.io/open-webui/open-webui:main
docker pull ghcr.io/open-webui/mcpo:main
除了端口设置外就只有一个文件夹挂载,这是所有用户数据了。我更新的方式都是通过重置这个容器来升级。
本来是没有第一行的。直到我 200G 系统盘因此被占满 ……
添加模型服务器
通过管理员设置 - 外部链接 - 加号 - 把供应商的域名和 apikey 填进来就可以了
他默认会把所有的模型都以私有的方式给你添加到 owu 来。你可以选择禁用某些用不到的模型,让他们不在可选列表里面出现(比如 rag 相关的重拍、向量化模型),也可以用过将私有转公开的方式让其他用户可以使用该模型。最简单也可以通过环境变量 BYPASS_MODEL_ACCESS_CONTROL=True 来放开所有模型,不用单独设置。
我比较喜欢我的小房子 我去 cherrystudio 偷了一些图标美化我的小房子~
可以在管理员设置 - 模型 - 编辑单个模型去上传图标。
函数
我本地的函数比较简单。就配置了联网搜索以及本地事件的补充,告诉 ai 当前时间
当前时间的话如下。
Message Date And Time 函数代码
"""
title: Message Date And Time
author: benasraudys
author_url: https://github.com/benasraudys
funding_url: https://github.com/benasraudys
description: Gives model current date and time context for each message. Don't forget to adjust the timezone in the settings.
version: 0.1.1
required_open_webui_version: 0.6.4
"""
import datetime
import os
from pydantic import BaseModel, Field
from typing import Callable, Awaitable, Any, Optional
class Filter:
class Valves(BaseModel):
timezone_hours: int = Field(
default=0,
description="Timezone offset hours (e.g., 5 for UTC+5:30, -4 for UTC-4:00)",
)
timezone_minutes: int = Field(
default=0,
description="Timezone offset minutes (e.g., 30 for UTC+5:30, 45 for UTC-4:45)",
)
southern_hemisphere: bool = Field(
default=False,
description="Enable if you're in the Southern Hemisphere (Australia, South America, etc.)",
)
def __init__(self):
self.valves = self.Valves(
**{
"timezone_hours": int(os.getenv("DATETIME_TIMEZONE_HOURS", "0")),
"timezone_minutes": int(os.getenv("DATETIME_TIMEZONE_MINUTES", "0")),
"southern_hemisphere": os.getenv(
"DATETIME_SOUTHERN_HEMISPHERE", "false"
).lower()
== "true",
}
)
def get_season(self, month, southern_hemisphere=False):
if not southern_hemisphere:
if 3 <= month <= 5:
return "Spring"
elif 6 <= month <= 8:
return "Summer"
elif 9 <= month <= 11:
return "Autumn"
else:
return "Winter"
else:
if 3 <= month <= 5:
return "Autumn"
elif 6 <= month <= 8:
return "Winter"
elif 9 <= month <= 11:
return "Spring"
else:
return "Summer"
def get_time_of_day(self, hour):
if 5 <= hour < 12:
return "Morning"
elif 12 <= hour < 17:
return "Afternoon"
elif 17 <= hour < 21:
return "Evening"
else:
return "Night"
async def inlet(
self,
body: dict,
__event_emitter__: Callable[[Any], Awaitable[None]],
__request__: Any,
__user__: Optional[dict] = None,
__model__: Optional[dict] = None,
) -> dict:
now_utc = datetime.datetime.utcnow()
timezone_hours = self.valves.timezone_hours
timezone_minutes = self.valves.timezone_minutes
total_offset_minutes = (timezone_hours * 60) + timezone_minutes
now = now_utc + datetime.timedelta(minutes=total_offset_minutes)
month = now.month
hour = now.hour
formatted_date = now.strftime("%B %d, %Y")
formatted_time = now.strftime("%H:%M:%S")
day_of_week = now.strftime("%A")
hours_offset = abs(total_offset_minutes) // 60
minutes_offset = abs(total_offset_minutes) % 60
if minutes_offset == 0:
if total_offset_minutes >= 0:
timezone_str = f"UTC+{hours_offset}"
else:
timezone_str = f"UTC-{hours_offset}"
else:
if total_offset_minutes >= 0:
timezone_str = f"UTC+{hours_offset}:{minutes_offset:02d}"
else:
timezone_str = f"UTC-{hours_offset}:{minutes_offset:02d}"
season = self.get_season(month, self.valves.southern_hemisphere)
time_of_day = self.get_time_of_day(hour)
context = f"Current date is {day_of_week}, {formatted_date}, {season}, {time_of_day}, the user time is {formatted_time} {timezone_str}"
datetime_message = {
"role": "system",
"content": f"Time context: {context}. ",
}
if "messages" in body and isinstance(body["messages"], list):
body["messages"].insert(0, datetime_message)
else:
body["messages"] = [datetime_message]
return body
联网搜索的话主要是基于各家模型自己的能力(大概也就是在消息接口参数里面注入模型对应的工具,但是一般都要额外付费,所以我现在基本不用了) 我了解到的,gemini 有这样的函数配置,以及 openai 流式接口也有。这个可以站内查对应工具直接使用。函数认准方块佬就对了。加个方块,搜索更快!
两个工具结合就能达到以下示例的效果
外部工具
这里主要是提供 mcp 的能力 说实话挺难用的。但是我刚好联网搜索走其他方式都有些不好用。我目前是通过 mcp 的方式来实现的。
部署 mcpo
我通过在本地 docker 部署 mcpo,镜像地址在一开始应该已经准备好了。
我群晖这边的部署操作主要是配置了端口为 38000 以及启动命令
mcpo --config /app/mcp-config.json --hot-reload
然后通过文件挂载 /app/mcp-config.json 这个配置文件
文件内容可以参考下面这个
{
"mcpServers": {
"grok-search": {
"type": "stdio",
"command": "npx",
"args": ["-y", "grok-search-mcp"],
"env": {
"GROK_API_URL": "https://-----/v1",
"GROK_API_KEY": "-----",
"GROK_MODEL": "grok-4-fast",
"DEBUG": "true"
}
}
}
}
然后我们就可以直接访问 38000 这个端口就可以看到 json 返回了 也能知道你哪些工具启动成功了。
我们就能去管理员设置 - 外部工具 - 加号 新增工具服务器了
在配置完成之后我们可以在对话界面去勾选这个工具 对他进行一些询问。示例如下
当然你可能觉得每一次点都好费劲,当然我们也可以到 管理员设置 - 模型 - 对应模型去默认启动某些工具或其他功能
知识库
知识库我用的其实不多。但是我觉得效果还是不错的。就是遇到这个坑导致 rag 检索不符合预期
内容提取
首先提取引擎我推荐 mistral (主要可以白嫖) 效果也不错 我用过自部署的 tika。有些中文 pdf 会乱码 这个挺好的。但是我还是建议如果可以自己转 md 把
嵌入和检索
这一块我也是跟着 ai 配的。效果还是不错的。
上传合适的文档,结果也能够图文并茂
辅助功能
在管理员设置 - 界面 - 任务这边可以配置一些异步的小任务是否使用 ai 生成
我就开了这个标题自动生成(效果图如左上角),openai 每天免费的 nano 用不完就来这边干点活吧。有标题了也方便你到时候快速查询历史的对话。
图片生成
目前我觉得 owu 做的这个功能比较死板(主要问题是只能填入一个模型)
我有个朋友部署好了 comfy,等给我之后这边估计Pro 就要从对话模型里面选了。
通过这种方式配置好的话 体验和 openai 就很像了。对话勾选一下画图。描述需求就好了
画图也踩过一些坑,比如分享一个 openwebui 中生图模型 chunk too big 问题的解决办法 。里面也有其他佬遇到的其他坑和他们的解决方式。L 站真的是我见过 ai 相关信息最快的一个站了。在站内搜不到,我估计谷歌也搜不到
结语
以上就是我的配置心得。希望我的分享能给你一些启发,也欢迎大家交流各自的 “装修方案”。
还在纠结 CherryStudio 和 OpenWebUI?我全都要!
现在的 AI 客户端简直是百花齐放,讨论相对较多的应该就属 CherryStudio 和 OpenWebUI 了
先聊 CherryStudio
- 优点:UI 设计确实审美在线,比 ChatBox 精致不少,而且多服务商、多模型的接入和切换非常方便,主打一个方便快捷,打开软件就能用。
- 硬伤:对话历史的堆积,个人目前体验变得非常卡;最可惜的是缺乏原生多端同步。
再说 OpenWebUI
优点:走的是 Web 架构路线,界面复刻了 ChatGPT 的极简风格,上手几乎是零门槛。函数调用、知识库,还有高度可定制化的设置非常优秀,比如模型参数、权限、检索策略这类设置,很多客户端只是给个开关意思一下,它是给你一整套可控面板,当然还有我最需要的多端同步
缺点:模型太多的时候就很不方便管理,而且不支持 Gemini 接口的原生接入。高度可自定义化也意味着默认体验未必最佳 —— 你得自己调,调好了很爽,没调好就容易变成功能太多太杂,懒得去动的状态。
但我想要是能把二者相结合岂不是绝杀?能的佬友,能的!
① 对话高级参数完整汉化 + info 黑框重做:能直接看到更明确的用量和消费
② 自定义上下文条数:可以设置发送给模型的历史消息上下文的最大条数,有效节省 Token
③ 外部连接显示优化:作为一只屯屯鼠,公益站 / API 站一多,设置界面简直就是灾难。改成双列显示,管理效率直接拉满
④ Gemini 原生端口支持:不依赖 OpenAI 兼容层,直接走 Gemini 原生接口,可同步模型列表,
thinking_budget这类特有参数也能上,同时支持流式传输图片
⑤ 外部链接可备注名称 + 可点击名称直达 URL 设置:
本屯屯鼠最大的噩梦,看着一堆 URL 无从下手,现在能直接备注,方便区分,还能点名字直接跳转到设置,不用怕点错小齿轮,适合链接多的佬
⑥ 模型界面缓存逻辑优化:当模型列表过多时,不用再转圈圈等待
⑦ 自动按模型名匹配 Logo:不用再手动每个模型点进去添加图标了,增加了常见的 LLM 品牌 Logo 自动匹配(GPT/Claude/Gemini/Qwen…),对齐 CherryStudio
⑧ 首页模型切换处增加直达模型设置按钮:选模型的地方增加设置跳转,方便快速管理模型
⑨ 模型计费 + 用量统计前端同步 info 黑框:支持免费 / 按次 / 按量三种模式,实时计算对话成本
⑩ 推理强度 / Reasoning Effort 支持下拉 + 自定义输入
其余设置优化:(关于联网搜索不准确的解决方案)
优化 OpenWebUI 联网搜索功能【点击展开】
1、先按照图片设置 Documents 文档和联网搜索,重排模型根据自己的模型配置:
2、复制这段提示词到 Documents 文档设置中的 RAG 提示词模板中,再次试试联网搜索,会有惊喜
### Task:
Respond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id="1">).
### Guidelines:
- If you don't know the answer, clearly state that.
- If uncertain, ask the user for clarification.
- Respond to the user query in Chinese.
- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.
- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.
- Only include inline citations using [id] (e.g., [1], [2]) when the <source> tag includes an id attribute.
- Do not cite if the <source> tag does not contain an id attribute.
- Do not use XML tags in your response.
- Ensure citations are concise and directly related to the information provided.
- Current Date: {{CURRENT_DATE}}. If there is conflicting information, prioritize the latest events based on the timeline.
### Rules for using web sources (especially time‑sensitive questions)
- For time-sensitive queries, prioritize webpages published within the **last 3–5 days**.
- If old data conflicts with new data, strictly prioritize the **latest publication time**.
- If multiple sources conflict, prioritize sources that are both **most recent AND from authoritative media/official institutions**.
- If sources disagree on the same fact, explicitly point out the discrepancy in your answer and justify which source you consider most reliable.
- Verify key facts against other sources to check for contradictions.
### Example of Citation:
If the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:
* "According to the study, the proposed method increases efficiency by 20% [1]."
### Output:
Provide a clear and direct response to the user's query, including inline citations in the format [id] only when the <source> tag with id attribute is present in the context.
<context>
{{CONTEXT}}
</context>
<user_query>
{{QUERY}}
</user_query>
Docker 一键部署命令【点击展开】
docker run -d \
--name open-webui \ --restart always \
-p 3000:8080 \
-v open-webui:/app/backend/data \
ghcr.io/ztx888/openwebui:latest
- 浏览器访问:
http://你的服务器IP:3000 - 数据持久化在 Docker 卷:
open-webui(用于重启或者更新的时候不丢配置和对话)
如果你本机没有 Docker 卷习惯,也可以改成本地目录挂载:
mkdir -p ./open-webui-data
docker run -d \
--name open-webui \
--restart always \
-p 3000:8080 \
-v $(pwd)/open-webui-data:/app/backend/data \
ghcr.io/ztx888/openwebui:latest
最后必须说一句
非常感谢各位公益站站长的付出和维护,真的帮各位佬省了太多折腾和成本。提供节点、反代、还是日常兜底运维,都很不容易,向各位站长致敬。
遇到问题欢迎反馈
我会持续迭代同步更新官方上游,如果你装了之后遇到问题、或者有更想要的功能点,欢迎来反馈
![[OpenWebUI] Claude 原生 Tool Use 上新1](https://xiaohack.oss-cn-zhangjiakou.aliyuncs.com/typecho/images/2026/01/14/20260114182035_69676df30b219.png!mark)



























