mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13:55:50 +00:00
feat: 问就是封包
This commit is contained in:
@@ -125,7 +125,7 @@ ${question}`
|
||||
function extractSideQuestionResponse(messages: Message[]): string | null {
|
||||
// Flatten all assistant content blocks across the per-block messages.
|
||||
const assistantBlocks = messages.flatMap(m =>
|
||||
m.type === 'assistant' ? m.message.content : [],
|
||||
m.type === 'assistant' ? (m.message.content as unknown as Array<{ type: string; [key: string]: unknown }>) : [],
|
||||
)
|
||||
|
||||
if (assistantBlocks.length > 0) {
|
||||
@@ -136,7 +136,7 @@ function extractSideQuestionResponse(messages: Message[]): string | null {
|
||||
// No text — check if the model tried to call a tool despite instructions.
|
||||
const toolUse = assistantBlocks.find(b => b.type === 'tool_use')
|
||||
if (toolUse) {
|
||||
const toolName = 'name' in toolUse ? toolUse.name : 'a tool'
|
||||
const toolName = 'name' in toolUse ? (toolUse as any).name : 'a tool'
|
||||
return `(The model tried to call ${toolName} instead of answering directly. Try rephrasing or ask in the main conversation.)`
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ function extractSideQuestionResponse(messages: Message[]): string | null {
|
||||
m.type === 'system' && 'subtype' in m && m.subtype === 'api_error',
|
||||
)
|
||||
if (apiErr) {
|
||||
return `(API error: ${formatAPIError(apiErr.error)})`
|
||||
return `(API error: ${formatAPIError(apiErr.error as any)})`
|
||||
}
|
||||
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user