- Implemented FoodCameraScreen for capturing food images with meal type selection. - Created FoodRecognitionScreen for processing and recognizing food images. - Added Redux slice for managing food recognition state and results. - Integrated image upload functionality to cloud storage. - Enhanced UI components for better user experience during food recognition. - Updated FloatingFoodOverlay to navigate to the new camera screen. - Added food recognition service for API interaction. - Improved styling and layout for various components.
34 lines
799 B
TypeScript
34 lines
799 B
TypeScript
import { api } from '@/services/api';
|
|
|
|
export type FoodNutritionData = {
|
|
proteinGrams?: number;
|
|
carbohydrateGrams?: number;
|
|
fatGrams?: number;
|
|
fiberGrams?: number;
|
|
};
|
|
|
|
export type FoodConfirmationOption = {
|
|
id: string;
|
|
label: string;
|
|
foodName: string;
|
|
portion: string;
|
|
calories: number;
|
|
mealType: string;
|
|
nutritionData: FoodNutritionData;
|
|
};
|
|
|
|
export type FoodRecognitionRequest = {
|
|
imageUrls: string[];
|
|
};
|
|
|
|
export type FoodRecognitionResponse = {
|
|
items: FoodConfirmationOption[];
|
|
analysisText: string;
|
|
confidence: number;
|
|
isFoodDetected: boolean;
|
|
nonFoodMessage?: string;
|
|
};
|
|
|
|
export async function recognizeFood(request: FoodRecognitionRequest): Promise<FoodRecognitionResponse> {
|
|
return api.post<FoodRecognitionResponse>('/ai-coach/food-recognition', request);
|
|
} |