- Alle {schedule.frequencyDays} Tage giessen + {$_('planta.list.everyXDays', { values: { days: schedule.frequencyDays } })}
{/if} diff --git a/apps/mana/apps/web/src/lib/modules/planta/api.ts b/apps/mana/apps/web/src/lib/modules/planta/api.ts new file mode 100644 index 000000000..10e130c34 --- /dev/null +++ b/apps/mana/apps/web/src/lib/modules/planta/api.ts @@ -0,0 +1,71 @@ +/** + * Planta — server-only API client + * + * CRUD lives in IndexedDB + sync. This module talks to mana-api for the + * two server-only operations: photo upload (S3 via mana-media) and AI + * plant identification (Gemini Vision via mana-llm). + */ + +import { authStore } from '$lib/stores/auth.svelte'; +import { getManaApiUrl } from '$lib/api/config'; + +export interface UploadPhotoResult { + storagePath: string; + publicUrl: string; + mediaId: string; + plantId: string | null; +} + +export interface IdentifyResult { + scientificName?: string; + commonNames?: string[]; + confidence?: number; + healthAssessment?: string; + wateringAdvice?: string; + lightAdvice?: string; + generalTips?: string[]; +} + +async function authHeader(): Promise{$_('planta.photo.noPhotos')}
+ {:else} ++ {$_('planta.plant.scientificName')}: + {identifyResult.scientificName} +
+ {/if} + {#if identifyResult.commonNames?.length} +{identifyResult.commonNames.join(', ')}
+ {/if} + {#if identifyResult.confidence !== undefined} ++ {$_('planta.identify.confidence')}: {Math.round(identifyResult.confidence * 100)}% +
+ {/if} + {#if identifyResult.wateringAdvice} +{identifyResult.wateringAdvice}
+ {/if} + {#if identifyResult.lightAdvice} +{identifyResult.lightAdvice}
+ {/if} +