mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-06 13:19:33 +08:00
Fix/message refactor bug (#3087)
* ✨ feat: add Model Context Protocol (MCP) support (#2809) * ✨ feat: add Model Context Protocol (MCP) server configuration (main) - Added `@modelcontextprotocol/sdk` dependency for MCP integration. - Introduced MCP server configuration UI in settings with add, edit, delete, and activation functionalities. - Created `useMCPServers` hook to manage MCP server state and actions. - Added i18n support for MCP settings with translation keys. - Integrated MCP settings into the application's settings navigation and routing. - Implemented Redux state management for MCP servers. - Updated `yarn.lock` with new dependencies and their resolutions. * 🌟 feat: implement mcp service and integrate with ipc handlers - Added `MCPService` class to manage Model Context Protocol servers. - Implemented various handlers in `ipc.ts` for managing MCP servers including listing, adding, updating, deleting, and activating/deactivating servers. - Integrated MCP related types into existing type declarations for consistency across the application. - Updated `preload` to expose new MCP related APIs to the renderer process. - Enhanced `MCPSettings` component to interact directly with the new MCP service for adding, updating, deleting servers and setting their active states. - Introduced selectors in the MCP Redux slice for fetching active and all servers from the store. - Moved MCP types to a centralized location in `@renderer/types` for reuse across different parts of the application. * feat: enhance MCPService initialization to prevent recursive calls and improve error handling * feat: enhance MCP integration by adding MCPTool type and updating related methods * feat: implement streaming support for tool calls in OpenAIProvider and enhance message processing * fix: finish_reason undefined * fix: Improve translation error handling in MessageMenubar --------- Co-authored-by: LiuVaayne <10231735+vaayne@users.noreply.github.com> Co-authored-by: kangfenmao <kangfenmao@qq.com>
This commit is contained in:
parent
670d66b01d
commit
f890da0cda
@ -48,7 +48,7 @@ interface Props {
|
|||||||
message: Message
|
message: Message
|
||||||
assistant: Assistant
|
assistant: Assistant
|
||||||
topic: Topic
|
topic: Topic
|
||||||
model: Model
|
model?: Model
|
||||||
index?: number
|
index?: number
|
||||||
isGrouped?: boolean
|
isGrouped?: boolean
|
||||||
isLastMessage: boolean
|
isLastMessage: boolean
|
||||||
@ -180,12 +180,12 @@ const MessageMenubar: FC<Props> = (props) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 翻译完成后,提交流消息
|
// 翻译完成后,提交流消息
|
||||||
dispatch(commitStreamMessage({ topicId: topic.id }))
|
dispatch(commitStreamMessage({ topicId: topic.id, messageId: message.id }))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Translation failed:', error)
|
console.error('Translation failed:', error)
|
||||||
window.message.error({ content: t('translate.error.failed'), key: 'translate-message' })
|
window.message.error({ content: t('translate.error.failed'), key: 'translate-message' })
|
||||||
dispatch(updateMessage({ topicId: topic.id, messageId: message.id, updates: { translatedContent: undefined } }))
|
dispatch(updateMessage({ topicId: topic.id, messageId: message.id, updates: { translatedContent: undefined } }))
|
||||||
dispatch(clearStreamMessage({ topicId: topic.id }))
|
dispatch(clearStreamMessage({ topicId: topic.id, messageId: message.id }))
|
||||||
} finally {
|
} finally {
|
||||||
setIsTranslating(false)
|
setIsTranslating(false)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user