Remove Docker publish workflow and update error handling in various modules
- Added handling for HTTP_STATUS.NOT_ACCEPTABLE in error types and messages. - Enhanced the `prepareClaudeRequest` function to filter built-in tools for non-Anthropic providers and clean up empty tool arrays. - Updated the `openaiToClaudeRequest` function to handle built-in tools more effectively and ensure proper tool conversion. - Improved the `claudeToOpenAIResponse` function to skip processing for built-in server tool blocks. - Refined error message handling in the `parseUpstreamError` function to ensure meaningful output. - Adjusted command checks for tool installations across various settings routes to use `command -v` for better compatibility.
This commit is contained in:
@@ -164,8 +164,13 @@ export function prepareClaudeRequest(body, provider = null) {
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Tools: remove all cache_control, add only to last tool with ttl 1h
|
||||
// 3. Tools: filter built-in tools for non-Anthropic providers, then handle cache_control
|
||||
if (body.tools && Array.isArray(body.tools)) {
|
||||
// Strip built-in tools (e.g. web_search_20250305) for providers that don't support them
|
||||
if (provider !== "claude") {
|
||||
body.tools = body.tools.filter(tool => !tool.type || tool.type === "function");
|
||||
}
|
||||
|
||||
body.tools = body.tools.map((tool, i) => {
|
||||
const { cache_control, ...rest } = tool;
|
||||
if (i === body.tools.length - 1) {
|
||||
@@ -173,6 +178,12 @@ export function prepareClaudeRequest(body, provider = null) {
|
||||
}
|
||||
return rest;
|
||||
});
|
||||
|
||||
// Remove tools array and tool_choice if empty after filtering
|
||||
if (body.tools.length === 0) {
|
||||
delete body.tools;
|
||||
delete body.tool_choice;
|
||||
}
|
||||
}
|
||||
|
||||
return body;
|
||||
|
||||
Reference in New Issue
Block a user