添加对 mix 查询模式的支持

This commit is contained in:
yangdx
2025-01-17 11:04:36 +08:00
parent 847963d19a
commit 3138ae7599
2 changed files with 4 additions and 2 deletions

View File

@@ -243,6 +243,7 @@ class SearchMode(str, Enum):
local = "local" local = "local"
global_ = "global" # 使用 global_ 因为 global 是 Python 保留关键字,但枚举值会转换为字符串 "global" global_ = "global" # 使用 global_ 因为 global 是 Python 保留关键字,但枚举值会转换为字符串 "global"
hybrid = "hybrid" hybrid = "hybrid"
mix = "mix"
# Ollama API compatible models # Ollama API compatible models
class OllamaMessage(BaseModel): class OllamaMessage(BaseModel):
@@ -684,7 +685,8 @@ def create_app(args):
"/local ": SearchMode.local, "/local ": SearchMode.local,
"/global ": SearchMode.global_, # global_ is used because 'global' is a Python keyword "/global ": SearchMode.global_, # global_ is used because 'global' is a Python keyword
"/naive ": SearchMode.naive, "/naive ": SearchMode.naive,
"/hybrid ": SearchMode.hybrid "/hybrid ": SearchMode.hybrid,
"/mix ": SearchMode.mix
} }
for prefix, mode in mode_map.items(): for prefix, mode in mode_map.items():

View File

@@ -337,7 +337,7 @@ def test_query_modes():
每个模式都会返回相同格式的响应,但检索策略不同。 每个模式都会返回相同格式的响应,但检索策略不同。
""" """
url = get_base_url() url = get_base_url()
modes = ["local", "global", "naive", "hybrid"] # 支持的查询模式 modes = ["local", "global", "naive", "hybrid", "mix"] # 支持的查询模式
for mode in modes: for mode in modes:
if OutputControl.is_verbose(): if OutputControl.is_verbose():