slight change in the geminiHelper to account for vercel

This commit is contained in:
Ivan Rudik
2025-11-09 12:34:18 +00:00
parent cd28b6ca93
commit 1668609746
+11 -3
View File
@@ -9,18 +9,26 @@ if (!apiKey) {
const genAI = new GoogleGenerativeAI(apiKey); const genAI = new GoogleGenerativeAI(apiKey);
const DEFAULT_CHAT_SETTINGS: ChatSetting = {
model: "gemini-2.5-flash-lite",
systemInstructions: "you are going to create a project idea, explain it in summary first before going to detail",
temperature: 1
};
export async function chatToGemini( export async function chatToGemini(
userMessage:string , userMessage:string ,
history:ChatHistory, history:ChatHistory,
settings:ChatSetting settings:ChatSetting
):Promise<string>{ ):Promise<string>{
const effectiveSettings = { ...DEFAULT_CHAT_SETTINGS, ...settings };
const model = genAI.getGenerativeModel({ const model = genAI.getGenerativeModel({
model:settings.model || "gemini-2.5-flash-lite", model: effectiveSettings.model,
systemInstruction: settings.systemInstructions || "you are going to create a project idea, explain it in summary first before going to detail", systemInstruction: effectiveSettings.systemInstructions,
}); });
const generationConfig:GenerateConfig = { const generationConfig:GenerateConfig = {
temperature : settings.temperature || 1, temperature : effectiveSettings.temperature,
topP : 0.9, topP : 0.9,
responseMimeType: "text/plain", responseMimeType: "text/plain",
maxOutputTokens: 1900, // Increased to allow for longer responses maxOutputTokens: 1900, // Increased to allow for longer responses