Enhance smoking tracking features with AI next smoke time suggestions

- Added new API endpoint `GET /api/v1/smoke/next_smoke_time` to provide AI-generated suggestions for the next smoking time based on user data.
- Introduced a new database table `fa_smoke_ai_next_smoke` to store structured AI time node suggestions.
- Updated smoke handler and service to integrate the new AI next smoke time functionality.
- Enhanced documentation to reflect the new API endpoint and its usage, including details on how to generate AI time nodes.
This commit is contained in:
nepiedg
2026-01-20 07:08:52 +00:00
parent dc54c4e934
commit 6cf7eb2294
15 changed files with 1394 additions and 27 deletions
+5 -2
View File
@@ -9,8 +9,11 @@ type SmokeAIAdvice struct {
ID uint `gorm:"primaryKey;autoIncrement;comment:记录ID" json:"id"`
UID int `gorm:"column:uid;index:idx_smoke_ai_advice_uid_date,priority:1;uniqueIndex:uniq_smoke_ai_advice,priority:1" json:"-"`
AdviceDate time.Time `gorm:"column:advice_date;type:date;index:idx_smoke_ai_advice_uid_date,priority:2;uniqueIndex:uniq_smoke_ai_advice,priority:2;comment:建议日期" json:"advice_date"`
PromptVersion string `gorm:"column:prompt_version;size:30;default:v1;uniqueIndex:uniq_smoke_ai_advice,priority:3;comment:提示词版本" json:"prompt_version"`
// Type 用于区分 AI 使用场景(例如:daily_advice / next_smoke_time)。
Type string `gorm:"column:type;size:30;default:daily_advice;index:idx_smoke_ai_advice_uid_date,priority:2;uniqueIndex:uniq_smoke_ai_advice,priority:2;comment:用途类型" json:"type"`
AdviceDate time.Time `gorm:"column:advice_date;type:date;index:idx_smoke_ai_advice_uid_date,priority:3;uniqueIndex:uniq_smoke_ai_advice,priority:3;comment:建议日期" json:"advice_date"`
PromptVersion string `gorm:"column:prompt_version;size:30;default:v1;uniqueIndex:uniq_smoke_ai_advice,priority:4;comment:提示词版本" json:"prompt_version"`
Provider string `gorm:"column:provider;size:30;comment:AI提供方" json:"provider,omitempty"`
Model string `gorm:"column:model;size:60;comment:模型名" json:"model,omitempty"`