feat: route invoice analysis through referentiel ia
This commit is contained in:
@@ -9,4 +9,6 @@ export const ENV = {
|
||||
forgeApiKey: process.env.BUILT_IN_FORGE_API_KEY ?? "",
|
||||
mistralApiKey: process.env.MISTRAL_API_KEY ?? "",
|
||||
geminiApiKey: process.env.GEMINI_API_KEY ?? "",
|
||||
referentielIaUrl: process.env.REFERENTIEL_IA_URL ?? "",
|
||||
referentielIaToken: process.env.REFERENTIEL_IA_TOKEN ?? "",
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ENV } from "./env";
|
||||
import { invokeReferentialIa } from "../referentialIa";
|
||||
|
||||
export type Role = "system" | "user" | "assistant" | "tool" | "function";
|
||||
|
||||
@@ -97,8 +98,8 @@ export type InvokeResult = {
|
||||
};
|
||||
};
|
||||
|
||||
export type LlmProvider = "mistral" | "manus" | "gemini";
|
||||
export type LlmTransport = "mistral-api" | "manus-forge" | "gemini-api";
|
||||
export type LlmProvider = "mistral" | "manus" | "gemini" | "referentiel";
|
||||
export type LlmTransport = "mistral-api" | "manus-forge" | "gemini-api" | "referentiel-gateway";
|
||||
|
||||
export type UserLlmSettings = {
|
||||
aiProvider?: string | null;
|
||||
@@ -344,6 +345,9 @@ export function resolveLlmTrace(settings?: UserLlmSettings): ResolvedLlmTrace {
|
||||
if (provider === "gemini") {
|
||||
return { provider: "gemini", model: "gemini-2.0-flash", transport: "gemini-api" };
|
||||
}
|
||||
if (provider === "referentiel") {
|
||||
return { provider: "referentiel", model: "referentiel-ia", transport: "referentiel-gateway" };
|
||||
}
|
||||
return { provider: "mistral", model: "mistral-large-latest", transport: "mistral-api" };
|
||||
}
|
||||
|
||||
@@ -355,14 +359,17 @@ export async function invokeLLMWithUserSettings(
|
||||
params: InvokeParams,
|
||||
userSettings?: UserLlmSettings
|
||||
): Promise<ResolvedLlmInvocation> {
|
||||
const trace = resolveLlmTrace(userSettings);
|
||||
if (trace.provider === "referentiel") {
|
||||
return { response: await invokeReferentialIa(params), trace };
|
||||
}
|
||||
|
||||
const apiKey = getApiKeyWithSettings(userSettings);
|
||||
if (!apiKey || apiKey.trim().length === 0) {
|
||||
throw new Error("Aucune clé API configurée pour le moteur IA sélectionné");
|
||||
}
|
||||
|
||||
const trace = resolveLlmTrace(userSettings);
|
||||
const provider = trace.provider;
|
||||
|
||||
const {
|
||||
messages,
|
||||
tools,
|
||||
|
||||
Reference in New Issue
Block a user