feat(medication): 重构AI分析为结构化展示并支持喝水提醒个性化配置

- 将药品AI分析从Markdown流式输出重构为结构化数据展示(V2)
- 新增适合人群、不适合人群、主要成分、副作用等分类卡片展示
- 优化AI分析UI布局,采用卡片式设计提升可读性
- 新增药品跳过功能,支持用户标记本次用药为已跳过
- 修复喝水提醒逻辑,支持用户开关控制和自定义时间段配置
- 优化个人资料编辑页面键盘适配,避免输入框被遮挡
- 统一API响应码处理,兼容200和0两种成功状态码
- 更新版本号至1.0.28

BREAKING CHANGE: 药品AI分析接口从流式Markdown输出改为结构化JSON格式,旧版本分析结果将不再显示
This commit is contained in:
richarjiang
2025-11-20 10:10:53 +08:00
parent b36922756d
commit 84abfa2506
12 changed files with 913 additions and 293 deletions

View File

@@ -23,6 +23,7 @@ import { createWaterRecordAction } from '@/store/waterSlice';
import { loadActiveFastingSchedule } from '@/utils/fasting';
import { initializeHealthPermissions } from '@/utils/health';
import { MoodNotificationHelpers, NutritionNotificationHelpers, WaterNotificationHelpers } from '@/utils/notificationHelpers';
import { getWaterReminderSettings } from '@/utils/userPreferences';
import { clearPendingWaterRecords, syncPendingWidgetChanges } from '@/utils/widgetDataSync';
import React, { useEffect } from 'react';
import { AppState, AppStateStatus } from 'react-native';
@@ -228,10 +229,23 @@ function Bootstrapper({ children }: { children: React.ReactNode }) {
logger.info('✅ 心情提醒已注册')
),
// 喝水提醒
WaterNotificationHelpers.scheduleRegularWaterReminders(profile.name || '用户').then(() =>
logger.info('✅ 喝水提醒已注册')
),
// 喝水提醒 - 需要先检查设置
getWaterReminderSettings().then(settings => {
if (settings.enabled) {
// 如果使用的是自定义提醒scheduleCustomWaterReminders 会被调用(通常在设置页面保存时)
// 但为了保险起见,这里也可以根据设置类型来决定调用哪个
// 目前逻辑似乎是 scheduleRegularWaterReminders 是默认的/旧的逻辑?
// 查看 notificationHelpers.tsscheduleRegularWaterReminders 是每2小时一次的固定逻辑
// 而 scheduleCustomWaterReminders 是根据用户设置的时间段和间隔
// 如果用户开启了提醒,应该使用 scheduleCustomWaterReminders
WaterNotificationHelpers.scheduleCustomWaterReminders(profile.name || '用户', settings).then(() =>
logger.info('✅ 自定义喝水提醒已注册')
);
} else {
logger.info(' 用户未开启喝水提醒,跳过注册');
}
}),
]);
// 检查断食通知(如果有活跃计划)