init: 初始化 web_hgdjb_server 项目

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 10:47:32 +08:00
co-authored by Claude Opus 4.7
commit f13d33af4d
707 changed files with 147705 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
package srv_aicomment
import (
"math/rand"
)
const (
commentsPerGenerationTask = 8
aiCommentPlayletTotal = 3
)
func selectAIComments(comments []Comment, count int) []Comment {
available := make([]Comment, 0, len(comments))
for _, comment := range comments {
if comment.Text != "" {
available = append(available, comment)
}
}
if count <= 0 || len(available) <= count {
return available
}
rand.Shuffle(len(available), func(i, j int) {
available[i], available[j] = available[j], available[i]
})
return available[:count]
}
func randomIntInclusive(minValue, maxValue int) int {
if maxValue <= minValue {
return minValue
}
return minValue + rand.Intn(maxValue-minValue+1)
}