feat(health): wire H5 health page, WeChat channel, and observation API.
Expose /health and /api/health/observations behind MEMIND_HEALTH_ENABLED, redirect ordinary chat health intents without persisting, and run a dedicated WeChat menu flow with confirm-before-write semantics. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { apiFetch } from './core';
|
||||
|
||||
export async function listHealthObservations(limit = 50) {
|
||||
const data = await apiFetch(`/health/observations?limit=${limit}`);
|
||||
return Array.isArray(data?.observations) ? data.observations : [];
|
||||
}
|
||||
|
||||
export async function saveConfirmedBloodPressure(input: {
|
||||
systolic: number;
|
||||
diastolic: number;
|
||||
context: 'morning' | 'evening' | 'other';
|
||||
observedAt?: number;
|
||||
}) {
|
||||
return apiFetch('/health/observations', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
confirmed: true,
|
||||
metricSet: 'blood_pressure',
|
||||
systolic: input.systolic,
|
||||
diastolic: input.diastolic,
|
||||
context: input.context,
|
||||
observedAt: input.observedAt ?? Date.now(),
|
||||
source: 'manual',
|
||||
}),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user