feat(agent): ✨ 在 Agent 聊天接口中新增 AI 随口记功能 * 无相关意图时保持正常聊天,若识别到相关意图则自动切换为随口记模式 * 支持阶段状态反馈与话题化回复,提升交互体验 - 引入请求级当前时间基准,支持相对时间解析(如“明天”、“下周一”等) - 增加非法日期拦截机制,防止用户输入格式错误的时间并返回修正提示 - 优化随口记图谱,补充阶段打点与详细中文注释,失败/重试分支处理更清晰 - 推送 `reasoning_content` 阶段状态,涵盖 `request.accepted`、`intent`、`deadline`、`priority`、`persisting`、`persisted`、`reply.polishing` 等状态 - 最终文案改为“事实句 + AI 生成的贴题轻松跟进句”,避免硬编码调侃内容 - 完善时间解析相关测试,确保功能正确性,测试通过 `go test ./...` --- improvements: 🛠️ 开发心路历程与优化 * 修复随口记链路中 `assistant` 消息未写入 Redis 的问题,确保消息持久化 * 去除“分段正文伪流式”处理,改为最终正文一次性输出,简化内容流转
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type Task struct {
|
|
ID int `gorm:"primaryKey;autoIncrement"`
|
|
UserID int `gorm:"column:user_id;index"`
|
|
Title string `gorm:"type:varchar(255)"`
|
|
Priority int `gorm:"not null"`
|
|
IsCompleted bool `gorm:"column:is_completed;default:false"`
|
|
DeadlineAt *time.Time `gorm:"column:deadline_at"`
|
|
}
|
|
|
|
type UserAddTaskResponse struct {
|
|
ID int `json:"id"`
|
|
Title string `json:"title"`
|
|
PriorityGroup int `json:"priority_group"`
|
|
DeadlineAt *time.Time `json:"deadline_at"`
|
|
Status string `json:"status"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type UserAddTaskRequest struct {
|
|
Title string `json:"title"`
|
|
PriorityGroup int `json:"priority_group"`
|
|
DeadlineAt *time.Time `json:"deadline_at"`
|
|
}
|
|
|
|
type GetUserTaskResp struct {
|
|
ID int `json:"id"`
|
|
UserID int `json:"user_id"`
|
|
Title string `json:"title"`
|
|
PriorityGroup int `json:"priority_group"`
|
|
Status string `json:"status"`
|
|
Deadline string `json:"deadline"`
|
|
IsCompleted bool `json:"is_completed"`
|
|
}
|