feat: 新增参考材料后端支持

- 新增 SessionMaterial 模型
- 新增 builder_session_materials 表自动迁移
- BuilderSession 增加 Materials 字段
- CreateBuilderSession/UpdateBuilderSession 支持保存材料
- GetBuilderSession 支持加载材料
- DeleteBuilderSession 支持级联删除材料
- AssemblePrompt 支持组装材料内容到 Prompt
This commit is contained in:
2026-06-26 17:26:27 +08:00
parent b779099bcf
commit e49b744385
3 changed files with 73 additions and 1 deletions
+10
View File
@@ -102,6 +102,16 @@ func AutoMigrate() error {
PRIMARY KEY (id),
KEY idx_session_id (builder_session_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`,
`CREATE TABLE IF NOT EXISTS builder_session_materials (
id bigint NOT NULL AUTO_INCREMENT,
builder_session_id bigint NOT NULL,
title varchar(255) NOT NULL DEFAULT '',
content text NOT NULL,
sort_order int NOT NULL DEFAULT 0,
PRIMARY KEY (id),
KEY idx_session_id (builder_session_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`,
}
for _, ddl := range tables {