chore: update package version to 0.2.71 and enhance MITM tools

This commit is contained in:
decolua
2026-02-09 00:15:31 +07:00
parent bd0cebcfff
commit 635d327dbc
5 changed files with 41 additions and 17 deletions

View File

@@ -1,5 +1,6 @@
// Claude helper functions for translator
import { DEFAULT_THINKING_CLAUDE_SIGNATURE } from "../../config/defaultThinkingSignature.js";
import { adjustMaxTokens } from "./maxTokensHelper.js";
// Check if message has valid non-empty content
export function hasValidContent(msg) {

View File

@@ -9,13 +9,17 @@ export function adjustMaxTokens(body) {
let maxTokens = body.max_tokens || DEFAULT_MAX_TOKENS;
// Auto-increase for tool calling to prevent truncated arguments
// Tool calls with large content (like writing files) need more tokens
if (body.tools && Array.isArray(body.tools) && body.tools.length > 0) {
if (maxTokens < DEFAULT_MIN_TOKENS) {
maxTokens = DEFAULT_MIN_TOKENS;
}
}
// Ensure max_tokens > thinking.budget_tokens (Claude API requirement)
if (body.thinking?.budget_tokens && maxTokens <= body.thinking.budget_tokens) {
maxTokens = DEFAULT_MAX_TOKENS;
}
return maxTokens;
}