init: web_hgdjc_server

This commit is contained in:
2026-11-07 10:44:09 +08:00
commit 71a4f4e175
713 changed files with 147749 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)
}