/*/ Not change any values of the variables below, use the "json/config.json" file to make your settings. /*/ let data_index = ""; let employee_name = ""; let employee_expert = ""; let employee_image = ""; let employee_background_color = ""; let employee_training = ""; let chat_font_size = ""; let dalle_img_size = ""; let CHAT_PHP_url = 'php/api.php'; let DALLE_PHP_url = 'php/dall-e-2.php'; let API_URL = ""; let API_MODEL = ""; let source = ""; let google_voice = ""; let google_voice_lang_code = ""; let microphone_speak_lang = ""; let dalle_generated_img_count = 1; let chat_minlength = 0; let chat_maxlength = 0; let employee_temperature = 1; let employee_frequency_penalty = 0; let employee_presence_penalty = 0; let lang_index = 0; let scrollPosition = 0; let shuffle_character = false; let is_model_turbo = false; let use_text_stream = false; let display_microphone_in_chat = false; let display_avatar_in_chat = false; let display_contacts_user_list = false; let display_copy_text_button_in_chat = false; let filter_badwords = true; let display_audio_button_answers = true; let chat_history = true; let hasBadWord = false; let chat = []; let pmt = []; let array_employees = []; let array_chat = []; let lang = []; let = badWords = [] let array_messages = []; let array_voices = []; let filterBotWords = ["Robot:", "Bot:"]; if (window.location.protocol === 'file:') { alert('This file is not runnable locally, an http server is required, please read the documentation.'); } //Loads the characters from the config.json file and appends them to the initial slider loadData("json/config.json", ["json/employees.json", "json/lang.json", "json/badwords.json"]); function loadData(url, urls) { // Fetch data from the given url and an array of urls using Promise.all and map functions return Promise.all([fetch(url).then(res => res.json()), ...urls.map(url => fetch(url).then(res => res.json()))]) .then(([out, OutC, OutL, OutB]) => { // Extract necessary data from the response lang = OutL; if(filter_badwords){badWords = OutB.badwords.split(',')} lang_index = lang.use_lang_index; use_text_stream = out.use_text_stream; display_avatar_in_chat = out.display_avatar_in_chat; microphone_speak_lang = out.microphone_speak_lang; display_contacts_user_list = out.display_contacts_user_list; filter_badwords = out.filter_badwords; chat_history = out.chat_history; chat_font_size = out.chat_font_size; dalle_img_size = out.dalle_img_size; dalle_generated_img_count = out.dalle_generated_img_count; shuffle_character = out.shuffle_character; function populateSelect(select, options) { select.empty(); $.each(options, function (i, option) { select.append($('