feat: implement Iteration 1 — AI recipe recommendations
Backend:
- Add Groq LLM client (llama-3.3-70b) for recipe generation with JSON
retry strategy (retries only on parse errors, not API errors)
- Add Pexels client for parallel photo search per recipe
- Add saved_recipes table (migration 004) with JSONB fields
- Add GET /recommendations endpoint (profile-aware prompt building)
- Add POST/GET/GET{id}/DELETE /saved-recipes CRUD endpoints
- Wire gemini, pexels, recommendation, savedrecipe packages in main.go
Flutter:
- Add Recipe, SavedRecipe models with json_serializable
- Add RecipeService (getRecommendations, getSavedRecipes, save, delete)
- Add RecommendationsNotifier and SavedRecipesNotifier (Riverpod)
- Add RecommendationsScreen with skeleton loading and refresh FAB
- Add RecipeDetailScreen (SliverAppBar, nutrition tooltip, steps with timer)
- Add SavedRecipesScreen with Dismissible swipe-to-delete and empty state
- Update RecipesScreen to TabBar (Recommendations / Saved)
- Add /recipe-detail route outside ShellRoute (no bottom nav)
- Extend ApiClient with getList() and deleteVoid()
Project:
- Add CLAUDE.md with English-only rule for comments and commit messages
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
36
client/lib/features/recipes/recipe_service.dart
Normal file
36
client/lib/features/recipes/recipe_service.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import '../../core/api/api_client.dart';
|
||||
import '../../shared/models/recipe.dart';
|
||||
import '../../shared/models/saved_recipe.dart';
|
||||
|
||||
class RecipeService {
|
||||
final ApiClient _apiClient;
|
||||
|
||||
RecipeService(this._apiClient);
|
||||
|
||||
Future<List<Recipe>> getRecommendations({int count = 5}) async {
|
||||
final data = await _apiClient.getList(
|
||||
'/recommendations',
|
||||
params: {'count': '$count'},
|
||||
);
|
||||
return data
|
||||
.map((e) => Recipe.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<List<SavedRecipe>> getSavedRecipes() async {
|
||||
final data = await _apiClient.getList('/saved-recipes');
|
||||
return data
|
||||
.map((e) => SavedRecipe.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<SavedRecipe> saveRecipe(Recipe recipe) async {
|
||||
final body = recipe.toJson()..['source'] = 'ai';
|
||||
final response = await _apiClient.post('/saved-recipes', data: body);
|
||||
return SavedRecipe.fromJson(response);
|
||||
}
|
||||
|
||||
Future<void> deleteSavedRecipe(String id) async {
|
||||
await _apiClient.deleteVoid('/saved-recipes/$id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user