mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 06:12:26 +00:00
refactor(provider): flow branded ProviderID/ModelID through internal signatures (#17182)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { Argv } from "yargs"
|
||||
import { Instance } from "../../project/instance"
|
||||
import { Provider } from "../../provider/provider"
|
||||
import { ProviderID } from "../../provider/schema"
|
||||
import { ModelsDev } from "../../provider/models"
|
||||
import { cmd } from "./cmd"
|
||||
import { UI } from "../ui"
|
||||
@@ -36,7 +37,7 @@ export const ModelsCommand = cmd({
|
||||
async fn() {
|
||||
const providers = await Provider.list()
|
||||
|
||||
function printModels(providerID: string, verbose?: boolean) {
|
||||
function printModels(providerID: ProviderID, verbose?: boolean) {
|
||||
const provider = providers[providerID]
|
||||
const sortedModels = Object.entries(provider.models).sort(([a], [b]) => a.localeCompare(b))
|
||||
for (const [modelID, model] of sortedModels) {
|
||||
@@ -56,7 +57,7 @@ export const ModelsCommand = cmd({
|
||||
return
|
||||
}
|
||||
|
||||
printModels(args.provider, args.verbose)
|
||||
printModels(ProviderID.make(args.provider), args.verbose)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -69,7 +70,7 @@ export const ModelsCommand = cmd({
|
||||
})
|
||||
|
||||
for (const providerID of providerIDs) {
|
||||
printModels(providerID, args.verbose)
|
||||
printModels(ProviderID.make(providerID), args.verbose)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user