From 5319d8a5a6c35feea6a15ce68648d38b9a8ec7bd Mon Sep 17 00:00:00 2001 From: Felipe Coutinho Date: Thu, 28 May 2026 10:58:52 -0300 Subject: [PATCH] feat(insights): adiciona suporte ao MiniMax --- public/providers/minimax.svg | 1 + src/features/insights/actions/generate.ts | 3 ++ .../insights/components/insights-page.tsx | 4 +- .../insights/components/model-selector.tsx | 8 ++- src/features/insights/constants.ts | 49 ++++++++++++++++++- 5 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 public/providers/minimax.svg diff --git a/public/providers/minimax.svg b/public/providers/minimax.svg new file mode 100644 index 0000000..7ab8f0b --- /dev/null +++ b/public/providers/minimax.svg @@ -0,0 +1 @@ +MiniMax diff --git a/src/features/insights/actions/generate.ts b/src/features/insights/actions/generate.ts index afa2a31..4ee646c 100644 --- a/src/features/insights/actions/generate.ts +++ b/src/features/insights/actions/generate.ts @@ -5,6 +5,7 @@ import { google } from "@ai-sdk/google"; import { openai } from "@ai-sdk/openai"; import { createOpenRouter } from "@openrouter/ai-sdk-provider"; import { generateObject } from "ai"; +import { minimax } from "vercel-minimax-ai-provider"; import { getUser } from "@/shared/lib/auth/server"; import { type InsightsResponse, @@ -65,6 +66,8 @@ export async function generateInsightsAction( model = anthropic(modelId); } else if (selectedModel?.provider === "google") { model = google(modelId); + } else if (selectedModel?.provider === "minimax") { + model = minimax(modelId); } else { return { success: false, diff --git a/src/features/insights/components/insights-page.tsx b/src/features/insights/components/insights-page.tsx index 86c422a..53dcebf 100644 --- a/src/features/insights/components/insights-page.tsx +++ b/src/features/insights/components/insights-page.tsx @@ -146,12 +146,12 @@ export function InsightsPage({ period, onAnalyze }: InsightsPageProps) { return (
{/* Privacy Warning */} - + Aviso de privacidade: Ao gerar insights, seus dados financeiros serão enviados para o provedor de IA selecionado - (Anthropic, OpenAI, Google ou OpenRouter) para processamento. + (Anthropic, OpenAI, Google, MiniMax ou OpenRouter) para processamento. Certifique-se de que você confia no provedor escolhido antes de prosseguir. diff --git a/src/features/insights/components/model-selector.tsx b/src/features/insights/components/model-selector.tsx index dcff8df..a0112cc 100644 --- a/src/features/insights/components/model-selector.tsx +++ b/src/features/insights/components/model-selector.tsx @@ -41,6 +41,9 @@ const PROVIDER_ICON_PATHS: Record< google: { light: "/providers/gemini.svg", }, + minimax: { + light: "/providers/minimax.svg", + }, openrouter: { light: "/providers/openrouter_light.svg", dark: "/providers/openrouter_dark.svg", @@ -61,7 +64,7 @@ export function ModelSelector({ // Sincronizar customModel quando value mudar (importante para pré-carregamento) useEffect(() => { // Se o value tem "/" é um modelo OpenRouter customizado - if (value.includes("/")) { + if (value.includes("/") || selectedProvider === "openrouter") { setCustomModel(value); setSelectedProvider("openrouter"); } else { @@ -69,7 +72,7 @@ export function ModelSelector({ // Limpar selectedProvider para deixar o useMemo detectar automaticamente setSelectedProvider(null); } - }, [value]); + }, [value, selectedProvider]); // Determinar provider atual baseado no modelo selecionado ou provider manual const currentProvider = useMemo(() => { @@ -97,6 +100,7 @@ export function ModelSelector({ openai: [], anthropic: [], google: [], + minimax: [], openrouter: [], }; diff --git a/src/features/insights/constants.ts b/src/features/insights/constants.ts index 401597a..b3e5655 100644 --- a/src/features/insights/constants.ts +++ b/src/features/insights/constants.ts @@ -1,7 +1,12 @@ /** * Tipos de providers disponíveis */ -export type AIProvider = "openai" | "anthropic" | "google" | "openrouter"; +export type AIProvider = + | "openai" + | "anthropic" + | "google" + | "minimax" + | "openrouter"; /** * Metadados dos providers @@ -22,6 +27,11 @@ export const PROVIDERS = { name: "Gemini", icon: "RiGoogleLine", }, + minimax: { + id: "minimax" as const, + name: "MiniMax", + icon: "RiRobot2Line", + }, openrouter: { id: "openrouter" as const, name: "OpenRouter", @@ -73,6 +83,43 @@ export const AVAILABLE_MODELS = [ name: "Gemini 3.1 Flash Lite", provider: "google" as const, }, + + // MiniMax + { + id: "MiniMax-M2.7", + name: "MiniMax M2.7", + provider: "minimax" as const, + }, + { + id: "MiniMax-M2.7-highspeed", + name: "MiniMax M2.7 Highspeed", + provider: "minimax" as const, + }, + { + id: "MiniMax-M2.5", + name: "MiniMax M2.5", + provider: "minimax" as const, + }, + { + id: "MiniMax-M2.5-highspeed", + name: "MiniMax M2.5 Highspeed", + provider: "minimax" as const, + }, + { + id: "MiniMax-M2.1", + name: "MiniMax M2.1", + provider: "minimax" as const, + }, + { + id: "MiniMax-M2.1-highspeed", + name: "MiniMax M2.1 Highspeed", + provider: "minimax" as const, + }, + { + id: "MiniMax-M2", + name: "MiniMax M2", + provider: "minimax" as const, + }, ] as const; export const DEFAULT_MODEL = "gpt-5.5";