Skip to content

Commit d0e9454

Browse files
refactor: 修复 stream-transformer 中 name 属性的类型错误
Co-authored-by: aider (vertex_ai/gemini-2.5-pro) <aider@aider.chat>
1 parent 94c59a0 commit d0e9454

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/mcp-server/src/bridge/stream-transformer.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export function createOpenAIStreamTransformer(
8888
}
8989

9090
if (part.functionCall && part.functionCall.name) {
91-
const fc = part.functionCall;
9291
const callId = `call_${randomUUID()}`;
9392

9493
// 模拟分块发送 tool_calls
@@ -99,7 +98,7 @@ export function createOpenAIStreamTransformer(
9998
index: toolCallStates.length,
10099
id: callId,
101100
type: 'function',
102-
function: { name: fc.name, arguments: '' },
101+
function: { name: part.functionCall.name, arguments: '' },
103102
},
104103
],
105104
};
@@ -116,16 +115,16 @@ export function createOpenAIStreamTransformer(
116115
index: toolCallStates.length,
117116
id: callId,
118117
type: 'function',
119-
function: { arguments: JSON.stringify(fc.args) },
118+
function: { arguments: JSON.stringify(part.functionCall.args) },
120119
},
121120
],
122121
};
123122
enqueueChunk(controller, createChunk(argsDelta));
124123

125124
toolCallStates.push({
126125
id: callId,
127-
name: fc.name,
128-
arguments: JSON.stringify(fc.args),
126+
name: part.functionCall.name,
127+
arguments: JSON.stringify(part.functionCall.args),
129128
});
130129
}
131130
}

0 commit comments

Comments
 (0)