diff --git a/9103.jpg_wh860.jpg b/9103.jpg_wh860.jpg deleted file mode 100644 index da102c3..0000000 Binary files a/9103.jpg_wh860.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/Endpoints/ai_chat_endpoints.cs b/backend/src/Health.WebApi/Endpoints/ai_chat_endpoints.cs index 0f19f3a..a6c5ab2 100644 --- a/backend/src/Health.WebApi/Endpoints/ai_chat_endpoints.cs +++ b/backend/src/Health.WebApi/Endpoints/ai_chat_endpoints.cs @@ -232,7 +232,7 @@ public static class AiChatEndpoints // VLM 食物识别 app.MapPost("/api/ai/analyze-food-image", async ( HttpRequest httpRequest, HttpContext http, - QwenVisionClient visionClient, AppDbContext db, + VisionClient visionClient, AppDbContext db, CancellationToken ct) => { var userId = GetUserId(http); @@ -242,8 +242,6 @@ public static class AiChatEndpoints var files = form.Files.GetFiles("images"); if (files == null || files.Count == 0) return Results.Ok(new { code = 40001, data = (object?)null, message = "请上传至少一张图片" }); - if (files.Count > 8) - return Results.Ok(new { code = 40001, data = (object?)null, message = "一次最多上传 8 张图片" }); var imageUrls = new List(); var uploadsDir = Path.Combine(Directory.GetCurrentDirectory(), "uploads"); @@ -272,19 +270,9 @@ public static class AiChatEndpoints } var prompt = """ - 你是一个专业营养师。请仔细分析这些食物照片(可能是同一餐不同角度拍摄)。 - - 要求: - 1. 识别所有食物,用中文名称 - 2. 根据多角度照片综合判断份量,尽量精准 - 3. 估算每项的热量、蛋白质、碳水、脂肪(克) - - 只返回JSON: + 识别图片中所有食物,用中文名称,只返回JSON: { - "foods": [ - {"name":"食物名","portion":"份量描述","calories":整数,"proteinGrams":整数,"carbsGrams":整数,"fatGrams":整数} - ], - "totalCalories":整数 + "foods": [{"name":"食物名","portion":"份量","calories":整数}] } """; diff --git a/backend/src/Health.WebApi/Program.cs b/backend/src/Health.WebApi/Program.cs index 1329c34..54c7fc3 100644 --- a/backend/src/Health.WebApi/Program.cs +++ b/backend/src/Health.WebApi/Program.cs @@ -73,10 +73,10 @@ builder.Services.AddHttpClient(client => client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", builder.Configuration["DEEPSEEK_API_KEY"] ?? ""); client.Timeout = TimeSpan.FromSeconds(60); }); -builder.Services.AddHttpClient(client => +builder.Services.AddHttpClient(client => { - client.BaseAddress = new Uri((builder.Configuration["QWEN_BASE_URL"] ?? "https://dashscope.aliyuncs.com/compatible-mode/v1").TrimEnd('/') + "/"); - client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", builder.Configuration["QWEN_API_KEY"] ?? ""); + client.BaseAddress = new Uri((builder.Configuration["VLM_BASE_URL"] ?? "https://dashscope.aliyuncs.com/compatible-mode/v1").TrimEnd('/') + "/"); + client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", builder.Configuration["VLM_API_KEY"] ?? ""); client.Timeout = TimeSpan.FromSeconds(60); }); diff --git a/backend/src/Health.WebApi/uploads/0dbdfe79-c3b0-4a93-8534-47dbe14f3543_test_9103.jpg b/backend/src/Health.WebApi/uploads/0dbdfe79-c3b0-4a93-8534-47dbe14f3543_test_9103.jpg deleted file mode 100644 index da102c3..0000000 Binary files a/backend/src/Health.WebApi/uploads/0dbdfe79-c3b0-4a93-8534-47dbe14f3543_test_9103.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/17afba67-efe1-4cfe-8b7c-aa795695aaef_test_food.jpg b/backend/src/Health.WebApi/uploads/17afba67-efe1-4cfe-8b7c-aa795695aaef_test_food.jpg deleted file mode 100644 index 5492407..0000000 Binary files a/backend/src/Health.WebApi/uploads/17afba67-efe1-4cfe-8b7c-aa795695aaef_test_food.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/1c648875-1276-4068-bed8-8224ab984f9f_ʳ������һ����������.png b/backend/src/Health.WebApi/uploads/1c648875-1276-4068-bed8-8224ab984f9f_ʳ������һ����������.png deleted file mode 100644 index 37b003f..0000000 Binary files a/backend/src/Health.WebApi/uploads/1c648875-1276-4068-bed8-8224ab984f9f_ʳ������һ����������.png and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/23f701f4-e4fe-4ea0-a7c8-fe6aaa23dc22_ʳ������һ����������.png b/backend/src/Health.WebApi/uploads/23f701f4-e4fe-4ea0-a7c8-fe6aaa23dc22_ʳ������һ����������.png deleted file mode 100644 index 37b003f..0000000 Binary files a/backend/src/Health.WebApi/uploads/23f701f4-e4fe-4ea0-a7c8-fe6aaa23dc22_ʳ������һ����������.png and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/3307eab2-01cc-47f0-bd20-bc646b394374_test_food.jpg b/backend/src/Health.WebApi/uploads/3307eab2-01cc-47f0-bd20-bc646b394374_test_food.jpg deleted file mode 100644 index 5492407..0000000 Binary files a/backend/src/Health.WebApi/uploads/3307eab2-01cc-47f0-bd20-bc646b394374_test_food.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/44a0ff7d-ce0c-460e-a557-74d655da1406_ft_q55.jpg b/backend/src/Health.WebApi/uploads/44a0ff7d-ce0c-460e-a557-74d655da1406_ft_q55.jpg deleted file mode 100644 index 261fb38..0000000 Binary files a/backend/src/Health.WebApi/uploads/44a0ff7d-ce0c-460e-a557-74d655da1406_ft_q55.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/49cd030b-0713-46eb-ae82-db2e60de7a19_ʳ������һ����������.png b/backend/src/Health.WebApi/uploads/49cd030b-0713-46eb-ae82-db2e60de7a19_ʳ������һ����������.png deleted file mode 100644 index 37b003f..0000000 Binary files a/backend/src/Health.WebApi/uploads/49cd030b-0713-46eb-ae82-db2e60de7a19_ʳ������һ����������.png and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/5b23688a-2eeb-4ecf-9d51-23ccdeb612c9_ʳ������һ����������.png b/backend/src/Health.WebApi/uploads/5b23688a-2eeb-4ecf-9d51-23ccdeb612c9_ʳ������һ����������.png deleted file mode 100644 index 37b003f..0000000 Binary files a/backend/src/Health.WebApi/uploads/5b23688a-2eeb-4ecf-9d51-23ccdeb612c9_ʳ������һ����������.png and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/77ce2c3a-ac17-417c-8639-746aa478fc55_test_9103.jpg b/backend/src/Health.WebApi/uploads/77ce2c3a-ac17-417c-8639-746aa478fc55_test_9103.jpg deleted file mode 100644 index da102c3..0000000 Binary files a/backend/src/Health.WebApi/uploads/77ce2c3a-ac17-417c-8639-746aa478fc55_test_9103.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/7e00bac6-be9c-4d81-9dcd-38e9866f4343_test_food.png b/backend/src/Health.WebApi/uploads/7e00bac6-be9c-4d81-9dcd-38e9866f4343_test_food.png deleted file mode 100644 index 37b003f..0000000 Binary files a/backend/src/Health.WebApi/uploads/7e00bac6-be9c-4d81-9dcd-38e9866f4343_test_food.png and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/7f16b7d0-e132-4f43-bfc1-60a4c1d47379_test_food_hq.jpg b/backend/src/Health.WebApi/uploads/7f16b7d0-e132-4f43-bfc1-60a4c1d47379_test_food_hq.jpg deleted file mode 100644 index 87118a5..0000000 Binary files a/backend/src/Health.WebApi/uploads/7f16b7d0-e132-4f43-bfc1-60a4c1d47379_test_food_hq.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/8b701209-db31-46bc-8e9e-e8c7af4cb9cf_test_food.png b/backend/src/Health.WebApi/uploads/8b701209-db31-46bc-8e9e-e8c7af4cb9cf_test_food.png deleted file mode 100644 index 37b003f..0000000 Binary files a/backend/src/Health.WebApi/uploads/8b701209-db31-46bc-8e9e-e8c7af4cb9cf_test_food.png and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/96c66435-90d6-4aa3-b213-b8586f40a391_food_test.jpg b/backend/src/Health.WebApi/uploads/96c66435-90d6-4aa3-b213-b8586f40a391_food_test.jpg deleted file mode 100644 index 5c52bb3..0000000 Binary files a/backend/src/Health.WebApi/uploads/96c66435-90d6-4aa3-b213-b8586f40a391_food_test.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/9b0800a5-27d7-4ad6-a43a-6ba9bb9ac9f7_test_9103.jpg b/backend/src/Health.WebApi/uploads/9b0800a5-27d7-4ad6-a43a-6ba9bb9ac9f7_test_9103.jpg deleted file mode 100644 index da102c3..0000000 Binary files a/backend/src/Health.WebApi/uploads/9b0800a5-27d7-4ad6-a43a-6ba9bb9ac9f7_test_9103.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/ad73133d-1be7-4a2a-b627-c1344f95c429_test_9103.jpg b/backend/src/Health.WebApi/uploads/ad73133d-1be7-4a2a-b627-c1344f95c429_test_9103.jpg deleted file mode 100644 index da102c3..0000000 Binary files a/backend/src/Health.WebApi/uploads/ad73133d-1be7-4a2a-b627-c1344f95c429_test_9103.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/c0630e4d-a076-4286-a595-d3ef58f13b3d_test_9103.jpg b/backend/src/Health.WebApi/uploads/c0630e4d-a076-4286-a595-d3ef58f13b3d_test_9103.jpg deleted file mode 100644 index da102c3..0000000 Binary files a/backend/src/Health.WebApi/uploads/c0630e4d-a076-4286-a595-d3ef58f13b3d_test_9103.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/c145365a-5533-47f3-8a73-3e653b15461b_test_food_mid.jpg b/backend/src/Health.WebApi/uploads/c145365a-5533-47f3-8a73-3e653b15461b_test_food_mid.jpg deleted file mode 100644 index 3f8d1ee..0000000 Binary files a/backend/src/Health.WebApi/uploads/c145365a-5533-47f3-8a73-3e653b15461b_test_food_mid.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/compressed_0dbdfe79-c3b0-4a93-8534-47dbe14f3543_test_9103.jpg b/backend/src/Health.WebApi/uploads/compressed_0dbdfe79-c3b0-4a93-8534-47dbe14f3543_test_9103.jpg deleted file mode 100644 index e684337..0000000 Binary files a/backend/src/Health.WebApi/uploads/compressed_0dbdfe79-c3b0-4a93-8534-47dbe14f3543_test_9103.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/compressed_1c648875-1276-4068-bed8-8224ab984f9f_ʳ������һ����������.png b/backend/src/Health.WebApi/uploads/compressed_1c648875-1276-4068-bed8-8224ab984f9f_ʳ������һ����������.png deleted file mode 100644 index d83aa7b..0000000 Binary files a/backend/src/Health.WebApi/uploads/compressed_1c648875-1276-4068-bed8-8224ab984f9f_ʳ������һ����������.png and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/compressed_23f701f4-e4fe-4ea0-a7c8-fe6aaa23dc22_ʳ������һ����������.png b/backend/src/Health.WebApi/uploads/compressed_23f701f4-e4fe-4ea0-a7c8-fe6aaa23dc22_ʳ������һ����������.png deleted file mode 100644 index d83aa7b..0000000 Binary files a/backend/src/Health.WebApi/uploads/compressed_23f701f4-e4fe-4ea0-a7c8-fe6aaa23dc22_ʳ������һ����������.png and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/compressed_49cd030b-0713-46eb-ae82-db2e60de7a19_ʳ������һ����������.png b/backend/src/Health.WebApi/uploads/compressed_49cd030b-0713-46eb-ae82-db2e60de7a19_ʳ������һ����������.png deleted file mode 100644 index d83aa7b..0000000 Binary files a/backend/src/Health.WebApi/uploads/compressed_49cd030b-0713-46eb-ae82-db2e60de7a19_ʳ������һ����������.png and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/compressed_5b23688a-2eeb-4ecf-9d51-23ccdeb612c9_ʳ������һ����������.png b/backend/src/Health.WebApi/uploads/compressed_5b23688a-2eeb-4ecf-9d51-23ccdeb612c9_ʳ������һ����������.png deleted file mode 100644 index dc69862..0000000 Binary files a/backend/src/Health.WebApi/uploads/compressed_5b23688a-2eeb-4ecf-9d51-23ccdeb612c9_ʳ������һ����������.png and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/compressed_77ce2c3a-ac17-417c-8639-746aa478fc55_test_9103.jpg b/backend/src/Health.WebApi/uploads/compressed_77ce2c3a-ac17-417c-8639-746aa478fc55_test_9103.jpg deleted file mode 100644 index e684337..0000000 Binary files a/backend/src/Health.WebApi/uploads/compressed_77ce2c3a-ac17-417c-8639-746aa478fc55_test_9103.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/compressed_9b0800a5-27d7-4ad6-a43a-6ba9bb9ac9f7_test_9103.jpg b/backend/src/Health.WebApi/uploads/compressed_9b0800a5-27d7-4ad6-a43a-6ba9bb9ac9f7_test_9103.jpg deleted file mode 100644 index e684337..0000000 Binary files a/backend/src/Health.WebApi/uploads/compressed_9b0800a5-27d7-4ad6-a43a-6ba9bb9ac9f7_test_9103.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/compressed_ad73133d-1be7-4a2a-b627-c1344f95c429_test_9103.jpg b/backend/src/Health.WebApi/uploads/compressed_ad73133d-1be7-4a2a-b627-c1344f95c429_test_9103.jpg deleted file mode 100644 index e684337..0000000 Binary files a/backend/src/Health.WebApi/uploads/compressed_ad73133d-1be7-4a2a-b627-c1344f95c429_test_9103.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/compressed_c0630e4d-a076-4286-a595-d3ef58f13b3d_test_9103.jpg b/backend/src/Health.WebApi/uploads/compressed_c0630e4d-a076-4286-a595-d3ef58f13b3d_test_9103.jpg deleted file mode 100644 index e684337..0000000 Binary files a/backend/src/Health.WebApi/uploads/compressed_c0630e4d-a076-4286-a595-d3ef58f13b3d_test_9103.jpg and /dev/null differ diff --git a/backend/src/Health.WebApi/uploads/dd601a6e-f5d8-4502-8070-98e61011c67a_test_food.png b/backend/src/Health.WebApi/uploads/dd601a6e-f5d8-4502-8070-98e61011c67a_test_food.png deleted file mode 100644 index 37b003f..0000000 Binary files a/backend/src/Health.WebApi/uploads/dd601a6e-f5d8-4502-8070-98e61011c67a_test_food.png and /dev/null differ diff --git a/backend/uploads/food_test.jpg b/backend/uploads/food_test.jpg deleted file mode 100644 index 5c52bb3..0000000 Binary files a/backend/uploads/food_test.jpg and /dev/null differ diff --git a/backend/uploads/ft_q50.jpg b/backend/uploads/ft_q50.jpg deleted file mode 100644 index c7fae0c..0000000 Binary files a/backend/uploads/ft_q50.jpg and /dev/null differ diff --git a/backend/uploads/ft_q55.jpg b/backend/uploads/ft_q55.jpg deleted file mode 100644 index 261fb38..0000000 Binary files a/backend/uploads/ft_q55.jpg and /dev/null differ diff --git a/backend/uploads/test_9103.jpg b/backend/uploads/test_9103.jpg deleted file mode 100644 index da102c3..0000000 Binary files a/backend/uploads/test_9103.jpg and /dev/null differ diff --git a/backend/uploads/test_food.jpg b/backend/uploads/test_food.jpg deleted file mode 100644 index 5492407..0000000 Binary files a/backend/uploads/test_food.jpg and /dev/null differ diff --git a/backend/uploads/test_food.png b/backend/uploads/test_food.png deleted file mode 100644 index 37b003f..0000000 Binary files a/backend/uploads/test_food.png and /dev/null differ diff --git a/backend/uploads/test_food_hq.jpg b/backend/uploads/test_food_hq.jpg deleted file mode 100644 index 87118a5..0000000 Binary files a/backend/uploads/test_food_hq.jpg and /dev/null differ diff --git a/backend/uploads/test_food_mid.jpg b/backend/uploads/test_food_mid.jpg deleted file mode 100644 index 3f8d1ee..0000000 Binary files a/backend/uploads/test_food_mid.jpg and /dev/null differ diff --git a/backend/uploads/test_food_small.png b/backend/uploads/test_food_small.png deleted file mode 100644 index b763f07..0000000 Binary files a/backend/uploads/test_food_small.png and /dev/null differ diff --git a/食堂三菜一饭热量估算.png b/食堂三菜一饭热量估算.png deleted file mode 100644 index 37b003f..0000000 Binary files a/食堂三菜一饭热量估算.png and /dev/null differ