mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
tweak: alphabetical (mostly) opencode models output (#4725)
Co-authored-by: Dax Raad <d@ironbay.co>
This commit is contained in:
parent
4273fa9ccf
commit
5288041782
1 changed files with 11 additions and 2 deletions
|
|
@ -38,7 +38,8 @@ export const ModelsCommand = cmd({
|
|||
|
||||
function printModels(providerID: string, verbose?: boolean) {
|
||||
const provider = providers[providerID]
|
||||
for (const [modelID, model] of Object.entries(provider.info.models)) {
|
||||
const sortedModels = Object.entries(provider.info.models).sort(([a], [b]) => a.localeCompare(b))
|
||||
for (const [modelID, model] of sortedModels) {
|
||||
process.stdout.write(`${providerID}/${modelID}`)
|
||||
process.stdout.write(EOL)
|
||||
if (verbose) {
|
||||
|
|
@ -59,7 +60,15 @@ export const ModelsCommand = cmd({
|
|||
return
|
||||
}
|
||||
|
||||
for (const providerID of Object.keys(providers)) {
|
||||
const providerIDs = Object.keys(providers).sort((a, b) => {
|
||||
const aIsOpencode = a.startsWith("opencode")
|
||||
const bIsOpencode = b.startsWith("opencode")
|
||||
if (aIsOpencode && !bIsOpencode) return -1
|
||||
if (!aIsOpencode && bIsOpencode) return 1
|
||||
return a.localeCompare(b)
|
||||
})
|
||||
|
||||
for (const providerID of providerIDs) {
|
||||
printModels(providerID, args.verbose)
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue