mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 14:32:03 +00:00
Merge branch 'v143/ai' into release/v1.43.0
# Conflicts: # docs/api/openapi.yaml # messages/de.json # messages/en.json # messages/es.json # messages/fr.json # messages/it.json # messages/ko.json # messages/pl.json # src/__tests__/contract-stub-inventory.test.ts
This commit is contained in:
commit
fd44a8381b
143 files changed
+4806
-628
No files matched your search
@@ -9,6 +9,7 @@ import type {
|
||||
} from "@/lib/ai/capabilities/types";
|
||||
import { PROVIDER_DEFAULT_TIMEOUT_MS } from "@/lib/ai/effective-timeout";
|
||||
import type { CoachReasoningState } from "@/lib/ai/reasoning/resolve";
|
||||
import type { AiUsageState } from "@/lib/ai/usage-level";
|
||||
|
||||
/**
|
||||
* The web reader for the `ai` block on `GET /api/auth/me`.
|
||||
@@ -85,6 +86,25 @@ function useCoachReasoningInner(): CoachReasoningState | null {
|
||||
return user?.coachReasoning ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* v1.43 (#1217) — the record's AI usage level (`ai.usage` on
|
||||
* `GET /api/auth/me`): the level in effect, the person's choice, the
|
||||
* operator's bounds, the three options with their estimates. `null` while it
|
||||
* is not known or on a server that does not publish it; the setting is then
|
||||
* not shown. Render from it; never compute an estimate or an allowance here.
|
||||
*/
|
||||
export function useAiUsage(): AiUsageState | null {
|
||||
const hasClient = useQueryClientMounted();
|
||||
if (!hasClient) return null;
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
return useAiUsageInner();
|
||||
}
|
||||
|
||||
function useAiUsageInner(): AiUsageState | null {
|
||||
const { user } = useAuth();
|
||||
return user?.ai?.usage ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The server's answer for one capability, or `null` while there is none yet
|
||||
* (`/me` loading, no signed-in account, no query client). For the few places
|
||||
|
||||
Reference in new issue
Block a user