(provider, useCache = true)
| 86869 | return `${days} day${days === 1 ? "" : "s"} ago`; |
| 86870 | } else if (hours > 0) { |
| 86871 | return `${hours} hour${hours === 1 ? "" : "s"} ago`; |
| 86872 | } else if (minutes > 0) { |
| 86873 | return `${minutes} minute${minutes === 1 ? "" : "s"} ago`; |
| 86874 | } |
| 86875 | return "just now"; |
| 86876 | } |
| 86877 | async function listModels(provider, useCache = true) { |
| 86878 | const config8 = getConfig(); |
| 86879 | const apiKey = config8.OCO_API_KEY; |
| 86880 | const currentModel = config8.OCO_MODEL; |
| 86881 | let models = []; |
| 86882 | if (useCache) { |
| 86883 | const cached = getCachedModels(provider); |
| 86884 | if (cached) { |
| 86885 | models = cached; |
| 86886 | } |
| 86887 | } |
| 86888 | if (models.length === 0) { |
| 86889 | const providerKey = provider.toLowerCase(); |
| 86890 | models = MODEL_LIST[providerKey] || []; |
| 86891 | } |
| 86892 | console.log( |
| 86893 | ` |
| 86894 | ${source_default.bold("Available models for")} ${source_default.cyan(provider)}: |
| 86895 | ` |
| 86896 | ); |
| 86897 | if (models.length === 0) { |
| 86898 | console.log(source_default.dim(" No models found")); |
| 86899 | } else { |
| 86900 | models.forEach((model) => { |
| 86901 | const isCurrent = model === currentModel; |
| 86902 | const prefix = isCurrent ? source_default.green("* ") : " "; |
| 86903 | const label = isCurrent ? source_default.green(model) : model; |
| 86904 | console.log(`${prefix}${label}`); |
| 86905 | }); |
no test coverage detected
searching dependent graphs…