diff --git a/app.py b/app.py index fb6fbca..fbf404a 100644 --- a/app.py +++ b/app.py @@ -4444,7 +4444,7 @@ def _prefer_detected_model(provider: str, models: list[str], manual_option: str) provider_slug = provider_state_slug(provider) choice_key = f"model_choice_{provider_slug}" current_choice = st.session_state.get(choice_key) - if current_choice in models: + if current_choice == manual_option or current_choice in models: return preferred = str( st.session_state.get(f"model_manual_{provider_slug}", "") diff --git a/requirements-dev.txt b/requirements-dev.txt index 9c81450..6aa6003 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,2 +1,3 @@ -r requirements.txt +httpx>=0.28.1,<1.0.0 pytest>=9.1.1,<10.0 diff --git a/tests/test_app_smoke.py b/tests/test_app_smoke.py index 97a44af..0325b26 100644 --- a/tests/test_app_smoke.py +++ b/tests/test_app_smoke.py @@ -35,6 +35,10 @@ def test_app_starts_without_contacting_a_model() -> None: def test_chat_submission_is_preserved_without_a_selected_model() -> None: app_path = Path(__file__).resolve().parents[1] / "app.py" app = AppTest.from_file(str(app_path)).run(timeout=20) + model_choice = next( + item for item in app.selectbox if item.label == "已检测到的模型" + ) + model_choice.set_value("手动输入…").run(timeout=20) model = next(item for item in app.text_input if item.label == "Model Name") model.set_value("").run(timeout=20) question = next(item for item in app.text_area if item.label == "继续回复 JARVIS")