feat(ai): dashboard chat widget with invoice import + budget indicator

This commit is contained in:
BOHA
2026-06-08 14:52:52 +02:00
parent ec74ded953
commit b665ea1d9b
3 changed files with 357 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { queryOptions } from "@tanstack/react-query";
import { jsonQuery } from "../apiAdapter";
export interface AiUsage {
configured: boolean;
month_spend_usd: number;
budget_usd: number;
remaining_usd: number;
}
export interface ExtractedInvoice {
supplier_name: string;
invoice_number: string | null;
amount: number;
currency: string;
vat_rate: number;
issue_date: string | null;
due_date: string | null;
description: string | null;
}
export const aiUsageOptions = () =>
queryOptions({
queryKey: ["ai", "usage"],
queryFn: () => jsonQuery<AiUsage>("/api/admin/ai/usage"),
staleTime: 30_000,
});