Skip to content

Commit 87b9b72

Browse files
authored
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.
1 parent b41dd73 commit 87b9b72

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.husky/pre-commit

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,11 @@ if [ "$branch" = "main" ]; then
55
exit 1
66
fi
77

8-
npx lint-staged
8+
# Detect if running on Windows and use npx.cmd, otherwise use npx
9+
if [ "$OS" = "Windows_NT" ]; then
10+
npx_cmd="npx.cmd"
11+
else
12+
npx_cmd="npx"
13+
fi
14+
15+
"$npx_cmd" lint-staged

.husky/pre-push

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ if [ "$branch" = "main" ]; then
55
exit 1
66
fi
77

8-
npm run compile
8+
# Detect if running on Windows and use npm.cmd, otherwise use npm
9+
if [ "$OS" = "Windows_NT" ]; then
10+
npm_cmd="npm.cmd"
11+
else
12+
npm_cmd="npm"
13+
fi
14+
15+
"$npm_cmd" run compile
916

1017
# Check for new changesets.
1118
NEW_CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" | wc -l | tr -d ' ')

src/api/providers/openrouter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,13 @@ export async function getOpenRouterModels(options?: ApiHandlerOptions) {
256256
modelInfo.maxTokens = 8192
257257
break
258258
case rawModel.id.startsWith("anthropic/claude-3-haiku"):
259-
default:
260259
modelInfo.supportsPromptCache = true
261260
modelInfo.cacheWritesPrice = 0.3
262261
modelInfo.cacheReadsPrice = 0.03
263262
modelInfo.maxTokens = 8192
264263
break
264+
default:
265+
break
265266
}
266267

267268
models[rawModel.id] = modelInfo

0 commit comments

Comments
 (0)