fix(ai): 补修 S8 接口加 providerKey 破坏 muse-server 导入向导 IT 编译

S8(0b109a29)给 MuseAiImportLlmParser 接口加 providerKey() 后它不再是函数式
接口,而 P1rContentImportWizardCompletedApprovalIT 的 importLlmParser() 测试 bean
仍以 lambda 提供 stub → muse-server test-compile 断裂。当时 S8 只跑 ai 模块单测
(20/0/0/0)、未编 muse-server 整分支,故漏(整分支视角收口价值)。改 lambda 为匿名
类实现 parse+providerKey;该 IT 只装配单个 parser bean、resolveImportLlmParser 对
size==1 直接返回,providerKey 不参与选择,返回 "stub" 占位。

验证:mvn -pl muse-server -am test-compile BUILD SUCCESS(MVN_EXIT=0)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
lili 2026-07-08 09:06:31 -07:00
parent 1c74372a1d
commit 9057dc8df0

View File

@ -613,10 +613,23 @@ class P1rContentImportWizardCompletedApprovalIT {
if (externalAcceptanceEnabled()) {
return new NewApiMuseAiImportLlmParser(newApiProperties());
}
return command -> new MuseAiImportLlmParser.LlmParseResult(true, List.of(
new MuseAiImportLlmParser.LlmChapter("第一章 星门", "导入向导第一章正文。"),
new MuseAiImportLlmParser.LlmChapter("第二章 归航", "导入向导第二章正文。")),
null, null, false, Map.of("parser", "stub_llm_full_book", "chapterCount", 2));
// S8 MuseAiImportLlmParser providerKey() 不再是函数式接口,改匿名类实现两方法
return new MuseAiImportLlmParser() {
@Override
public MuseAiImportLlmParser.LlmParseResult parse(MuseAiImportLlmParser.LlmParseCommand command) {
return new MuseAiImportLlmParser.LlmParseResult(true, List.of(
new MuseAiImportLlmParser.LlmChapter("第一章 星门", "导入向导第一章正文。"),
new MuseAiImportLlmParser.LlmChapter("第二章 归航", "导入向导第二章正文。")),
null, null, false, Map.of("parser", "stub_llm_full_book", "chapterCount", 2));
}
@Override
public String providerKey() {
// IT 只装配单个 parser bean,resolveImportLlmParser size==1 直接返回,
// providerKey 取值不参与选择,仅需非空占位
return "stub";
}
};
}
private MuseAiProperties newApiProperties() {