feat(chat): MCP stdio 工具接入

- McpServer:启动进程、initialize、tools/list、tools/call
- McpManager:多服务器、工具名冲突处理、OpenAI function 定义
- ChatClient:请求携带 tools,流式累积 tool_calls,结束后交回上层
- ChatWindow:工具调用循环(最多 5 轮)、scaffold 消息、设置里的 MCP JSON 编辑
- 无头自测 gxde-ai-see-mcptest + tests/mcp/test_server.py 验证通过
This commit is contained in:
2026-10-30 20:22:14 +08:00
parent c7865fcbf0
commit 77a4369cd6
11 changed files with 681 additions and 8 deletions
+9
View File
@@ -34,6 +34,7 @@ set(GXDE_AI_SEE_SOURCES
src/todo/todowindow.cpp
src/chat/chatclient.cpp
src/chat/chatwindow.cpp
src/chat/mcpclient.cpp
src/ui/portalpanel.cpp
)
@@ -73,6 +74,14 @@ add_executable(gxde-ai-see-selftest
target_include_directories(gxde-ai-see-selftest PRIVATE src ${ICU_INCLUDE_DIRS})
target_link_libraries(gxde-ai-see-selftest PRIVATE Qt6::Core Qt6::Gui ${ICU_LIBRARIES})
add_executable(gxde-ai-see-mcptest
tests/mcptest.cpp
src/chat/mcpclient.cpp
src/config.cpp
)
target_include_directories(gxde-ai-see-mcptest PRIVATE src)
target_link_libraries(gxde-ai-see-mcptest PRIVATE Qt6::Core)
install(TARGETS gxde-ai-see RUNTIME DESTINATION bin)
install(FILES data/gxde-ai-see.desktop data/gxde-ai-see-todo.desktop DESTINATION share/applications)
install(DIRECTORY data/icons/ DESTINATION share/icons/hicolor)