feat: 植物识别百科ai助手迁移

This commit is contained in:
Blizzard
2026-05-24 01:41:22 +08:00
parent ae6d03d351
commit 076ed1509b
29 changed files with 1121 additions and 372 deletions
@@ -26,10 +26,12 @@ func (l *GetAiChatQuotaLogic) GetAiChatQuota(in *plant.GetProfileReq) (*plant.Ai
l.svcCtx.DB.Model(&plantModel.AiChatHistory{}).
Where("user_id = ? AND created_at >= ?", in.UserId, todayStart).
Count(&used)
limit := l.svcCtx.Config.Ai.DailyQuota
if limit <= 0 {
limit = 20
limit := int64(20)
if dbCfg, err := getActiveAiConfig(l.svcCtx.DB); err == nil && dbCfg.DailyQueryLimit > 0 {
limit = int64(dbCfg.DailyQueryLimit)
}
remaining := limit - used
if remaining < 0 {
remaining = 0