42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
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 TextFoodAnalysisRequest = {
|
|
text: 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);
|
|
}
|
|
|
|
export async function analyzeFoodFromText(request: TextFoodAnalysisRequest): Promise<FoodRecognitionResponse> {
|
|
return api.post<FoodRecognitionResponse>('/ai-coach/text-food-analysis', request);
|
|
} |