()
| 79 | ]; |
| 80 | }, |
| 81 | async fetchModels() { |
| 82 | const headers = process.env.HF_TOKEN |
| 83 | ? { Authorization: `Bearer ${process.env.HF_TOKEN}` } |
| 84 | : undefined; |
| 85 | const response = await fetch(API_ENDPOINT, { headers }); |
| 86 | if (!response.ok) { |
| 87 | throw new Error(`Hugging Face models request failed: ${response.status} ${response.statusText}`); |
| 88 | } |
| 89 | return response.json(); |
| 90 | }, |
| 91 | parseModels(raw) { |
| 92 | return HuggingFaceResponse.parse(raw).data; |
| 93 | }, |