mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-06-09 23:06:01 +00:00
feat(insights): adiciona suporte ao MiniMax
This commit is contained in:
1
public/providers/minimax.svg
Normal file
1
public/providers/minimax.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>MiniMax</title><defs><linearGradient id="lobe-icons-minimax-gradient" x1="0%" x2="100.182%" y1="50.057%" y2="50.057%"><stop offset="0%" stop-color="#E2167E"/><stop offset="100%" stop-color="#FE603C"/></linearGradient></defs><path d="M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z" fill="url(#lobe-icons-minimax-gradient)" fill-rule="nonzero"/></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -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,
|
||||
|
||||
@@ -146,12 +146,12 @@ export function InsightsPage({ period, onAnalyze }: InsightsPageProps) {
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
{/* Privacy Warning */}
|
||||
<Alert className="border-none bg-primary/15">
|
||||
<Alert className="border-none bg-primary/10">
|
||||
<RiAlertLine className="size-4" color="red" />
|
||||
<AlertDescription className="text-sm text-card-foreground">
|
||||
<strong>Aviso de privacidade:</strong> 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.
|
||||
</AlertDescription>
|
||||
|
||||
@@ -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: [],
|
||||
};
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user