feat: 实现减脂体重管理App完整功能

- 实现拍照识别食物功能(集成大语言模型视觉能力)
- 实现智能对话功能(集成大语言模型流式输出)
- 实现食物记录和卡路里管理功能
- 实现体重记录和统计功能
- 实现健康数据管理页面
- 配置数据库表结构(用户、食物记录、体重记录)
- 实现Express后端API路由
- 配置Tab导航和前端页面
- 采用健康运动配色方案
This commit is contained in:
jaystar
2026-02-02 15:17:50 +08:00
commit 28c4d7b3b4
82 changed files with 21891 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
diff --git a/src/async-require/hmr.ts b/src/async-require/hmr.ts
index 33ce50ee2950c40d2b0553b148710f1e24e44f3d..a13d6f2da10dea858019cc991c21753f64f01fd0 100644
--- a/src/async-require/hmr.ts
+++ b/src/async-require/hmr.ts
@@ -216,6 +216,39 @@ const HMRClient: HMRClientNativeInterface = {
client.on('update-done', () => {
hideLoading();
+ if (process.env.EXPO_PUBLIC_COZE_PROJECT_ID && typeof window !== 'undefined' && window.location) {
+ if((window as any).__updateTimeoutId) {
+ clearTimeout((window as any).__updateTimeoutId);
+ }
+ const updateDoneTime = Date.now();
+ (window as any).__updateDoneTime = updateDoneTime;
+ (window as any).__updateTimeoutId = setTimeout(() => {
+ const lastUpdateTime = (window as any).__updateDoneTime;
+ if (lastUpdateTime !== updateDoneTime) return;
+ const checkServerAndReload = (retriesLeft: number) => {
+ if ((window as any).__updateDoneTime !== updateDoneTime) return;
+ fetch(`/favicon.ico?_t=${Date.now()}`)
+ .then((response) => {
+ if (response.status === 200) {
+ console.warn('[HMR] Server is ready (200), reloading now.');
+ window.location.reload();
+ } else {
+ throw new Error(`Server status: ${response.status}`);
+ }
+ }).catch((error) => {
+ console.warn(`[HMR] Check failed (${error.message}). Retries left: ${retriesLeft}`);
+ if (retriesLeft > 0) {
+ setTimeout(() => {
+ checkServerAndReload(retriesLeft - 1);
+ }, 5000);
+ } else {
+ console.error('[HMR] Server unreachable after 6 attempts. Abort reload.');
+ }
+ });
+ };
+ checkServerAndReload(6);
+ }, 35_000);
+ }
});
client.on('error', (data: { type: string; message: string }) => {