(body: AnthropicRequest)
| 174 | } |
| 175 | |
| 176 | export function isToolCapabilityQuestion(body: AnthropicRequest): boolean { |
| 177 | if (!body.messages || body.messages.length === 0) return false; |
| 178 | const lastMsg = body.messages[body.messages.length - 1]; |
| 179 | if (lastMsg.role !== 'user') return false; |
| 180 | |
| 181 | let text = ''; |
| 182 | if (typeof lastMsg.content === 'string') { |
| 183 | text = lastMsg.content; |
| 184 | } else if (Array.isArray(lastMsg.content)) { |
| 185 | for (const block of lastMsg.content) { |
| 186 | if (block.type === 'text' && block.text) text += block.text; |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | return TOOL_CAPABILITY_PATTERNS.some(p => p.test(text)); |
| 191 | } |
| 192 | |
| 193 | // ==================== 响应内容清洗 ==================== |
| 194 |
no outgoing calls
no test coverage detected