You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constsystemInstruction="You are Piko, A Whatsapp chatbot. No need to be formal. Be brief and concise, limit responses to about 40 words if possible. All responses should be formatted to Whatsapp's text-formatting Standards";
asyncfunctionchat(prompt,quotedMessagesArray){
lett=[];
if(!quotedMessagesArray){
t=[
{
role: "user",
content: prompt,
},
]
}else{
t=[...quotedMessagesArray];
t.push({role: "user",content: prompt});
}
constb=awaitcountCharacters(t);
if(b>250){
return"😵💫_*Insufficient Memory*_, Start a new chat with the /chat command"
};
try{
constresponse=awaitai.models.generateContent({
model: "gemini-2.0-flash",
contents: JSON.stringify(t),
config: {
systemInstruction: systemInstruction,
},
});
returnresponse.text;
}catch(error){
console.error("Error in chat function:",error);
return"Sorry, there was an error trying to connect to the AI Service";