-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (24 loc) · 955 Bytes
/
index.js
File metadata and controls
28 lines (24 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
async function populateModelDropdown(url, dropdownId) {
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
const data = await response.json();
const dropdown = document.getElementById(dropdownId);
// Clear the dropdown before adding the new model names
dropdown.innerHTML = '';
data.model_names.forEach(modelName => {
const option = document.createElement('option');
option.text = modelName;
dropdown.add(option);
});
} catch (error) {
console.error('Error fetching model names:', error);
}
}
// Call the async function to populate the dropdown
populateModelDropdown('https://actively-feat-makes-tm.trycloudflare.com:443/get_next_word_models', 'next-word-model-dropdown');
populateModelDropdown('https://actively-feat-makes-tm.trycloudflare.com:443/get_complete_word_models', 'word-comp-model-dropdown');