refactor(logging): change logger level and remove unused log statements (#10030)

* refactor(logging): change logger level and remove unused log statements

- Updated logger level from info to silly in AiSdkToChunkAdapter for more granular logging.
- Removed unused logger statements in AiSdkMiddlewareBuilder and PluginBuilder to clean up the code.
- Enhanced condition check in ApiService to include prompt tool usage.

* chore
This commit is contained in:
SuYao 2025-09-08 11:54:14 +08:00 committed by GitHub
parent 79592e2c27
commit 1cd89561ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 3 additions and 5 deletions

View File

@ -89,7 +89,7 @@ export class AiSdkToChunkAdapter {
chunk: TextStreamPart<any>, chunk: TextStreamPart<any>,
final: { text: string; reasoningContent: string; webSearchResults: any[]; reasoningId: string } final: { text: string; reasoningContent: string; webSearchResults: any[]; reasoningId: string }
) { ) {
logger.info(`AI SDK chunk type: ${chunk.type}`, chunk) logger.silly(`AI SDK chunk type: ${chunk.type}`, chunk)
switch (chunk.type) { switch (chunk.type) {
// === 文本相关事件 === // === 文本相关事件 ===
case 'text-start': case 'text-start':

View File

@ -132,7 +132,6 @@ export function buildAiSdkMiddlewares(config: AiSdkMiddlewareConfig): LanguageMo
}) })
} }
logger.info('builder.build()', builder.buildNamed())
return builder.build() return builder.build()
} }

View File

@ -72,7 +72,7 @@ export function buildPlugins(
// if (!middlewareConfig.enableTool && middlewareConfig.mcpTools && middlewareConfig.mcpTools.length > 0) { // if (!middlewareConfig.enableTool && middlewareConfig.mcpTools && middlewareConfig.mcpTools.length > 0) {
// plugins.push(createNativeToolUsePlugin()) // plugins.push(createNativeToolUsePlugin())
// } // }
logger.info( logger.debug(
'Final plugin list:', 'Final plugin list:',
plugins.map((p) => p.name) plugins.map((p) => p.name)
) )

View File

@ -99,8 +99,7 @@ export async function fetchChatCompletion({
const provider = AI.getActualProvider() const provider = AI.getActualProvider()
const mcpTools: MCPTool[] = [] const mcpTools: MCPTool[] = []
if (isPromptToolUse(assistant) || isSupportedToolUse(assistant)) {
if (isSupportedToolUse(assistant)) {
mcpTools.push(...(await fetchMcpTools(assistant))) mcpTools.push(...(await fetchMcpTools(assistant)))
} }
if (prompt) { if (prompt) {