pi-freeflow 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/index.ts +14 -9
- package/package.json +1 -1
package/extensions/index.ts
CHANGED
|
@@ -948,15 +948,20 @@ function normalizeRequestBody(
|
|
|
948
948
|
}
|
|
949
949
|
|
|
950
950
|
// 3. Max & Min tokens clamping (OpenCode Zen requires min 16; Vercel relay caps at 64k)
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
951
|
+
const clampTokens = (val: number): number => {
|
|
952
|
+
if (val < 16) return 16;
|
|
953
|
+
if (isRelay && val > RELAY_MAX_TOKENS) return RELAY_MAX_TOKENS;
|
|
954
|
+
return val;
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
if (typeof body.max_tokens === "number") {
|
|
958
|
+
body.max_tokens = clampTokens(body.max_tokens);
|
|
959
|
+
}
|
|
960
|
+
if (typeof body.maxTokens === "number") {
|
|
961
|
+
body.maxTokens = clampTokens(body.maxTokens);
|
|
962
|
+
}
|
|
963
|
+
if (typeof body.max_output_tokens === "number") {
|
|
964
|
+
body.max_output_tokens = clampTokens(body.max_output_tokens);
|
|
960
965
|
}
|
|
961
966
|
|
|
962
967
|
return body;
|