Skip to content

Commit d2333c8

Browse files
committed
Corrected bug in openrouter.ts and pre-commit and pre-push husky scripts
- 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 dca4563 commit d2333c8

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
@@ -289,12 +289,13 @@ export async function getOpenRouterModels(options?: ApiHandlerOptions) {
289289
modelInfo.maxTokens = 8192
290290
break
291291
case rawModel.id.startsWith("anthropic/claude-3-haiku"):
292-
default:
293292
modelInfo.supportsPromptCache = true
294293
modelInfo.cacheWritesPrice = 0.3
295294
modelInfo.cacheReadsPrice = 0.03
296295
modelInfo.maxTokens = 8192
297296
break
297+
default:
298+
break
298299
}
299300

300301
models[rawModel.id] = modelInfo

0 commit comments

Comments
 (0)