Limit context messages by admin-defined per-user map, with admin users unlimited.
""" title: Limit conversation context per user id: user_map_context_clip_filter author: gpt-5.1 version: 0.8.0 description: Limit context messages by admin-defined per-user map, with admin users unlimited. """ from typing import Optional, Any, Dict, Callable, Awaitable from pydantic import BaseModel, Field import json
Filter for Open WebUI that clips conversation context per user (by ID or email).
Limit counts only context messages and excludes the current message.
role=admin) have unlimited context.default_max_messages.system message.limit=0 keeps only the current message (plus system if enabled).default_max_messagesuser_limits_jsonkeep_systemdebug_logging{
"[email protected]": 16,
"c162258a-e1d3-48e3-8bfb-e513b1f15e83": 8
}Copy user_map_context_clip_filter.py to Open WebUI under Admin ▸ Filters to enable.
这是一个 Open WebUI 的 Filter 插件,用于根据用户 ID / Email 对上下文消息进行裁剪。
limit 只统计“上下文消息数”,不包含当前消息。
role=admin)无限制上下文。max_messages。default_max_messages。system 消息。limit=0 时仅保留当前消息(如果启用 keep_system 则加上 system)。default_max_messagesuser_limits_jsonkeep_systemdebug_logging{
"[email protected]": 16,
"c162258a-e1d3-48e3-8bfb-e513b1f15e83": 8
}将 user_map_context_clip_filter.py 上传到 Open WebUI 的 Admin ▸ Filters 即可启用。
We use optional analytics to improve our websites, and advertising cookies on this site. Privacy Policy.