1. Add 登陆功能
2. 调整字体大小 3. 新增部分功能
This commit is contained in:
39
tests/test_reranker_bootstrap.py
Normal file
39
tests/test_reranker_bootstrap.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""Verify that bootstrap correctly wires the reranker when the setting is enabled."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_get_reranker_returns_none_when_disabled():
|
||||
"""get_reranker() must return None when reranker_enabled is False."""
|
||||
with patch("app.shared.bootstrap._build_binary_store"), \
|
||||
patch("app.shared.bootstrap._build_vector_index"):
|
||||
from app.shared import bootstrap
|
||||
bootstrap.get_reranker.cache_clear()
|
||||
|
||||
with patch("app.shared.bootstrap.settings") as mock_settings:
|
||||
mock_settings.reranker_enabled = False
|
||||
mock_settings.reranker_base_url = ""
|
||||
result = bootstrap.get_reranker()
|
||||
|
||||
bootstrap.get_reranker.cache_clear()
|
||||
assert result is None
|
||||
|
||||
|
||||
def test_get_reranker_returns_instance_when_enabled():
|
||||
"""get_reranker() must return an OpenAICompatibleReranker when enabled."""
|
||||
from app.shared import bootstrap
|
||||
bootstrap.get_reranker.cache_clear()
|
||||
|
||||
with patch("app.shared.bootstrap.settings") as mock_settings:
|
||||
mock_settings.reranker_enabled = True
|
||||
mock_settings.reranker_base_url = "http://localhost:8082"
|
||||
mock_settings.reranker_model = "BAAI/bge-reranker-v2-m3"
|
||||
mock_settings.reranker_api_key = ""
|
||||
mock_settings.reranker_top_k = 5
|
||||
result = bootstrap.get_reranker()
|
||||
|
||||
bootstrap.get_reranker.cache_clear()
|
||||
from app.infrastructure.vectorstore.cross_encoder_reranker import OpenAICompatibleReranker
|
||||
assert isinstance(result, OpenAICompatibleReranker)
|
||||
Reference in New Issue
Block a user