fix(MessageTools): Improve empty tool responses check

Use lodash's isEmpty for more robust null/undefined handling when checking MCP tool responses
This commit is contained in:
kangfenmao 2025-03-09 21:23:40 +08:00
parent 08e75c39c0
commit 219cea0c53

View File

@ -2,6 +2,7 @@ import { CheckOutlined, ExpandOutlined, LoadingOutlined } from '@ant-design/icon
import { useSettings } from '@renderer/hooks/useSettings'
import { MCPToolResponse, Message } from '@renderer/types'
import { Collapse, message as antdMessage, Modal, Tooltip } from 'antd'
import { isEmpty } from 'lodash'
import { FC, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'
@ -24,7 +25,7 @@ const MessageTools: FC<Props> = ({ message }) => {
const toolResponses = message.metadata?.mcpTools || []
if (!toolResponses.length && !message.reasoning_content) {
if (isEmpty(toolResponses)) {
return null
}