fix: lesson plan permission.

This commit is contained in:
2026-05-03 10:09:52 +08:00
parent 5e68e50aa1
commit 31b1441394
2 changed files with 35 additions and 8 deletions
+12 -7
View File
@@ -254,9 +254,9 @@ func callAIForAnalysis(prompt string) (*aiAnalysisResult, error) {
Content: prompt,
},
},
Temperature: 0.6,
TopP: 0.6,
MaxTokens: 4000,
Temperature: 0.6,
TopP: 0.6,
MaxCompletionTokens: 4000,
},
)
if err != nil {
@@ -419,6 +419,11 @@ func (tc *TrainingController) streamAIAnalysis(c *gin.Context, prompt string,
regionID *uint32, trainID, sourceType, analysisType string,
originalFileSize, compressedContentSize int64, uploadTime int64) {
sizeInBytes := len(prompt)
sizeInKB := float64(sizeInBytes) / 1024.0
log.Printf("=== 发送给流式 AI 的内容大小: %.2f KB (%d 字节) ===", sizeInKB, sizeInBytes)
c.Writer.Header().Set("Content-Type", "text/event-stream")
c.Writer.Header().Set("Cache-Control", "no-cache")
c.Writer.Header().Set("Connection", "keep-alive")
@@ -448,10 +453,10 @@ func (tc *TrainingController) streamAIAnalysis(c *gin.Context, prompt string,
Messages: []openai.ChatCompletionMessage{
{Role: openai.ChatMessageRoleUser, Content: prompt},
},
Temperature: 0.6,
TopP: 0.6,
MaxTokens: 4000,
Stream: true,
Temperature: 0.6,
TopP: 0.6,
MaxCompletionTokens: 4000,
Stream: true,
StreamOptions: &openai.StreamOptions{
IncludeUsage: true,
},