Skip to content

Commit

Permalink
feat: add additional fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
k11kirky committed Feb 1, 2025
1 parent f3d3210 commit df7222d
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,18 @@ export const extractCoreModelParams = (event: PluginEvent): PluginEvent => {
}

const findCostFromModel = (aiModel: string): ModelRow | undefined => {
// Check if the model is an exact match
let cost = costs.find((cost) => cost.model.toLowerCase() === aiModel.toLowerCase())
// Check if the model is a variant of a known model
if (!cost) {
cost = costs.find((cost) => aiModel.toLowerCase().includes(cost.model.toLowerCase()))
}
// Check if the model is a variant of a known model
if (!cost) {
cost = costs.find((cost) => cost.model.toLowerCase().includes(aiModel.toLowerCase()))
}
if (!cost) {
console.warn(`No cost found for model: ${aiModel}`)
}
return cost
}

0 comments on commit df7222d

Please sign in to comment.