Corrected bug in openrouter.ts and pre-commit and pre-push husky scripts (#1853)

- Corrected error causing free models listed under openrouter to show pricing information
- Updated pre-push and pre-commit scripts to work in Windows environments when pushing to branch (windows requires npm/npx to include the ".cmd" extension to recognize and compile.
This commit is contained in:
Jason Owens 2025-03-23 02:12:53 -04:00 committed by GitHub
parent b41dd739f3
commit 87b9b72b32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 3 deletions

View file

@ -5,4 +5,11 @@ if [ "$branch" = "main" ]; then
exit 1
fi
npx lint-staged
# Detect if running on Windows and use npx.cmd, otherwise use npx
if [ "$OS" = "Windows_NT" ]; then
npx_cmd="npx.cmd"
else
npx_cmd="npx"
fi
"$npx_cmd" lint-staged

View file

@ -5,7 +5,14 @@ if [ "$branch" = "main" ]; then
exit 1
fi
npm run compile
# Detect if running on Windows and use npm.cmd, otherwise use npm
if [ "$OS" = "Windows_NT" ]; then
npm_cmd="npm.cmd"
else
npm_cmd="npm"
fi
"$npm_cmd" run compile
# Check for new changesets.
NEW_CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" | wc -l | tr -d ' ')

View file

@ -256,12 +256,13 @@ export async function getOpenRouterModels(options?: ApiHandlerOptions) {
modelInfo.maxTokens = 8192
break
case rawModel.id.startsWith("anthropic/claude-3-haiku"):
default:
modelInfo.supportsPromptCache = true
modelInfo.cacheWritesPrice = 0.3
modelInfo.cacheReadsPrice = 0.03
modelInfo.maxTokens = 8192
break
default:
break
}
models[rawModel.id] = modelInfo