ChefBear Data Flow
ChefBear 数据流架构
End-to-end architecture — from menu photo to AI self-improvement
全链路架构 — 从拍照到 AI 自学习的完整数据流
User Action
用户操作
AI / LLM
AI / LLM
Image Gen
图像生成
Storage
存储
External
外部服务
Feedback Loop
反馈回路
photo
image+text
fallback
OCR text → LLM parse
structured JSON
menu items
dish names
items + profile
personalized reviews
food images
add to cart
place order
star dishes
infer taste
FEEDBACK LOOP
API keys
entitlements
save order
cache images
📷
Camera / Gallery
User captures menu photo
USER ACTION
🖼
Image Preprocessing
CLAHE + Otsu binarization
Enhances contrast for OCR accuracy
✨
LLM Structuring
Extract name, price, category,
translations, dietary flags
OpenAI · Gemini
👁
Vision API
GPT-5.4 / Gemini 3 vision
Image → structured menu JSON
PRIMARY PATH
🔍
ML Kit OCR
On-device text extraction
+ Language detection
FALLBACK PATH
💾
SQLite Database
menu_recognitions · menu_items · orders · api_usage_log
Indexed: recognitionId, createdAt, isStarred — Paginated queries (20/page)
🌟
AI Recommendations
Personalized dish reviews
based on user taste profile
GPT-5.4 · Gemini 3
📋
Menu Display
Cards with AI images, prices,
translations, reviews, filters
MenuItemsPage
🎨
AI Image Generation
Food photography per dish
English prompts, 30° angle
Fal AI (flux-schnell) · Runware
🛒
Cart & Orders
Quantity controls, total price calc
Place order → persist to SQLite
📚
History & Orders
Paginated scan history, order details,
swipe-to-delete
⭐
Starred Items
User's favorite dishes
🧠
User Taste Profile
Inferred: category affinity, spice tolerance,
vegetarian %, avg price, tag frequency
EXPLICIT SLIDERS + INFERRED FROM STARS · 1hr TTL
📁
File Cache
SHA256 hash, 7d TTL
🔥
Firebase
Auth · Remote Config · Crashlytics
API key distribution · Error reporting
💳
RevenueCat
Subscriptions & paywall
iOS IAP · Firebase UID sync
📊
API Usage Logger
Tracks calls, latency, tokens, cost
All providers · Persisted in SQLite
~$0.03
~$0.005
~$0.003
CAPTURE
RECOGNIZE
STORE
ENRICH
ORDER
HISTORY
LEARN
EXTERNAL
AI SELF-IMPROVEMENT
Stars + Orders → Profile → Better AI Picks
照片
图片+文字
降级
OCR 文字 → LLM 解析
结构化 JSON
菜品数据
菜名
菜品 + 偏好
智能点评
菜品图片
加入购物车
下单
收藏菜品
推断口味
反馈闭环
API 密钥
订阅权益
保存订单
缓存图片
📷
拍照 / 相册
用户拍摄菜单照片
用户操作
🖼
图像预处理
CLAHE + Otsu 二值化
增强对比度以提高 OCR 精度
✨
LLM 结构化
提取菜名、价格、分类、
翻译、饮食标记
OpenAI · Gemini
👁
视觉 API
GPT-5.4 / Gemini 3 视觉模型
图像 → 结构化菜单 JSON
主链路
🔍
ML Kit OCR
端侧文字提取
+ 语言检测
备用链路
💾
SQLite 数据库
menu_recognitions · menu_items · orders · api_usage_log
索引:recognitionId, createdAt, isStarred — 分页查询 (20/页)
🌟
AI 推荐
智能菜品点评
基于用户口味画像
GPT-5.4 · Gemini 3
📋
菜单展示
AI 图片卡片、价格、
翻译、评价、筛选
MenuItemsPage
🎨
AI 图片生成
每道菜的 AI 摄影图
英文提示词,30° 俯拍视角
Fal AI (flux-schnell) · Runware
🛒
购物车与下单
数量调整,自动合计
下单 → 存入 SQLite
📚
历史与订单
分页扫描记录、订单详情、
滑动删除
⭐
收藏菜品
用户收藏的菜品
🧠
用户口味画像
推断:菜系偏好、辣度耐受、
素食比例、均价、标签频次
手动偏好 + 收藏行为推断 · 1 小时缓存
📁
文件缓存
SHA256 哈希,7 天有效
🔥
Firebase
认证 · 远程配置 · 崩溃分析
API 密钥分发 · 错误上报
💳
RevenueCat
订阅与付费墙
iOS 内购 · Firebase UID 同步
📊
API 用量日志
追踪调用、延迟、Token、成本
所有供应商 · 存入 SQLite
~$0.03
~$0.005
~$0.003
采集
识别
存储
增强
下单
历史
学习
外部
AI 自学习闭环
收藏 + 下单 → 口味画像 → 推荐更准