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:
@@ -114,8 +114,16 @@ export function openaiToClaudeRequest(model, body, stream) {
|
||||
|
||||
// Tools - convert from OpenAI format to Claude format with prefix for OAuth
|
||||
if (body.tools && Array.isArray(body.tools)) {
|
||||
result.tools = body.tools.map(tool => {
|
||||
const toolData = tool.type === "function" && tool.function ? tool.function : tool;
|
||||
result.tools = [];
|
||||
for (const tool of body.tools) {
|
||||
// Pass-through built-in tools (e.g. web_search_20250305) without prefix or conversion
|
||||
const toolType = tool.type;
|
||||
if (toolType && toolType !== "function") {
|
||||
result.tools.push(tool);
|
||||
continue;
|
||||
}
|
||||
|
||||
const toolData = toolType === "function" && tool.function ? tool.function : tool;
|
||||
const originalName = toolData.name;
|
||||
|
||||
// Claude OAuth requires prefixed tool names to avoid conflicts
|
||||
@@ -124,12 +132,12 @@ export function openaiToClaudeRequest(model, body, stream) {
|
||||
// Store mapping for response translation (prefixed → original)
|
||||
toolNameMap.set(toolName, originalName);
|
||||
|
||||
return {
|
||||
result.tools.push({
|
||||
name: toolName,
|
||||
description: toolData.description || "",
|
||||
input_schema: toolData.parameters || toolData.input_schema || { type: "object", properties: {}, required: [] }
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (result.tools.length > 0) {
|
||||
result.tools[result.tools.length - 1].cache_control = { type: "ephemeral", ttl: "1h" };
|
||||
|
||||
Reference in New Issue
Block a user