[{"data":1,"prerenderedAt":606},["ShallowReactive",2],{"content-query-DKrNUlpMc7":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"category":13,"body":14,"_type":600,"_id":601,"_source":602,"_file":603,"_stem":604,"_extension":605},"/technology-blogs/zh/3451","zh",false,"","MindPilot：一款基于MindSpore和MindNLP的开源智能助手","作者：郭嘉梁 来源：知乎","2024-10-25","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/28/5a65d2739e064c8a95cb8c8cc810b7bb.png","technology-blogs","开发者分享",{"type":15,"children":16,"toc":597},"root",[17,25,44,49,54,67,75,80,88,93,98,105,110,118,123,130,138,145,150,155,163,171,176,181,188,193,198,206,211,276,284,289,298,303,308,315,322,329,334,339,346,351,358,363,371,378,383,390,395,402,407,414,419,427,435,440,445,450,458,511,519,527,535,543,548,556,564,574,579,587,592],{"type":18,"tag":19,"props":20,"children":22},"element","h1",{"id":21},"mindpilot一款基于mindspore和mindnlp的开源智能助手",[23],{"type":24,"value":8},"text",{"type":18,"tag":26,"props":27,"children":28},"p",{},[29,31,37,39],{"type":24,"value":30},"**作者：**",{"type":18,"tag":32,"props":33,"children":34},"strong",{},[35],{"type":24,"value":36},"郭嘉梁",{"type":24,"value":38}," ",{"type":18,"tag":32,"props":40,"children":41},{},[42],{"type":24,"value":43},"来源：知乎",{"type":18,"tag":26,"props":45,"children":46},{},[47],{"type":24,"value":48},"在人工智能（AI）技术飞速发展的今天，智能助手逐渐成为人们日常工作和生活中的重要工具。MindPilot的推出，是为了提供更加灵活、安全且高效的智能解决方案。",{"type":18,"tag":26,"props":50,"children":51},{},[52],{"type":24,"value":53},"MindPilot是一个跨平台的多功能智能Agent桌面助手，旨在为用户提供便捷、高效的智能解决方案。通过集成先进的大语言模型作为核心决策引擎，MindPilot能够对用户的任务进行精准分解、规划、执行、反思和总结，确保任务的高效完成。同时提供了高度自定义化的Agent，用户可以根据需求自定义不同身份的Agent，以应对多样化的任务场景，实现个性化的智能服务。在MindSpore和MindNLP的支持下，MindPilot支持Windows、macOS和Linux等主流操作系统，并兼容多种在线模型API和本地模型，能流畅运行在CPU，GPU，Ascend设备上。",{"type":18,"tag":26,"props":55,"children":56},{},[57,59],{"type":24,"value":58},"github仓库：",{"type":18,"tag":60,"props":61,"children":65},"a",{"href":62,"rel":63},"https://github.com/ResDream/MindPilot",[64],"nofollow",[66],{"type":24,"value":62},{"type":18,"tag":26,"props":68,"children":69},{},[70],{"type":18,"tag":32,"props":71,"children":72},{},[73],{"type":24,"value":74},"系统设计",{"type":18,"tag":26,"props":76,"children":77},{},[78],{"type":24,"value":79},"系统架构图展示了MindPilot智能Agent桌面助手的整体架构和关键模块。该系统通过Electron框架提供跨平台的用户界面，支持Windows、macOS和Linux操作系统。核心功能模块包括基于LangChain框架的Agent对话模块、工具管理模块和知识库管理模块，确保系统能够高效处理用户任务并提供智能交互。Agent对话模块能够自主思考、决策并调用工具，知识库管理模块结合图数据库和向量数据库，实现高效的知识检索。工具管理模块支持OpenAI Function Call标准，允许用户灵活扩展功能。此外，统支持在线和离线模型的集成，适配多种主流大模型平台，并能在不同硬件平台上高效运行，提供强大的自然语言处理能力。",{"type":18,"tag":26,"props":81,"children":82},{},[83],{"type":18,"tag":84,"props":85,"children":87},"img",{"alt":7,"src":86},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/fad7ce8b88054a07975df3c2eeaa0fea.png",[],{"type":18,"tag":26,"props":89,"children":90},{},[91],{"type":24,"value":92},"系统架构图",{"type":18,"tag":26,"props":94,"children":95},{},[96],{"type":24,"value":97},"系统流程图展示了MindPilot智能Agent桌面助手的整体工作流程和架构。系统由用户交互层、会话管理模块、语言模型（LLM）、工具库以及知识库组成。用户通过界面发出任务，会话管理模块将其解析并决定是否调用语言模型或工具库。语言模型负责理解和生成响应，工具库则执行具体任务如文件处理和API集成，必要时访问图数据库和向量数据库来提高任务精确性。最终结果通过会话管理模块返回给用户，确保系统灵活高效地完成任务并提供精准智能的解决方案。",{"type":18,"tag":26,"props":99,"children":100},{},[101],{"type":18,"tag":84,"props":102,"children":104},{"alt":7,"src":103},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/144f627e5a2f491399f59a47561eaa09.png",[],{"type":18,"tag":26,"props":106,"children":107},{},[108],{"type":24,"value":109},"系统流程图",{"type":18,"tag":26,"props":111,"children":112},{},[113],{"type":18,"tag":32,"props":114,"children":115},{},[116],{"type":24,"value":117},"灵活模型配置，提升智能助手效能",{"type":18,"tag":26,"props":119,"children":120},{},[121],{"type":24,"value":122},"传统的智能助手通常依赖单一的语言模型，限制了模型的灵活性和适用性。而MindPilot通过对主流在线模型平台的支持，极大地提升了智能助手的功能性和适应性。用户可以方便地集成OpenAI、智谱、百度、讯飞等所有兼容OpenAI API的大模型平台，根据任务需求灵活切换模型，确保在各类应用场景下提供最佳的智能支持。同时，MindPilot也支持离线模型部署，适用于对数据隐私和网络环境有特殊要求的用户。",{"type":18,"tag":26,"props":124,"children":125},{},[126],{"type":18,"tag":84,"props":127,"children":129},{"alt":7,"src":128},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/f9624d64550e440abec22cea6a6da5bf.png",[],{"type":18,"tag":26,"props":131,"children":132},{},[133],{"type":18,"tag":32,"props":134,"children":135},{},[136],{"type":24,"value":137},"跨平台兼容，确保一致性使用体验",{"type":18,"tag":26,"props":139,"children":140},{},[141],{"type":18,"tag":84,"props":142,"children":144},{"alt":7,"src":143},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/c66316b7b3e14dc3b3e4add8bf72b540.png",[],{"type":18,"tag":26,"props":146,"children":147},{},[148],{"type":24,"value":149},"MindPilot特别注重跨平台的兼容性，能够在Windows、macOS和Linux操作系统上无缝运行。基于Electron框架开发的跨平台桌面应用，确保了用户无论在哪个平台上使用，均能获得一致、流畅的操作体验。",{"type":18,"tag":26,"props":151,"children":152},{},[153],{"type":24,"value":154},"这种广泛的操作系统支持使得MindPilot可以在企业内的多种硬件环境中无缝部署。无论员工使用的是Windows台式机，还是MacBook，或者基于Linux的开发环境，MindPilot都能成为他们的智能助手，提升工作效率。",{"type":18,"tag":26,"props":156,"children":157},{},[158],{"type":18,"tag":32,"props":159,"children":160},{},[161],{"type":24,"value":162},"基于Langchain框架的自定义Agent，",{"type":18,"tag":26,"props":164,"children":165},{},[166],{"type":18,"tag":32,"props":167,"children":168},{},[169],{"type":24,"value":170},"个性化智能服务",{"type":18,"tag":26,"props":172,"children":173},{},[174],{"type":24,"value":175},"与市场上现有的智能助手相比，MindPilot最大的创新之一在于其强大的Agent自定义功能。借助LangChain框架的Agent流程，用户可以根据具体需求定义多个Agent，赋予每个Agent不同的角色、行为和工具配置，",{"type":18,"tag":26,"props":177,"children":178},{},[179],{"type":24,"value":180},"以应对各种复杂任务场景。通过这种高度灵活的配置，MindPilot不仅能够处理简单的日常任务，还能在复杂的业务场景中展现其优势。",{"type":18,"tag":26,"props":182,"children":183},{},[184],{"type":18,"tag":84,"props":185,"children":187},{"alt":7,"src":186},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/84ec01ee840b4b2f98adb956e6fee153.png",[],{"type":18,"tag":26,"props":189,"children":190},{},[191],{"type":24,"value":192},"配置Agent智能体界面",{"type":18,"tag":26,"props":194,"children":195},{},[196],{"type":24,"value":197},"MindPilot提供高度的自定义Agent配置，包括自定义图标，名称，简介和具体的配置信息，用户还可以选择要使用的工具和知识库，并配置对话模型的温度，最大长度等参数。",{"type":18,"tag":26,"props":199,"children":200},{},[201],{"type":18,"tag":32,"props":202,"children":203},{},[204],{"type":24,"value":205},"丰富的智能工具调用",{"type":18,"tag":26,"props":207,"children":208},{},[209],{"type":24,"value":210},"此外，MindPilot提供了六种内置工具，涵盖用户使用的方方面面调用，能够扩展和管理多种工具，支持从文件处理到API调用的各类任务，甚至未来用户还可以自定义新工具，进一步扩展系统功能。无论是在日常任务处理还是复杂工具链整合方面，MindPilot都能为用户提供最佳的工作体验。",{"type":18,"tag":212,"props":213,"children":214},"ul",{},[215,226,236,246,256,266],{"type":18,"tag":216,"props":217,"children":218},"li",{},[219,224],{"type":18,"tag":32,"props":220,"children":221},{},[222],{"type":24,"value":223},"搜索外挂知识库",{"type":24,"value":225},"工具旨在帮助Agent访问和检索预先定义的知识库内容。该工具集成了RAG（Retrieval-Augmented Generation）技术，能够在生成回答时动态检索知识库中的相关内容，并将其与生成模型的输出结合，从而提供更加精确和上下文相关的回答。",{"type":18,"tag":216,"props":227,"children":228},{},[229,234],{"type":18,"tag":32,"props":230,"children":231},{},[232],{"type":24,"value":233},"搜索互联网",{"type":24,"value":235},"工具允许Agent实时查询互联网，获取最新的信息和数据。",{"type":18,"tag":216,"props":237,"children":238},{},[239,244],{"type":18,"tag":32,"props":240,"children":241},{},[242],{"type":24,"value":243},"计算器",{"type":24,"value":245},"工具为Agent提供了执行各种数学计算的能力。",{"type":18,"tag":216,"props":247,"children":248},{},[249,254],{"type":18,"tag":32,"props":250,"children":251},{},[252],{"type":24,"value":253},"论文搜索",{"type":24,"value":255},"工具帮助Agent检索学术数据库，找到相关的学术论文和研究资料。",{"type":18,"tag":216,"props":257,"children":258},{},[259,264],{"type":18,"tag":32,"props":260,"children":261},{},[262],{"type":24,"value":263},"命令执行",{"type":24,"value":265},"工具允许Agent在受控环境下运行各种命令行操作。这一工具可用于执行系统命令、脚本文件或其他自动化任务，帮助用户完成系统管理、文件处理和自动化操作。它提供了强大的操作能力，使Agent可以直接与底层系统进行交互。",{"type":18,"tag":216,"props":267,"children":268},{},[269,274],{"type":18,"tag":32,"props":270,"children":271},{},[272],{"type":24,"value":273},"天气查询",{"type":24,"value":275},"工具为Agent提供了获取当前和未来天气信息的功能。",{"type":18,"tag":26,"props":277,"children":278},{},[279],{"type":18,"tag":32,"props":280,"children":281},{},[282],{"type":24,"value":283},"基于MindNLP的知识库管理",{"type":18,"tag":26,"props":285,"children":286},{},[287],{"type":24,"value":288},"MindPilot的知识库采用Faiss向量数据库来存储和管理文本数据，知识库通过对文本数据进行向量化处理，将其转化为多维向量进行存储。",{"type":18,"tag":290,"props":291,"children":292},"blockquote",{},[293],{"type":18,"tag":26,"props":294,"children":295},{},[296],{"type":24,"value":297},"Faiss向量数据库专为大规模相似性搜索和高维向量聚类设计。它通过优化的索引结构和并行计算技术，能够在海量数据中快速找到与查询向量最相似的向量，适用于图像识别、自然语言处理等需要高效向量搜索的场景。Faiss支持多种索引类型，包括精确搜索和近似搜索，能够在保持高精度的同时显著提升搜索速度，是处理大规模向量数据的理想选择。",{"type":18,"tag":26,"props":299,"children":300},{},[301],{"type":24,"value":302},"在Embedding的选择和RAG技术的使用上，MindPilot借鉴了QAnything使用的技术。",{"type":18,"tag":26,"props":304,"children":305},{},[306],{"type":24,"value":307},"我们使用了bce-embedding-base_v1模型进行文本的向量化，是目前最强的Embedding模型，有非常强大的双语和跨语种能力，能消除语义检索里面的中英语言之间的差异。",{"type":18,"tag":26,"props":309,"children":310},{},[311],{"type":18,"tag":84,"props":312,"children":314},{"alt":7,"src":313},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/47023beaf3e64674a5f67220585309a6.png",[],{"type":18,"tag":26,"props":316,"children":317},{},[318],{"type":18,"tag":84,"props":319,"children":321},{"alt":7,"src":320},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/befc7e76bd074aac9129a6a5935bd91e.png",[],{"type":18,"tag":26,"props":323,"children":324},{},[325],{"type":18,"tag":84,"props":326,"children":328},{"alt":7,"src":327},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/4d72992a63cd472abe0c7509bec749f1.png",[],{"type":18,"tag":26,"props":330,"children":331},{},[332],{"type":24,"value":333},"在RAG技术的设计上，首先进行文档的解析和分割。然后通过Embedding模型将文本转换为向量。存储在数据库中。",{"type":18,"tag":26,"props":335,"children":336},{},[337],{"type":24,"value":338},"当用户提出查询时，系统首先用大语言模型(LLM)理解查询意图，然后进行两轮检索：第一轮使用嵌入方法从数据库检索相关文档块，第二轮对这些文档块进行重新排序。排序后的文档块被送入另一个LLM阅读器，结合原始查询生成最终答案。整个过程形成了一个完整的管道，从查询理解到信息检索，再到答案生成，旨在提供更精确、有依据的回答，提高问答系统的准确性和相关性。",{"type":18,"tag":26,"props":340,"children":341},{},[342],{"type":18,"tag":84,"props":343,"children":345},{"alt":7,"src":344},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/5c7b99f504f7446e9af018924a538815.png",[],{"type":18,"tag":26,"props":347,"children":348},{},[349],{"type":24,"value":350},"为什么是两阶段检索? 知识库数据量大的场景下两阶段优势非常明显，如果只用一阶段embedding检索，随着数据量增大会出现检索退化的问题，如下图中绿线所示，二阶段rerank重排后能实现准确率稳定增长，即数据越多，效果越好。",{"type":18,"tag":26,"props":352,"children":353},{},[354],{"type":18,"tag":84,"props":355,"children":357},{"alt":7,"src":356},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/04c4fa2906954ed5b9b0d0107ec8d5f7.png",[],{"type":18,"tag":26,"props":359,"children":360},{},[361],{"type":24,"value":362},"QAnything项目中提出的两阶段检索技术",{"type":18,"tag":26,"props":364,"children":365},{},[366],{"type":18,"tag":32,"props":367,"children":368},{},[369],{"type":24,"value":370},"界面和效果展示",{"type":18,"tag":26,"props":372,"children":373},{},[374],{"type":18,"tag":84,"props":375,"children":377},{"alt":7,"src":376},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/4da7e80f8db947dc86574e394794e3d0.png",[],{"type":18,"tag":26,"props":379,"children":380},{},[381],{"type":24,"value":382},"对话界面",{"type":18,"tag":26,"props":384,"children":385},{},[386],{"type":18,"tag":84,"props":387,"children":389},{"alt":7,"src":388},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/fff4291f3baf4ba6b7fafee9cbad317c.png",[],{"type":18,"tag":26,"props":391,"children":392},{},[393],{"type":24,"value":394},"默认Agent",{"type":18,"tag":26,"props":396,"children":397},{},[398],{"type":18,"tag":84,"props":399,"children":401},{"alt":7,"src":400},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/933d46891dae4640a1e137ab537b397e.png",[],{"type":18,"tag":26,"props":403,"children":404},{},[405],{"type":24,"value":406},"自定义Agent并结构化输出",{"type":18,"tag":26,"props":408,"children":409},{},[410],{"type":18,"tag":84,"props":411,"children":413},{"alt":7,"src":412},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/11/01/373fac2ac5724702a5d3b25f46e7a5b5.png",[],{"type":18,"tag":26,"props":415,"children":416},{},[417],{"type":24,"value":418},"知识库搜索",{"type":18,"tag":26,"props":420,"children":421},{},[422],{"type":18,"tag":32,"props":423,"children":424},{},[425],{"type":24,"value":426},"未来发展：",{"type":18,"tag":26,"props":428,"children":429},{},[430],{"type":18,"tag":32,"props":431,"children":432},{},[433],{"type":24,"value":434},"基于MindSpore和MindNLP的持续创新",{"type":18,"tag":26,"props":436,"children":437},{},[438],{"type":24,"value":439},"**兼容更多的离线模型：**基于MindNLP的支持，我们的MindPilot在未来会支持更多更全的离线模型，并提供离线的Agent能力，保证数据安全性和隐私性。",{"type":18,"tag":26,"props":441,"children":442},{},[443],{"type":24,"value":444},"**增加更多工具，并设计自定义工具模板：**将扩展系统的工具库，增加更多工具的集成，并设计自定义工具模板。这将允许用户根据自身需求，灵活配置和使用各种工具，进一步增强系统的多功能性。自定义工具模板功能的开发将使用户能够快速将新工具集成到系统中，满足不同任务的需求。",{"type":18,"tag":26,"props":446,"children":447},{},[448],{"type":24,"value":449},"**为垂直行业的模型增加更客制化：**为特定行业（如医疗、金融、法律等）定制优化模型，并集成行业专属的工具和功能模块。这一迭代将使MindPilot在这些领域展现出更强的专业性，从而吸引更多的行业用户，扩大我们的市场份额。",{"type":18,"tag":26,"props":451,"children":452},{},[453],{"type":18,"tag":32,"props":454,"children":455},{},[456],{"type":24,"value":457},"安装教程",{"type":18,"tag":212,"props":459,"children":460},{},[461,466,479,484,495,500],{"type":18,"tag":216,"props":462,"children":463},{},[464],{"type":24,"value":465},"克隆",{"type":18,"tag":216,"props":467,"children":468},{},[469],{"type":18,"tag":470,"props":471,"children":473},"pre",{"code":472},"git clone https://github.com/ResDream/MindPilot.git\n",[474],{"type":18,"tag":475,"props":476,"children":477},"code",{"__ignoreMap":7},[478],{"type":24,"value":472},{"type":18,"tag":216,"props":480,"children":481},{},[482],{"type":24,"value":483},"前端",{"type":18,"tag":216,"props":485,"children":486},{},[487],{"type":18,"tag":470,"props":488,"children":490},{"code":489},"cd Frontend\n   yarn\n \n  # 为指定平台构建:\n   # Windows 平台\n    $ yarn build:win\n   \n    # macOS 平台\n    $ yarn build:mac\n   \n    # Linux 平台\n    $ yarn build:linux\n",[491],{"type":18,"tag":475,"props":492,"children":493},{"__ignoreMap":7},[494],{"type":24,"value":489},{"type":18,"tag":216,"props":496,"children":497},{},[498],{"type":24,"value":499},"后端",{"type":18,"tag":216,"props":501,"children":502},{},[503],{"type":18,"tag":470,"props":504,"children":506},{"code":505},"   # 安装依赖\n   pip install -r requirements.txt\n",[507],{"type":18,"tag":475,"props":508,"children":509},{"__ignoreMap":7},[510],{"type":24,"value":505},{"type":18,"tag":26,"props":512,"children":513},{},[514],{"type":18,"tag":32,"props":515,"children":516},{},[517],{"type":24,"value":518},"使用指南",{"type":18,"tag":26,"props":520,"children":521},{},[522],{"type":18,"tag":32,"props":523,"children":524},{},[525],{"type":24,"value":526},"1、启动MindPilot",{"type":18,"tag":470,"props":528,"children":530},{"code":529},"  # 前端\n  cd Frontend\n  yarn dev\n \n  # 后端\n  cd src/mindpilot\n  python main.py\n",[531],{"type":18,"tag":475,"props":532,"children":533},{"__ignoreMap":7},[534],{"type":24,"value":529},{"type":18,"tag":26,"props":536,"children":537},{},[538],{"type":18,"tag":32,"props":539,"children":540},{},[541],{"type":24,"value":542},"2、配置搜索功能",{"type":18,"tag":26,"props":544,"children":545},{},[546],{"type":24,"value":547},"打开文件 src/mindpilot/app/configs/tool_config.py。在如下代码中填入 Bing 搜索 API:",{"type":18,"tag":470,"props":549,"children":551},{"code":550},"\"search_internet\": {\n            \"use\": False,\n            \"search_engine_name\": \"bing\",\n            \"search_engine_config\": {\n                \"bing\": {\n                    \"result_len\": 3,\n                    \"bing_search_url\": \"https://api.bing.microsoft.com/v7.0/search\",\n                    \"bing_key\": \"\",\n                },\n            },\n",[552],{"type":18,"tag":475,"props":553,"children":554},{"__ignoreMap":7},[555],{"type":24,"value":550},{"type":18,"tag":26,"props":557,"children":558},{},[559],{"type":18,"tag":32,"props":560,"children":561},{},[562],{"type":24,"value":563},"3、创建并配置代理",{"type":18,"tag":26,"props":565,"children":566},{},[567,569],{"type":24,"value":568},"在应用内选择“创建代理”，并按照提示完成设置。 ",{"type":18,"tag":32,"props":570,"children":571},{},[572],{"type":24,"value":573},"4、启动任务",{"type":18,"tag":26,"props":575,"children":576},{},[577],{"type":24,"value":578},"输入你的任务需求，MindPilot 将自动分解并规划任务。",{"type":18,"tag":26,"props":580,"children":581},{},[582],{"type":18,"tag":32,"props":583,"children":584},{},[585],{"type":24,"value":586},"作者简介",{"type":18,"tag":26,"props":588,"children":589},{},[590],{"type":24,"value":591},"**郭嘉梁，**天津大学智能与计算学部自然语言处理方向研一学生；",{"type":18,"tag":26,"props":593,"children":594},{},[595],{"type":24,"value":596},"学术竞赛成绩：挑战杯全国大学生课外学术科技作品全国三等奖，中国大学生计算机设计大赛国家二等奖，中国计算机博弈大赛全国一等奖，中国软件杯全国三等奖，东北三省数学建模竞赛一等奖，东北地方ccpc大学生程序竞赛三等奖。",{"title":7,"searchDepth":598,"depth":598,"links":599},4,[],"markdown","content:technology-blogs:zh:3451.md","content","technology-blogs/zh/3451.md","technology-blogs/zh/3451","md",1776506129765]