feat(settings): support gateway source switching

This commit is contained in:
chengma
2026-07-20 16:29:28 +08:00
parent ed1d8ee764
commit 6a0cd1c763
18 changed files with 746 additions and 77 deletions
+9 -6
View File
@@ -423,13 +423,16 @@ class WorkerTests(unittest.TestCase):
) as analyze, mock.patch("app.gui.workers.ai.gen_title") as gen_title:
result = worker.execute()
analyze.assert_called_once_with(
"补充要求",
"输出语言:繁体中文",
["first.jpg", "second.jpg"],
config={"ai": {"backend": "cmhub"}},
cmhub_config_path="cmhub.json",
analyze.assert_called_once()
args, kwargs = analyze.call_args
self.assertEqual(
("补充要求", "输出语言:繁体中文", ["first.jpg", "second.jpg"]),
args,
)
self.assertEqual(worker.config, kwargs["config"])
self.assertEqual("cmhub.json", kwargs["cmhub_config_path"])
self.assertIn("cmhub_api_key", worker.config["_cmshopee_ai_runtime"])
self.assertNotIn("direct_models", worker.config["_cmshopee_ai_runtime"])
gen_title.assert_not_called()
self.assertEqual(expected, result)