T-579 内置默认AI提示词

This commit is contained in:
chengma
2026-07-10 09:00:24 +08:00
parent 9742448750
commit e5b7fc4afa
11 changed files with 306 additions and 4 deletions
+24 -1
View File
@@ -1857,7 +1857,9 @@ class GuiTests(TempDirMixin, unittest.TestCase):
self.assertEqual(0, tab.cover_progress_bar.value())
self.assertEqual(1, tab.title_progress_bar.maximum())
self.assertEqual(1, tab.cover_progress_bar.maximum())
self.assertEqual("默认", tab.cover_template_combo.currentText())
self.assertIn("蝦皮台灣站", tab.title_prompt_edit.toPlainText())
self.assertEqual("papa1", tab.cover_template_combo.currentText())
self.assertIn("商品标题:{新标题}", tab.cover_prompt_edit.toPlainText())
self.assertEqual("模板操作", tab.cover_template_actions_button.text())
self.assertIs(tab.cover_template_actions_menu, tab.cover_template_actions_button.menu())
self.assertEqual(
@@ -2234,6 +2236,27 @@ class GuiTests(TempDirMixin, unittest.TestCase):
self.assert_removed(temp_dir)
def test_generate_tab_seeds_default_prompts_for_new_user_data(self):
with self.make_temp_dir() as temp_dir:
cfg = self.make_config(temp_dir)
title_prompt_path = os.path.join(temp_dir, "title_prompt.txt")
cover_prompts_dir = os.path.join(temp_dir, "prompts", "cover")
tab = GenerateTab(
config=cfg,
title_prompt_path=title_prompt_path,
cover_prompts_dir=cover_prompts_dir,
)
self.addCleanup(tab.close)
self.assertIn("蝦皮台灣站", tab.title_prompt_edit.toPlainText())
self.assertEqual("papa1", tab.cover_template_combo.currentText())
self.assertIn("商品标题:{新标题}", tab.cover_prompt_edit.toPlainText())
self.assertTrue(os.path.exists(title_prompt_path))
self.assertTrue(os.path.exists(os.path.join(cover_prompts_dir, "papa1.txt")))
self.assert_removed(temp_dir)
def test_generate_tab_manages_prompt_files_and_preview(self):
with self.make_temp_dir() as temp_dir:
cfg = self.make_config(temp_dir)