ChatUNIBISA


async function sendMessage() {
const prompt = document.getElementById(«userInput»).value;
const response = await fetch(«https://api.openai.com/v1/chat/completions», {
method: «POST»,
headers: {
«Authorization»: «sk-proj-KmKGVYsJoUskBvoNi7sAGWu4Q9qysS3I_xIrIbAgGtnLwC9M05t29le6sdM_LX5dYHLpHWnMFrT3BlbkFJ9zfqHwMVIfj4a5_F0LHDcUeYWEx-eCn7jJ8–WL_LmH6Uo6_-eo0sb8VHNEdX3PKPwIwDMZyMA»,
«Content-Type»: «application/json»
},
body: JSON.stringify({
model: «gpt-4»,
messages: [{ role: «user», content: prompt }]
})
});
const data = await response.json();
document.getElementById(«messages»).innerHTML += `

${data.choices[0].message.content}

`;
}

©2025 UNIBISA WordPress Video Theme by WPEnjoy