* Fetch models from a single address
(address: string)
| 306 | * Fetch models from a single address |
| 307 | */ |
| 308 | private async fetchFromAddress(address: string): Promise<Model[]> { |
| 309 | try { |
| 310 | const response = await platformFetch(`${address}/v1/models`, { |
| 311 | method: 'GET', |
| 312 | headers: { 'Content-Type': 'application/json' }, |
| 313 | }); |
| 314 | |
| 315 | if (!response.ok) { |
| 316 | return []; |
| 317 | } |
| 318 | |
| 319 | const data = await response.json(); |
| 320 | const modelData = data.data || []; |
| 321 | |
| 322 | if (!Array.isArray(modelData)) { |
| 323 | return []; |
| 324 | } |
| 325 | |
| 326 | return modelData.map((model: any) => ({ |
| 327 | name: model.id, |
| 328 | parameterSize: model.parameter_size, |
| 329 | multimodal: model.multimodal ?? false, |
| 330 | pro: model.pro ?? false, |
| 331 | server: address, |
| 332 | ownedBy: model.owned_by, |
| 333 | decision: model.decision ?? false, |
| 334 | })); |
| 335 | } catch (error) { |
| 336 | return []; |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | // =========================================================================== |
| 341 | // Server Management |
no test coverage detected