feat: gateway store.

This commit is contained in:
2026-05-01 20:29:53 +08:00
parent 942b0eeae1
commit cd490eea36
6 changed files with 105 additions and 1 deletions
+9 -1
View File
@@ -30,6 +30,7 @@ const (
analysisTypeHeartRateWithSteps = "heart_rate_with_steps"
sourceUpload = "upload"
sourceCloud = "cloud"
sourceWechat = "wechat"
)
// readDocxContent 读取 .docx 文件并将其转换为结构化文本
@@ -449,6 +450,13 @@ func resolveTeachingPlanContent(c *gin.Context, form *multipart.Form, source str
}
content, err := readDocxContent(docxFiles[0])
return content, docxFiles[0].Size, err
case sourceWechat:
docxFiles := form.File["teaching_plan"]
if len(docxFiles) == 0 {
return "", 0, fmt.Errorf("Missing required file: teaching_plan (.docx)")
}
content, err := readDocxContent(docxFiles[0])
return content, docxFiles[0].Size, err
case sourceCloud:
lessonPlanID := c.PostForm("lesson_plan_id")
if strings.TrimSpace(lessonPlanID) == "" {
@@ -461,6 +469,6 @@ func resolveTeachingPlanContent(c *gin.Context, form *multipart.Form, source str
content, err := readDocxContentFromPath(fileRecord.FilePath)
return content, fileRecord.FileSize, err
default:
return "", 0, fmt.Errorf("invalid teaching_plan_source, expected %s or %s", sourceUpload, sourceCloud)
return "", 0, fmt.Errorf("invalid teaching_plan_source, expected %s, %s or %s", sourceUpload, sourceWechat, sourceCloud)
}
}