fix(filters): isolate is_copilot_model to metadata and fix single-pipe match
This commit is contained in:
@@ -2713,7 +2713,8 @@ class Filter:
|
|||||||
Check if compression should be skipped.
|
Check if compression should be skipped.
|
||||||
Returns True if:
|
Returns True if:
|
||||||
"""
|
"""
|
||||||
if body.get("is_copilot_model", False):
|
is_copilot = body.get("is_copilot_model", False) or body.get("metadata", {}).get("is_copilot_model", False)
|
||||||
|
if is_copilot:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,11 @@ class Filter:
|
|||||||
# 1) Prefix match (most reliable for OpenWebUI model id formats)
|
# 1) Prefix match (most reliable for OpenWebUI model id formats)
|
||||||
raw_prefixes = self.valves.target_model_prefixes or ""
|
raw_prefixes = self.valves.target_model_prefixes or ""
|
||||||
prefixes = [p.strip().lower() for p in raw_prefixes.split(",") if p.strip()]
|
prefixes = [p.strip().lower() for p in raw_prefixes.split(",") if p.strip()]
|
||||||
if any(current.startswith(prefix) for prefix in prefixes):
|
for prefix in prefixes:
|
||||||
|
if current.startswith(prefix):
|
||||||
|
return True
|
||||||
|
# Match exact string without trailing dot for single-pipe endpoints
|
||||||
|
if prefix.endswith(".") and current == prefix[:-1]:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# 2) Keyword fallback for backward compatibility
|
# 2) Keyword fallback for backward compatibility
|
||||||
@@ -114,7 +118,10 @@ class Filter:
|
|||||||
|
|
||||||
# Check if it's a Copilot model
|
# Check if it's a Copilot model
|
||||||
is_copilot_model = self._is_copilot_model(current_model)
|
is_copilot_model = self._is_copilot_model(current_model)
|
||||||
body["is_copilot_model"] = is_copilot_model
|
|
||||||
|
if "metadata" not in body:
|
||||||
|
body["metadata"] = {}
|
||||||
|
body["metadata"]["is_copilot_model"] = is_copilot_model
|
||||||
|
|
||||||
await self._emit_debug_log(
|
await self._emit_debug_log(
|
||||||
__event_emitter__,
|
__event_emitter__,
|
||||||
|
|||||||
Reference in New Issue
Block a user