АРЧ - UI и domain loop: синхронизировать локальную LLM-модель через shared config + КВИН 3
This commit is contained in:
@@ -17,6 +17,7 @@ from scripts.domain_case_loop import (
|
||||
evaluate_analyst_gate,
|
||||
evaluate_deterministic_loop_gate,
|
||||
load_scenario_pack,
|
||||
load_shared_local_llm_defaults,
|
||||
merge_scenario_date_scope,
|
||||
select_primary_repair_focus,
|
||||
restore_line_collapsed_files_from_snapshot,
|
||||
@@ -66,6 +67,65 @@ def test_merge_scenario_date_scope_preserves_historical_anchor_on_followup() ->
|
||||
assert merged["source"] == "current_analysis"
|
||||
|
||||
|
||||
def test_load_shared_local_llm_defaults_uses_ui_selected_local_model(tmp_path) -> None:
|
||||
config_path = tmp_path / "shared_llm_connection.json"
|
||||
config_path.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"schema_version": "shared_llm_connection_v1",
|
||||
"updated_at": "2026-04-15T06:00:00Z",
|
||||
"connection": {
|
||||
"llmProvider": "local",
|
||||
"model": "unsloth/qwen3-30b-a3b-instruct-2507",
|
||||
"baseUrl": "http://127.0.0.1:1234/v1",
|
||||
"temperature": 0.2,
|
||||
"maxOutputTokens": 1200,
|
||||
},
|
||||
},
|
||||
ensure_ascii=False,
|
||||
indent=2,
|
||||
)
|
||||
+ "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
defaults = load_shared_local_llm_defaults(config_path)
|
||||
|
||||
assert defaults["llm_provider"] == "local"
|
||||
assert defaults["llm_model"] == "unsloth/qwen3-30b-a3b-instruct-2507"
|
||||
assert defaults["llm_base_url"] == "http://127.0.0.1:1234/v1"
|
||||
assert defaults["temperature"] == 0.2
|
||||
assert defaults["max_output_tokens"] == 1200
|
||||
|
||||
|
||||
def test_load_shared_local_llm_defaults_ignores_non_local_provider(tmp_path) -> None:
|
||||
config_path = tmp_path / "shared_llm_connection.json"
|
||||
config_path.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"schema_version": "shared_llm_connection_v1",
|
||||
"updated_at": "2026-04-15T06:00:00Z",
|
||||
"connection": {
|
||||
"llmProvider": "openai",
|
||||
"model": "gpt-4o-mini",
|
||||
"baseUrl": "https://api.openai.com/v1",
|
||||
"temperature": 0,
|
||||
"maxOutputTokens": 700,
|
||||
},
|
||||
},
|
||||
ensure_ascii=False,
|
||||
indent=2,
|
||||
)
|
||||
+ "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
defaults = load_shared_local_llm_defaults(config_path)
|
||||
|
||||
assert defaults["llm_provider"] == "local"
|
||||
assert defaults["llm_model"] == "qwen2.5-14b-instruct-1m"
|
||||
|
||||
|
||||
def test_load_scenario_pack_accepts_active_domain_contract(tmp_path) -> None:
|
||||
manifest_path = tmp_path / "active_domain_contract.json"
|
||||
manifest_path.write_text(
|
||||
|
||||
Reference in New Issue
Block a user