@@ -632,12 +632,16 @@ func (t *AutomationModuleAnalyzer) executeCreation(ctx context.Context, plan *Ex
632
632
Paths : make (map [string ]string ),
633
633
}
634
634
635
+ // 无论如何都先构建目录结构信息,确保paths始终返回
636
+ result .Paths = t .buildDirectoryStructure (plan )
637
+
635
638
// 创建包(如果需要)
636
639
if plan .NeedCreatedPackage && plan .PackageInfo != nil {
637
640
packageService := service .ServiceGroupApp .SystemServiceGroup .AutoCodePackage
638
641
err := packageService .Create (ctx , plan .PackageInfo )
639
642
if err != nil {
640
643
result .Message = fmt .Sprintf ("创建包失败: %v" , err )
644
+ // 即使创建包失败,也要返回paths信息
641
645
return result
642
646
}
643
647
result .Message += "包创建成功; "
@@ -650,23 +654,20 @@ func (t *AutomationModuleAnalyzer) executeCreation(ctx context.Context, plan *Ex
650
654
err := plan .ModulesInfo .Pretreatment ()
651
655
if err != nil {
652
656
result .Message += fmt .Sprintf ("模块信息预处理失败: %v" , err )
657
+ // 即使预处理失败,也要返回paths信息
653
658
return result
654
659
}
655
660
656
661
err = templateService .Create (ctx , * plan .ModulesInfo )
657
662
if err != nil {
658
663
result .Message += fmt .Sprintf ("创建模块失败: %v" , err )
664
+ // 即使创建模块失败,也要返回paths信息
659
665
return result
660
666
}
661
667
result .Message += "模块创建成功; "
662
668
}
663
669
664
- if ! plan .NeedCreatedModules {
665
- // 如果需要创建模块但没有调用本体方法,则构建目录结构信息供AI使用
666
- result .Paths = t .buildDirectoryStructure (plan )
667
- result .Message += "已构建目录结构信息,需要AI根据路径信息创建代码文件; "
668
- }
669
-
670
+ result .Message += "已构建目录结构信息; "
670
671
result .Success = true
671
672
672
673
if result .Message == "" {
0 commit comments