Team Ai
Apppublic

amanm10000/MLSC-Coherence-25-FAQ-Chatbot-API

sourceHugging Facemitupdated 2y agoView on Hugging Face
0likes
ping.gs40 linesDownload Raw Back to root
1function pingChatbot() {2  // Your FastAPI endpoint URL3  var url = "https://amanm10000-mlsc-coherence-25-faq-chatbot-api.hf.space/chat";4  5  // Create query parameters6  var params = {7    "question": "Who are the sponsors baby?"8  };9  10  // Build URL with query parameters11  var queryString = Object.keys(params)12    .map(key => key + '=' + encodeURIComponent(params[key]))13    .join('&');14  var fullUrl = url + '?' + queryString;15  16  // Request options17  var options = {18    "method": "get",19    "muteHttpExceptions": true20  };21  22  try {23    // Make the request24    var response = UrlFetchApp.fetch(fullUrl, options);25    26    // Get response code and content27    var responseCode = response.getResponseCode();28    var responseText = response.getContentText();29    30    // Log the response31    Logger.log("Response Code: " + responseCode);32    Logger.log("Response: " + responseText);33    34    return responseText;35    36  } catch (error) {37    Logger.log("Error: " + error.toString());38    return "Error: " + error.toString();39  }40}