mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-01 17:59:09 +08:00
fix: resolve lint findings in renderer
This commit is contained in:
parent
5d26bf15a3
commit
49e4667410
@ -4,7 +4,7 @@ import { FileText } from 'lucide-react'
|
|||||||
import { ToolTitle } from './GenericTools'
|
import { ToolTitle } from './GenericTools'
|
||||||
import type { WriteToolInput, WriteToolOutput } from './types'
|
import type { WriteToolInput, WriteToolOutput } from './types'
|
||||||
|
|
||||||
export function WriteTool({ input, output }: { input: WriteToolInput; output?: WriteToolOutput }) {
|
export function WriteTool({ input }: { input: WriteToolInput; output?: WriteToolOutput }) {
|
||||||
return (
|
return (
|
||||||
<AccordionItem
|
<AccordionItem
|
||||||
key="tool"
|
key="tool"
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { Alert, Button, Spinner } from '@heroui/react'
|
import { Alert, Button, Spinner } from '@heroui/react'
|
||||||
import { useAgent } from '@renderer/hooks/agents/useAgent'
|
import { useAgent } from '@renderer/hooks/agents/useAgent'
|
||||||
import { useSessions } from '@renderer/hooks/agents/useSessions'
|
import { useSessions } from '@renderer/hooks/agents/useSessions'
|
||||||
import { useUpdateSession } from '@renderer/hooks/agents/useUpdateSession'
|
|
||||||
import { useRuntime } from '@renderer/hooks/useRuntime'
|
import { useRuntime } from '@renderer/hooks/useRuntime'
|
||||||
import { useAppDispatch } from '@renderer/store'
|
import { useAppDispatch } from '@renderer/store'
|
||||||
import {
|
import {
|
||||||
@ -27,7 +26,6 @@ const Sessions: React.FC<SessionsProps> = ({ agentId }) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { agent } = useAgent(agentId)
|
const { agent } = useAgent(agentId)
|
||||||
const { sessions, isLoading, error, deleteSession, createSession } = useSessions(agentId)
|
const { sessions, isLoading, error, deleteSession, createSession } = useSessions(agentId)
|
||||||
const updateSession = useUpdateSession(agentId)
|
|
||||||
const { chat } = useRuntime()
|
const { chat } = useRuntime()
|
||||||
const { activeSessionId, sessionWaiting } = chat
|
const { activeSessionId, sessionWaiting } = chat
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
@ -70,7 +68,7 @@ const Sessions: React.FC<SessionsProps> = ({ agentId }) => {
|
|||||||
}
|
}
|
||||||
dispatch(setSessionWaitingAction({ id, value: false }))
|
dispatch(setSessionWaitingAction({ id, value: false }))
|
||||||
},
|
},
|
||||||
[agentId, deleteSession, dispatch, sessions]
|
[agentId, deleteSession, dispatch, sessions, t]
|
||||||
)
|
)
|
||||||
|
|
||||||
const currentActiveSessionId = activeSessionId[agentId]
|
const currentActiveSessionId = activeSessionId[agentId]
|
||||||
|
|||||||
@ -108,7 +108,12 @@ export function openAIToolsToMcpTool(
|
|||||||
export async function callBuiltInTool(toolResponse: MCPToolResponse): Promise<MCPCallToolResponse | undefined> {
|
export async function callBuiltInTool(toolResponse: MCPToolResponse): Promise<MCPCallToolResponse | undefined> {
|
||||||
logger.info(`[BuiltIn] Calling Built-in Tool: ${toolResponse.tool.name}`, toolResponse.tool)
|
logger.info(`[BuiltIn] Calling Built-in Tool: ${toolResponse.tool.name}`, toolResponse.tool)
|
||||||
|
|
||||||
if (toolResponse.tool.name === 'think') {
|
if (
|
||||||
|
toolResponse.tool.name === 'think' &&
|
||||||
|
typeof toolResponse.arguments === 'object' &&
|
||||||
|
toolResponse.arguments !== null &&
|
||||||
|
!Array.isArray(toolResponse.arguments)
|
||||||
|
) {
|
||||||
const thought = toolResponse.arguments?.thought
|
const thought = toolResponse.arguments?.thought
|
||||||
return {
|
return {
|
||||||
isError: false,
|
isError: false,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user