mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-01 17:00:21 +08:00
refactor(model-permissions): 简化 allowed_models 为纯列表格式
移除按 API 格式区分的字典模式(Dict[str, List[str]]),统一使用简单列表格式。 - 删除 normalize_allowed_models 的 api_format 参数 - 删除 check_model_allowed 的 api_format 参数 - 简化 merge_allowed_models 为直接列表交集 - 移除前端的字典模式兼容代码和警告 UI - 删除 is_format_mode、convert_to_format_mode 等辅助函数
This commit is contained in:
@@ -6,7 +6,6 @@ class TestCheckModelAllowedWithAliases:
|
||||
is_allowed, matched = check_model_allowed_with_aliases(
|
||||
model_name="gpt-4o",
|
||||
allowed_models=["gpt-4o"],
|
||||
api_format="OPENAI",
|
||||
resolved_model_name="gpt-4o",
|
||||
model_aliases=[r"gpt-4o-.*"],
|
||||
)
|
||||
@@ -17,7 +16,6 @@ class TestCheckModelAllowedWithAliases:
|
||||
is_allowed, matched = check_model_allowed_with_aliases(
|
||||
model_name="target",
|
||||
allowed_models=["b", "a"],
|
||||
api_format="OPENAI",
|
||||
resolved_model_name="target",
|
||||
model_aliases=[r".*"],
|
||||
)
|
||||
@@ -28,7 +26,6 @@ class TestCheckModelAllowedWithAliases:
|
||||
is_allowed, matched = check_model_allowed_with_aliases(
|
||||
model_name="target",
|
||||
allowed_models=["other-1", "allowed-1"],
|
||||
api_format="OPENAI",
|
||||
resolved_model_name="target",
|
||||
model_aliases=[r".*-1"],
|
||||
candidate_models={"allowed-1"},
|
||||
@@ -40,11 +37,9 @@ class TestCheckModelAllowedWithAliases:
|
||||
is_allowed, matched = check_model_allowed_with_aliases(
|
||||
model_name="target",
|
||||
allowed_models=["allowed-1"],
|
||||
api_format="OPENAI",
|
||||
resolved_model_name="target",
|
||||
model_aliases=[r".*-1"],
|
||||
candidate_models={"not-present"},
|
||||
)
|
||||
assert is_allowed is False
|
||||
assert matched is None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user