12 lines
518 B
TypeScript
12 lines
518 B
TypeScript
import "server-only";
|
|
import { effectiveAi, loadAi, type AiSettings } from "./ai";
|
|
import { loadInstance } from "./auth/webauthn";
|
|
import { withAuth, withHousehold } from "./db";
|
|
|
|
/** Die geltende AI-Einstellung eines Haushalts (Router als Standard, siehe effectiveAi). */
|
|
export async function aiFor(householdId: string): Promise<AiSettings | null> {
|
|
const stored = await withHousehold(householdId, loadAi);
|
|
const instance = await withAuth(loadInstance);
|
|
return effectiveAi(stored, instance?.origin ?? null);
|
|
}
|