Fix type checks
| @@ -18,6 +18,7 @@ router.post('/models/providers', async (req, res) => { | |||
| 18 | return res.json([]); | 18 | return res.json([]); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | /** @type {any} */ | ||
| 21 | const data = await response.json(); | 22 | const data = await response.json(); |
| 22 | const endpoints = data?.data?.endpoints || []; | 23 | const endpoints = data?.data?.endpoints || []; |
| 23 | const providerNames = endpoints.map(e => e.provider_name); | 24 | const providerNames = endpoints.map(e => e.provider_name); |
| @@ -43,6 +44,7 @@ router.post('/models/multimodal', async (_req, res) => { | |||
| 43 | return res.json([]); | 44 | return res.json([]); |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 47 | /** @type {any} */ | ||
| 46 | const data = await response.json(); | 48 | const data = await response.json(); |
| 47 | const models = data?.data || []; | 49 | const models = data?.data || []; |
| 48 | const multimodalModels = models.filter(m => m?.architecture?.modality === 'text+image->text').map(m => m.id); | 50 | const multimodalModels = models.filter(m => m?.architecture?.modality === 'text+image->text').map(m => m.id); |
| @@ -1025,6 +1025,7 @@ router.post('/remote/kobold/count', async function (request, response) { | |||
| 1025 | return response.send({ error: true }); | 1025 | return response.send({ error: true }); |
| 1026 | } | 1026 | } |
| 1027 | 1027 | ||
| 1028 | /** @type {any} */ | ||
| 1028 | const data = await result.json(); | 1029 | const data = await result.json(); |
| 1029 | const count = data['value']; | 1030 | const count = data['value']; |
| 1030 | const ids = data['ids'] ?? []; | 1031 | const ids = data['ids'] ?? []; |
| @@ -1089,6 +1090,7 @@ router.post('/remote/textgenerationwebui/encode', async function (request, respo | |||
| 1089 | return response.send({ error: true }); | 1090 | return response.send({ error: true }); |
| 1090 | } | 1091 | } |
| 1091 | 1092 | ||
| 1093 | /** @type {any} */ | ||
| 1092 | const data = await result.json(); | 1094 | const data = await result.json(); |
| 1093 | const count = (data?.length ?? data?.count ?? data?.value ?? data?.tokens?.length); | 1095 | const count = (data?.length ?? data?.count ?? data?.value ?? data?.tokens?.length); |
| 1094 | const ids = (data?.tokens ?? data?.ids ?? []); | 1096 | const ids = (data?.tokens ?? data?.ids ?? []); |