()
| 103 | }; |
| 104 | |
| 105 | const loadModels = async () => { |
| 106 | let res = await API.get(`/api/user/models`); |
| 107 | const { success, message, data } = res.data; |
| 108 | if (success) { |
| 109 | const categories = getModelCategories(t); |
| 110 | let localModelOptions = data.map((model) => { |
| 111 | let icon = null; |
| 112 | for (const [key, category] of Object.entries(categories)) { |
| 113 | if (key !== 'all' && category.filter({ model_name: model })) { |
| 114 | icon = category.icon; |
| 115 | break; |
| 116 | } |
| 117 | } |
| 118 | return { |
| 119 | label: ( |
| 120 | <span className="flex items-center gap-1"> |
| 121 | {icon} |
| 122 | {model} |
| 123 | </span> |
| 124 | ), |
| 125 | value: model, |
| 126 | }; |
| 127 | }); |
| 128 | setModels(localModelOptions); |
| 129 | } else { |
| 130 | showError(t(message)); |
| 131 | } |
| 132 | }; |
| 133 | |
| 134 | const loadGroups = async () => { |
| 135 | let res = await API.get(`/api/user/self/groups`); |
no test coverage detected