(req, res)
| 21 | } |
| 22 | |
| 23 | const handleGetModels = async (req, res) => { |
| 24 | const models = [] |
| 25 | |
| 26 | const ModelsMap = await getLatestModels() |
| 27 | |
| 28 | for (const model of ModelsMap) { |
| 29 | models.push(buildPublicModelData(model)) |
| 30 | |
| 31 | if (config.simpleModelMap) { |
| 32 | continue |
| 33 | } |
| 34 | |
| 35 | const isThinking = model?.info?.meta?.abilities?.thinking |
| 36 | const isSearch = model?.info?.meta?.chat_type?.includes('search') |
| 37 | const isImage = model?.info?.meta?.chat_type?.includes('t2i') |
| 38 | const isVideo = model?.info?.meta?.chat_type?.includes('t2v') |
| 39 | const isImageEdit = model?.info?.meta?.chat_type?.includes('image_edit') |
| 40 | |
| 41 | if (isThinking) { |
| 42 | models.push(buildPublicModelData(model, '-thinking')) |
| 43 | } |
| 44 | |
| 45 | if (isSearch) { |
| 46 | models.push(buildPublicModelData(model, '-search')) |
| 47 | } |
| 48 | |
| 49 | if (isThinking && isSearch) { |
| 50 | models.push(buildPublicModelData(model, '-thinking-search')) |
| 51 | } |
| 52 | |
| 53 | if (isImage) { |
| 54 | models.push(buildPublicModelData(model, '-image')) |
| 55 | } |
| 56 | |
| 57 | if (isVideo) { |
| 58 | models.push(buildPublicModelData(model, '-video')) |
| 59 | } |
| 60 | |
| 61 | if (isImageEdit) { |
| 62 | models.push(buildPublicModelData(model, '-image-edit')) |
| 63 | } |
| 64 | |
| 65 | } |
| 66 | res.json({ |
| 67 | "object": "list", |
| 68 | "data": models |
| 69 | }) |
| 70 | } |
| 71 | |
| 72 | module.exports = { |
| 73 | handleGetModels |
| 74 | } |
nothing calls this directly
no test coverage detected