mirror of
https://github.com/PinkSheep27/SBU-Hackathon.git
synced 2026-10-11 00:30:26 -04:00
slight change in the geminiHelper to account for vercel
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user