Create Shopping List (Gemini Flash + Todoist)
Target flow:
1) Input is either a photo or a recipe web search
2) Extract ingredients (Gemini Flash for photos; web_fetch text → Gemini for websites)
3) Pull current Todoist Shopping list
4) Compare using overlap + synonym mapping (kept conservative; only merge high-confidence equivalents like coriander↔cilantro, panko↔breadcrumbs)
5) Update Shopping (default: add only missing items; skip salt/pepper)
Use the bundled script to handle the photo → ingredients → Shopping update part.
It also automatically saves a markdown entry into recipes/ (your cookbook knowledge base) and appends to recipes/index.md.
For recipe-name → web search, do it confirm-first using web_search + web_fetch, then feed the ingredients into the same update logic (and save the recipe).
Prereqs
- - Env:
GEMINI_API_KEY (or GOOGLE_API_KEY) for Gemini - Env:
TODOIST_API_TOKEN for Todoist - Bin:
todoist (todoist-ts-cli)
Output formatting
- - Items are reformatted to start with the ingredient name, followed by a parenthetical quantity.
- The Shopping list is kept flat (no Todoist sections/groups).
Run
CODEBLOCK0
Optional flags
- -
--model gemini-2.0-flash (default; falls back automatically) or any compatible Gemini vision model - INLINECODE9 to print extracted items without creating tasks
- INLINECODE10 to prefix each created task
- INLINECODE11 to skip checking your existing Shopping list
- INLINECODE12 to include salt/pepper
- INLINECODE13 to skip saving into INLINECODE14
What to send to the model
The script prompts Gemini to return strict JSON:
CODEBLOCK1
If parsing fails, rerun with a clearer crop (ingredients list only) or provide a manual list.
创建购物清单(Gemini Flash + Todoist)
目标流程:
1) 输入为照片或食谱网页搜索
2) 提取食材(照片使用Gemini Flash;网站使用web_fetch文本→Gemini处理)
3) 拉取当前Todoist购物清单
4) 通过重叠项+同义词映射进行比较(保持保守策略;仅合并高置信度等价项,如香菜↔芫荽、面包糠↔面包屑)
5) 更新购物清单(默认:仅添加缺失项;跳过盐/胡椒)
使用捆绑脚本处理照片→食材→购物清单更新部分。
同时自动保存Markdown条目至recipes/(你的食谱知识库),并追加至recipes/index.md。
对于食谱名称→网页搜索,先使用websearch+webfetch进行确认,然后将食材输入相同的更新逻辑(并保存食谱)。
前置条件
- - 环境变量:GEMINIAPIKEY(或GOOGLEAPIKEY)用于Gemini
- 环境变量:TODOISTAPITOKEN用于Todoist
- 二进制文件:todoist(todoist-ts-cli)
输出格式
- - 项目重新格式化,以食材名称开头,后跟括号内数量。
- 购物清单保持扁平化(无Todoist分区/分组)。
运行
bash
python3 skills/recipe-to-list/scripts/recipetolist.py \
--image /path/to/photo.jpg \
--title <可选标题> \
--source photo:/path/to/photo.jpg
可选参数
- - --model gemini-2.0-flash(默认值;自动回退)或任何兼容的Gemini视觉模型
- --dry-run 打印提取的项目而不创建任务
- --prefix [食谱] 为每个创建的任务添加前缀
- --no-overlap-check 跳过检查现有购物清单
- --include-pantry 包含盐/胡椒
- --no-save 跳过保存至recipes/
发送给模型的内容
脚本提示Gemini返回严格JSON:
json
{
items: [2个大圆茄子, 犹太盐, ...],
notes: 可选
}
如果解析失败,使用更清晰的裁剪(仅食材列表)重新运行,或提供手动列表。