mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-08 22:21:35 +00:00
fix(responses-api): fix whitespace token filter and MCP server URL construction
- Drop the delta.trim() whitespace filter that was silently swallowing spaces and newlines during streaming, causing words to concatenate and paragraphs to collapse. Only skip truly empty strings (delta.length > 0). - Use proxyBaseUrl for MCP server_url construction instead of the hardcoded relative path "litellm_proxy/mcp", so non-root deployments route correctly.
This commit is contained in:
parent
2094bddfaa
commit
c0ebe03704
1 changed files with 3 additions and 4 deletions
|
|
@ -98,7 +98,7 @@ export async function makeOpenAIResponsesRequest(
|
|||
tools.push({
|
||||
type: "mcp",
|
||||
server_label: "litellm",
|
||||
server_url: "litellm_proxy/mcp",
|
||||
server_url: `${proxyBaseUrl}/mcp`,
|
||||
require_approval: "never",
|
||||
});
|
||||
} else {
|
||||
|
|
@ -111,7 +111,7 @@ export async function makeOpenAIResponsesRequest(
|
|||
tools.push({
|
||||
type: "mcp",
|
||||
server_label: "litellm",
|
||||
server_url: `litellm_proxy/mcp/${serverName}`,
|
||||
server_url: `${proxyBaseUrl}/mcp/${serverName}`,
|
||||
require_approval: "never",
|
||||
...(allowedTools.length > 0 ? { allowed_tools: allowedTools } : {}),
|
||||
});
|
||||
|
|
@ -197,8 +197,7 @@ export async function makeOpenAIResponsesRequest(
|
|||
if (event.type === "response.output_text.delta" && typeof event.delta === "string") {
|
||||
const delta = event.delta;
|
||||
console.log("Text delta", delta);
|
||||
// skip pure whitespace/newlines
|
||||
if (delta.trim().length > 0) {
|
||||
if (delta.length > 0) {
|
||||
updateTextUI("assistant", delta, selectedModel);
|
||||
|
||||
// Calculate time to first token
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue