fix: 移除过度压缩,VLM 图片质量提升至近乎无损
- 压缩参数改为 2048px/Q92(肉眼无法区分) - VLM 模型锁定 qwen3-vl-plus(中餐识别准确) - 上传限制 20MB,支持 jpg/png/heic - VLM 只负责识图返回结构化 JSON,饮食分析交 DeepSeek
This commit is contained in:
@@ -263,7 +263,7 @@ public static class AiChatEndpoints
|
|||||||
|
|
||||||
// 压缩图片后转 base64(VLM API 有请求体大小限制)
|
// 压缩图片后转 base64(VLM API 有请求体大小限制)
|
||||||
var compressedPath = Path.Combine(uploadsDir, $"compressed_{safeName}");
|
var compressedPath = Path.Combine(uploadsDir, $"compressed_{safeName}");
|
||||||
CompressImage(filePath, compressedPath, maxWidth: 960, quality: 72L);
|
CompressImage(filePath, compressedPath, maxWidth: 2048, quality: 92L);
|
||||||
var compressedBytes = await File.ReadAllBytesAsync(compressedPath, ct);
|
var compressedBytes = await File.ReadAllBytesAsync(compressedPath, ct);
|
||||||
var base64 = Convert.ToBase64String(compressedBytes);
|
var base64 = Convert.ToBase64String(compressedBytes);
|
||||||
imageUrls.Add($"data:image/jpeg;base64,{base64}");
|
imageUrls.Add($"data:image/jpeg;base64,{base64}");
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.2 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
Reference in New Issue
Block a user