forked from git.gladyson/openmonetis
refactor: migrate from ESLint to Biome and extract SQL queries to data.ts
- Replace ESLint with Biome for linting and formatting - Configure Biome with tabs, double quotes, and organized imports - Move all SQL/Drizzle queries from page.tsx files to data.ts files - Create new data.ts files for: ajustes, dashboard, relatorios/categorias - Update existing data.ts files: extrato, fatura (add lancamentos queries) - Remove all drizzle-orm imports from page.tsx files - Update README.md with new tooling info Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -7,84 +7,84 @@ export type AIProvider = "openai" | "anthropic" | "google" | "openrouter";
|
||||
* Metadados dos providers
|
||||
*/
|
||||
export const PROVIDERS = {
|
||||
openai: {
|
||||
id: "openai" as const,
|
||||
name: "ChatGPT",
|
||||
icon: "RiOpenaiLine",
|
||||
},
|
||||
anthropic: {
|
||||
id: "anthropic" as const,
|
||||
name: "Claude AI",
|
||||
icon: "RiRobot2Line",
|
||||
},
|
||||
google: {
|
||||
id: "google" as const,
|
||||
name: "Gemini",
|
||||
icon: "RiGoogleLine",
|
||||
},
|
||||
openrouter: {
|
||||
id: "openrouter" as const,
|
||||
name: "OpenRouter",
|
||||
icon: "RiRouterLine",
|
||||
},
|
||||
openai: {
|
||||
id: "openai" as const,
|
||||
name: "ChatGPT",
|
||||
icon: "RiOpenaiLine",
|
||||
},
|
||||
anthropic: {
|
||||
id: "anthropic" as const,
|
||||
name: "Claude AI",
|
||||
icon: "RiRobot2Line",
|
||||
},
|
||||
google: {
|
||||
id: "google" as const,
|
||||
name: "Gemini",
|
||||
icon: "RiGoogleLine",
|
||||
},
|
||||
openrouter: {
|
||||
id: "openrouter" as const,
|
||||
name: "OpenRouter",
|
||||
icon: "RiRouterLine",
|
||||
},
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Lista de modelos de IA disponíveis para análise de insights
|
||||
*/
|
||||
export const AVAILABLE_MODELS = [
|
||||
// OpenAI Models - GPT-5.2 Family (Latest)
|
||||
{ id: "gpt-5.2", name: "GPT-5.2", provider: "openai" as const },
|
||||
{
|
||||
id: "gpt-5.2-instant",
|
||||
name: "GPT-5.2 Instant",
|
||||
provider: "openai" as const,
|
||||
},
|
||||
{
|
||||
id: "gpt-5.2-thinking",
|
||||
name: "GPT-5.2 Thinking",
|
||||
provider: "openai" as const,
|
||||
},
|
||||
// OpenAI Models - GPT-5.2 Family (Latest)
|
||||
{ id: "gpt-5.2", name: "GPT-5.2", provider: "openai" as const },
|
||||
{
|
||||
id: "gpt-5.2-instant",
|
||||
name: "GPT-5.2 Instant",
|
||||
provider: "openai" as const,
|
||||
},
|
||||
{
|
||||
id: "gpt-5.2-thinking",
|
||||
name: "GPT-5.2 Thinking",
|
||||
provider: "openai" as const,
|
||||
},
|
||||
|
||||
// OpenAI Models - GPT-5 Family
|
||||
{ id: "gpt-5", name: "GPT-5", provider: "openai" as const },
|
||||
{ id: "gpt-5-instant", name: "GPT-5 Instant", provider: "openai" as const },
|
||||
// OpenAI Models - GPT-5 Family
|
||||
{ id: "gpt-5", name: "GPT-5", provider: "openai" as const },
|
||||
{ id: "gpt-5-instant", name: "GPT-5 Instant", provider: "openai" as const },
|
||||
|
||||
// Anthropic Models - Claude 4.5
|
||||
{
|
||||
id: "claude-4.5-haiku",
|
||||
name: "Claude 4.5 Haiku",
|
||||
provider: "anthropic" as const,
|
||||
},
|
||||
{
|
||||
id: "claude-4.5-sonnet",
|
||||
name: "Claude 4.5 Sonnet",
|
||||
provider: "anthropic" as const,
|
||||
},
|
||||
{
|
||||
id: "claude-opus-4.1",
|
||||
name: "Claude 4.1 Opus",
|
||||
provider: "anthropic" as const,
|
||||
},
|
||||
// Anthropic Models - Claude 4.5
|
||||
{
|
||||
id: "claude-4.5-haiku",
|
||||
name: "Claude 4.5 Haiku",
|
||||
provider: "anthropic" as const,
|
||||
},
|
||||
{
|
||||
id: "claude-4.5-sonnet",
|
||||
name: "Claude 4.5 Sonnet",
|
||||
provider: "anthropic" as const,
|
||||
},
|
||||
{
|
||||
id: "claude-opus-4.1",
|
||||
name: "Claude 4.1 Opus",
|
||||
provider: "anthropic" as const,
|
||||
},
|
||||
|
||||
// Google Models - Gemini 3 (Latest)
|
||||
{
|
||||
id: "gemini-3-flash-preview",
|
||||
name: "Gemini 3 Flash",
|
||||
provider: "google" as const,
|
||||
},
|
||||
{
|
||||
id: "gemini-3-pro-preview",
|
||||
name: "Gemini 3 Pro",
|
||||
provider: "google" as const,
|
||||
},
|
||||
// Google Models - Gemini 3 (Latest)
|
||||
{
|
||||
id: "gemini-3-flash-preview",
|
||||
name: "Gemini 3 Flash",
|
||||
provider: "google" as const,
|
||||
},
|
||||
{
|
||||
id: "gemini-3-pro-preview",
|
||||
name: "Gemini 3 Pro",
|
||||
provider: "google" as const,
|
||||
},
|
||||
|
||||
// Google Models - Gemini 2.0
|
||||
{
|
||||
id: "gemini-2.0-flash",
|
||||
name: "Gemini 2.0 Flash",
|
||||
provider: "google" as const,
|
||||
},
|
||||
// Google Models - Gemini 2.0
|
||||
{
|
||||
id: "gemini-2.0-flash",
|
||||
name: "Gemini 2.0 Flash",
|
||||
provider: "google" as const,
|
||||
},
|
||||
] as const;
|
||||
|
||||
export const DEFAULT_MODEL = "gpt-5.2";
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import PageDescription from "@/components/page-description";
|
||||
import { RiSparklingLine } from "@remixicon/react";
|
||||
import PageDescription from "@/components/page-description";
|
||||
|
||||
export const metadata = {
|
||||
title: "Insights | Opensheets",
|
||||
title: "Insights | Opensheets",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="space-y-6 px-6">
|
||||
<PageDescription
|
||||
icon={<RiSparklingLine />}
|
||||
title="Insights"
|
||||
subtitle="Análise inteligente dos seus dados financeiros para identificar padrões, comportamentos e oportunidades de melhoria."
|
||||
/>
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
return (
|
||||
<section className="space-y-6 px-6">
|
||||
<PageDescription
|
||||
icon={<RiSparklingLine />}
|
||||
title="Insights"
|
||||
subtitle="Análise inteligente dos seus dados financeiros para identificar padrões, comportamentos e oportunidades de melhoria."
|
||||
/>
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,39 +4,36 @@ import { Skeleton } from "@/components/ui/skeleton";
|
||||
* Loading state para a página de insights com IA
|
||||
*/
|
||||
export default function InsightsLoading() {
|
||||
return (
|
||||
<main className="flex flex-col gap-6">
|
||||
<div className="space-y-6">
|
||||
{/* Header */}
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-10 w-64 rounded-2xl bg-foreground/10" />
|
||||
<Skeleton className="h-6 w-96 rounded-2xl bg-foreground/10" />
|
||||
</div>
|
||||
return (
|
||||
<main className="flex flex-col gap-6">
|
||||
<div className="space-y-6">
|
||||
{/* Header */}
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-10 w-64 rounded-2xl bg-foreground/10" />
|
||||
<Skeleton className="h-6 w-96 rounded-2xl bg-foreground/10" />
|
||||
</div>
|
||||
|
||||
{/* Grid de insights */}
|
||||
<div className="grid grid-cols-1 gap-6 lg:grid-cols-2">
|
||||
{Array.from({ length: 4 }).map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="rounded-2xl border p-6 space-y-4"
|
||||
>
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="space-y-2 flex-1">
|
||||
<Skeleton className="h-6 w-48 rounded-2xl bg-foreground/10" />
|
||||
<Skeleton className="h-4 w-full rounded-2xl bg-foreground/10" />
|
||||
<Skeleton className="h-4 w-3/4 rounded-2xl bg-foreground/10" />
|
||||
</div>
|
||||
<Skeleton className="size-8 rounded-full bg-foreground/10" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-3 w-full rounded-2xl bg-foreground/10" />
|
||||
<Skeleton className="h-3 w-full rounded-2xl bg-foreground/10" />
|
||||
<Skeleton className="h-3 w-2/3 rounded-2xl bg-foreground/10" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
{/* Grid de insights */}
|
||||
<div className="grid grid-cols-1 gap-6 lg:grid-cols-2">
|
||||
{Array.from({ length: 4 }).map((_, i) => (
|
||||
<div key={i} className="rounded-2xl border p-6 space-y-4">
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="space-y-2 flex-1">
|
||||
<Skeleton className="h-6 w-48 rounded-2xl bg-foreground/10" />
|
||||
<Skeleton className="h-4 w-full rounded-2xl bg-foreground/10" />
|
||||
<Skeleton className="h-4 w-3/4 rounded-2xl bg-foreground/10" />
|
||||
</div>
|
||||
<Skeleton className="size-8 rounded-full bg-foreground/10" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-3 w-full rounded-2xl bg-foreground/10" />
|
||||
<Skeleton className="h-3 w-full rounded-2xl bg-foreground/10" />
|
||||
<Skeleton className="h-3 w-2/3 rounded-2xl bg-foreground/10" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,27 +5,27 @@ import { parsePeriodParam } from "@/lib/utils/period";
|
||||
type PageSearchParams = Promise<Record<string, string | string[] | undefined>>;
|
||||
|
||||
type PageProps = {
|
||||
searchParams?: PageSearchParams;
|
||||
searchParams?: PageSearchParams;
|
||||
};
|
||||
|
||||
const getSingleParam = (
|
||||
params: Record<string, string | string[] | undefined> | undefined,
|
||||
key: string
|
||||
params: Record<string, string | string[] | undefined> | undefined,
|
||||
key: string,
|
||||
) => {
|
||||
const value = params?.[key];
|
||||
if (!value) return null;
|
||||
return Array.isArray(value) ? value[0] ?? null : value;
|
||||
const value = params?.[key];
|
||||
if (!value) return null;
|
||||
return Array.isArray(value) ? (value[0] ?? null) : value;
|
||||
};
|
||||
|
||||
export default async function Page({ searchParams }: PageProps) {
|
||||
const resolvedSearchParams = searchParams ? await searchParams : undefined;
|
||||
const periodoParam = getSingleParam(resolvedSearchParams, "periodo");
|
||||
const { period: selectedPeriod } = parsePeriodParam(periodoParam);
|
||||
const resolvedSearchParams = searchParams ? await searchParams : undefined;
|
||||
const periodoParam = getSingleParam(resolvedSearchParams, "periodo");
|
||||
const { period: selectedPeriod } = parsePeriodParam(periodoParam);
|
||||
|
||||
return (
|
||||
<main className="flex flex-col gap-6">
|
||||
<MonthNavigation />
|
||||
<InsightsPage period={selectedPeriod} />
|
||||
</main>
|
||||
);
|
||||
return (
|
||||
<main className="flex flex-col gap-6">
|
||||
<MonthNavigation />
|
||||
<InsightsPage period={selectedPeriod} />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user