MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / getOptions

Function getOptions

web/src/components/settings/RateLimitSetting.js:20–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18 let [loading, setLoading] = useState(false);
19
20 const getOptions = async () => {
21 const res = await API.get('/api/option/');
22 const { success, message, data } = res.data;
23 if (success) {
24 let newInputs = {};
25 data.forEach((item) => {
26 if (item.key === 'ModelRequestRateLimitGroup') {
27 item.value = JSON.stringify(JSON.parse(item.value), null, 2);
28 }
29
30 if (item.key.endsWith('Enabled')) {
31 newInputs[item.key] = toBoolean(item.value);
32 } else {
33 newInputs[item.key] = item.value;
34 }
35 });
36
37 setInputs(newInputs);
38 } else {
39 showError(message);
40 }
41 };
42 async function onRefresh() {
43 try {
44 setLoading(true);

Callers 1

onRefreshFunction · 0.70

Calls 2

toBooleanFunction · 0.90
showErrorFunction · 0.90

Tested by

no test coverage detected