文章列表

3分钟!教会你用Doris+DeepSeek搭建RAG知识库(喂饭级教程)

作者:微信小助手

<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 10px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(90deg, rgba(50, 0, 0, 0.03) 0%, rgba(255, 255, 255, 0) 11.49%), linear-gradient(360deg, rgba(50, 0, 0, 0.04) 0%, rgba(255, 255, 255, 0) 12.16%);background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: repeat, repeat;background-size: 20px 20px, 20px 20px;width: auto;font-family: Optima, PingFangSC-light, serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;overflow-wrap: break-word;text-align: left;"> <blockquote style="margin-top: 20px;margin-bottom: 20px;margin-left: 0px;margin-right: 0px;padding-top: 10px;padding-bottom: 10px;padding-left: 20px;padding-right: 10px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(64, 184, 255, 0.4);border-bottom-color: rgba(64, 184, 255, 0.4);border-left-color: rgba(64, 184, 255, 0.4);border-right-color: rgba(64, 184, 255, 0.4);border-top-left-radius: 8px;border-top-right-radius: 8px;border-bottom-right-radius: 8px;border-bottom-left-radius: 8px;background-attachment: scroll;background-clip: border-box;background-color: rgba(64, 184, 250, 0.1);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;display: block;overflow-x: auto;overflow-y: auto;"> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">清晨,我泡上一杯98年的咖啡,打开电脑,收到一条来自Doris用户的消息:&nbsp;</span></p> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">"请问有 将doris数据库数据作为deepseek大模型的知识库的方法吗"&nbsp;</span></p> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">"好滴,安排!"&nbsp;</span></p> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">于是,和这位Doris用户聊了聊,发现这类需求随着DeepSeek的爆火被无限放大了,但也确实是一个‌引申的</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">机遇与挑战</span></strong><span leaf="">。&nbsp;</span></p> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">也罢,今天就来一探究竟,一起学习学习如何基于</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Doris+DeepSeek</span></strong><span leaf="">打造你的专属AI助手!</span></p> </blockquote> <section style="text-align: center;" nodeleaf=""> <img src="/upload/4b8d355c96f8991678f07238350977c0.png" class="rich_pages wxw-img" data-ratio="0.6018957345971564" data-s="300,640" data-type="png" data-w="844" style="width:100%;" type="block" data-backw="549" data-backh="330" data-imgfileid="503003868"> </section> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsqnj5xwicjricawate7kicmzdria8lyice261phiavu1wfztvvwx9i9vcaew 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">术语名词</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin: 0px 0px 8px;padding: 8px 0px;"><span leaf="">在开始之前,先用大白话,介绍下几个术语名词:</span></p> <section style="text-align: center;margin-bottom: 16px;" nodeleaf=""> <img src="/upload/431ea0a1801fc25d1f60817ab5dc92e4.png" class="rich_pages wxw-img" data-ratio="0.7666666666666667" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003880"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ AGI:通用人工智能,AI界的"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">全能学霸</span></strong><span leaf="">"。致力于像人类一样能学数学、写诗、看病,甚至自己发明工具,目前还是科幻级存在。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ AIGC:人工智能生成,AI的"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">创作工厂</span></strong><span leaf="">"。输入一句话,自动生成文章/插画/音乐。DeepSeek写情书,Midjourney画星空,都是它的拿手好戏。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ LLM:大语言模型,AI专属"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">语言魔术师</span></strong><span leaf="">"。吃下全网文本,练就聊天/编程/翻译神技。DeepSeek、ChatGPT、Grok都是这类超级话痨。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ LangChain:AI基础平台,AI应用的"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">乐高积木</span></strong><span leaf="">"。把聊天机器人、文档分析、LLM、Doris等功能模块化,开发者像搭积木一样快速拼出智能应用。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">4️⃣ RAG:检索增强生成,AI的"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">外接大脑</span></strong><span leaf="">"。给模型配个随身百科,回答前先翻书查资料。比如让</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Doris+DeepSeek</span></strong><span leaf="">用你公司的产品手册回答问题。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">5️⃣ Fine-tuning:微调,AI的"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">私人教练</span></strong><span leaf="">"。用行业秘籍给通用模型开小灶。比如用Doris最佳实践集训练,让DeepSeek秒变Doris专家。这块需要注意:越是微调,专用性越强,通用性越弱。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">小贴士</span></strong><span leaf="">:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Fine-tuning 微调如同给DeepSeek做</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">定制</span></strong><span leaf="">手术——通过专业训练让模型精通某个领域,但越专精就越难跨界(比如医疗AI看不懂法律条文)。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">RAG则是给DeepSeek装智能U盘(</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">外挂</span></strong><span leaf="">)——不修改模型本身,回答时自动调取知识库内容(好比律师查法典办案),通用性无损还能随时更新知识。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Doris+DeepSeek</span></strong><span leaf="">的结合,其实就是</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">RAG</span></strong><span leaf="">应用了。</span></p> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsqnj5xwicjricawate7kicmzdria8lyice261phiavu1wfztvvwx9i9vcaew 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">一分钟定方案</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Apache Doris作为一款基于 MPP 架构的高性能、实时分析型</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">开源</span></strong><span leaf="">数据库,具备优秀的计算检索能力。既能支持</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">高并发</span></strong><span leaf="">的点查询场景,也能支持</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">高吞吐</span></strong><span leaf="">的复杂分析场景,还能进行</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">PB级日志检索</span></strong><span leaf="">,并完美融合</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">湖仓一体</span></strong><span leaf="">。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">DeepSeek则是新一代的开源大语言模型,具有强大的语义理解和推理能力,以高性价比和</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">开源</span></strong><span leaf="">著称。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">两者结合,如何解决个人和企业知识库的难题?</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">正当我思考时,灵光一闪:</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/d7a0a49a0c0688f817739c54bbf06687.png" class="rich_pages wxw-img" data-ratio="0.7509259259259259" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003869"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">方案主要分为</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">4个模块</span></strong><span leaf="">:</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">1. 数据源端(Sources)</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">接入本地知识库的文件数据,做</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">加载、清洗和分割</span></strong><span leaf="">处理。</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">2. 数据导入端(Embedding)</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Vector Embedding(向量嵌入)是将文本、图像等数据转换为</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">数值向量</span></strong><span leaf="">的机器学习技术,其核心是通过高维空间中的向量位置来捕捉数据的语义信息。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">实现向量化的就是Embedding,一段文本向量化会转化为</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">一堆浮点数</span></strong><span leaf="">,这些浮点数排列在一起就像一个数组,例如某段话向量化:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">[0.30633423, 0.32576653, -1.4459475, 0.8461606, 0.015846528...]</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">这一步主要是基于这类技术将数据源进行向量化存到Doris。</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">3. 数据融合端(LLM)</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">大模型的知识库存在两大局限:</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">时效性</span></strong><span leaf="">天花板(如deepseek-r1:14b的知识截至2024年7月)和个人/企业</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">知识盲区</span></strong><span leaf="">(无法获取内部资料)。</span></p><span style="cursor:pointer;" data-tool="mdnice编辑器"> <section data-formula="\text{AI智能升级公式} = \frac{\text{DeepSeek 大模型通用能力} \times \text{Doris知识库}}{\text{传统人工培训}} " style="text-align: center;overflow-x: auto;overflow-y: auto;display: block;"> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -1426 25540.2 2336" aria-hidden="true" style="vertical-align: -2.059ex;width: 57.783ex;height: 5.285ex;max-width: 300% !important;"> <g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"> <g data-mml-node="math"> <g data-mml-node="mtext"> <path data-c="41" d="M255 0Q240 3 140 3Q48 3 39 0H32V46H47Q119 49 139 88Q140 91 192 245T295 553T348 708Q351 716 366 716H376Q396 715 400 709Q402 707 508 390L617 67Q624 54 636 51T687 46H717V0H708Q699 3 581 3Q458 3 437 0H427V46H440Q510 46 510 64Q510 66 486 138L462 209H229L209 150Q189 91 189 85Q189 72 209 59T259 46H264V0H255ZM447 255L345 557L244 256Q244 255 345 255H447Z"></path> <path data-c="49" d="M328 0Q307 3 180 3T32 0H21V46H43Q92 46 106 49T126 60Q128 63 128 342Q128 620 126 623Q122 628 118 630T96 635T43 637H21V683H32Q53 680 180 680T328 683H339V637H317Q268 637 254 634T234 623Q232 620 232 342Q232 63 234 60Q238 55 242 53T264 48T317 46H339V0H328Z" transform="translate(750, 0)"></path> <text data-variant="normal" transform="translate(1111, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 智 </tspan> </text> <text data-variant="normal" transform="translate(2045.6, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 能 </tspan> </text> <text data-variant="normal" transform="translate(2980.1, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 升 </tspan> </text> <text data-variant="normal" transform="translate(3914.7, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 级 </tspan> </text> <text data-variant="normal" transform="translate(4849.2, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 公 </tspan> </text> <text data-variant="normal" transform="translate(5783.8, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 式 </tspan> </text> </g> <g data-mml-node="mo" transform="translate(6996.1, 0)"> <path data-c="3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path> </g> <g data-mml-node="mfrac" transform="translate(7774.1, 0)"> <g data-mml-node="mrow" transform="translate(220, 676)"> <g data-mml-node="mtext"> <path data-c="44" d="M130 622Q123 629 119 631T103 634T60 637H27V683H228Q399 682 419 682T461 676Q504 667 546 641T626 573T685 470T708 336Q708 210 634 116T442 3Q429 1 228 0H27V46H60Q102 47 111 49T130 61V622ZM593 338Q593 439 571 501T493 602Q439 637 355 637H322H294Q238 637 234 628Q231 624 231 344Q231 62 232 59Q233 49 248 48T339 46H350Q456 46 515 95Q561 133 577 191T593 338Z"></path> <path data-c="65" d="M28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275Z" transform="translate(764, 0)"></path> <path data-c="65" d="M28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275Z" transform="translate(1208, 0)"></path> <path data-c="70" d="M36 -148H50Q89 -148 97 -134V-126Q97 -119 97 -107T97 -77T98 -38T98 6T98 55T98 106Q98 140 98 177T98 243T98 296T97 335T97 351Q94 370 83 376T38 385H20V408Q20 431 22 431L32 432Q42 433 61 434T98 436Q115 437 135 438T165 441T176 442H179V416L180 390L188 397Q247 441 326 441Q407 441 464 377T522 216Q522 115 457 52T310 -11Q242 -11 190 33L182 40V-45V-101Q182 -128 184 -134T195 -145Q216 -148 244 -148H260V-194H252L228 -193Q205 -192 178 -192T140 -191Q37 -191 28 -194H20V-148H36ZM424 218Q424 292 390 347T305 402Q234 402 182 337V98Q222 26 294 26Q345 26 384 80T424 218Z" transform="translate(1652, 0)"></path> <path data-c="53" d="M55 507Q55 590 112 647T243 704H257Q342 704 405 641L426 672Q431 679 436 687T446 700L449 704Q450 704 453 704T459 705H463Q466 705 472 699V462L466 456H448Q437 456 435 459T430 479Q413 605 329 646Q292 662 254 662Q201 662 168 626T135 542Q135 508 152 480T200 435Q210 431 286 412T370 389Q427 367 463 314T500 191Q500 110 448 45T301 -21Q245 -21 201 -4T140 27L122 41Q118 36 107 21T87 -7T78 -21Q76 -22 68 -22H64Q61 -22 55 -16V101Q55 220 56 222Q58 227 76 227H89Q95 221 95 214Q95 182 105 151T139 90T205 42T305 24Q352 24 386 62T420 155Q420 198 398 233T340 281Q284 295 266 300Q261 301 239 306T206 314T174 325T141 343T112 367T85 402Q55 451 55 507Z" transform="translate(2208, 0)"></path> <path data-c="65" d="M28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275Z" transform="translate(2764, 0)"></path> <path data-c="65" d="M28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275Z" transform="translate(3208, 0)"></path> <path data-c="6B" d="M36 46H50Q89 46 97 60V68Q97 77 97 91T97 124T98 167T98 217T98 272T98 329Q98 366 98 407T98 482T98 542T97 586T97 603Q94 622 83 628T38 637H20V660Q20 683 22 683L32 684Q42 685 61 686T98 688Q115 689 135 690T165 693T176 694H179V463L180 233L240 287Q300 341 304 347Q310 356 310 364Q310 383 289 385H284V431H293Q308 428 412 428Q475 428 484 431H489V385H476Q407 380 360 341Q286 278 286 274Q286 273 349 181T420 79Q434 60 451 53T500 46H511V0H505Q496 3 418 3Q322 3 307 0H299V46H306Q330 48 330 65Q330 72 326 79Q323 84 276 153T228 222L176 176V120V84Q176 65 178 59T189 49Q210 46 238 46H254V0H246Q231 3 137 3T28 0H20V46H36Z" transform="translate(3652, 0)"></path> <path data-c="20" d="" transform="translate(4180, 0)"></path> <text data-variant="normal" transform="translate(4430, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 大 </tspan> </text> <text data-variant="normal" transform="translate(5364.6, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 模 </tspan> </text> <text data-variant="normal" transform="translate(6299.1, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 型 </tspan> </text> <text data-variant="normal" transform="translate(7233.7, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 通 </tspan> </text> <text data-variant="normal" transform="translate(8168.2, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 用 </tspan> </text> <text data-variant="normal" transform="translate(9102.8, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 能 </tspan> </text> <text data-variant="normal" transform="translate(10037.4, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 力 </tspan> </text> </g> <g data-mml-node="mo" transform="translate(11194.1, 0)"> <path data-c="D7" d="M630 29Q630 9 609 9Q604 9 587 25T493 118L389 222L284 117Q178 13 175 11Q171 9 168 9Q160 9 154 15T147 29Q147 36 161 51T255 146L359 250L255 354Q174 435 161 449T147 471Q147 480 153 485T168 490Q173 490 175 489Q178 487 284 383L389 278L493 382Q570 459 587 475T609 491Q630 491 630 471Q630 464 620 453T522 355L418 250L522 145Q606 61 618 48T630 29Z"></path> </g> <g data-mml-node="mtext" transform="translate(12194.4, 0)"> <path data-c="44" d="M130 622Q123 629 119 631T103 634T60 637H27V683H228Q399 682 419 682T461 676Q504 667 546 641T626 573T685 470T708 336Q708 210 634 116T442 3Q429 1 228 0H27V46H60Q102 47 111 49T130 61V622ZM593 338Q593 439 571 501T493 602Q439 637 355 637H322H294Q238 637 234 628Q231 624 231 344Q231 62 232 59Q233 49 248 48T339 46H350Q456 46 515 95Q561 133 577 191T593 338Z"></path> <path data-c="6F" d="M28 214Q28 309 93 378T250 448Q340 448 405 380T471 215Q471 120 407 55T250 -10Q153 -10 91 57T28 214ZM250 30Q372 30 372 193V225V250Q372 272 371 288T364 326T348 362T317 390T268 410Q263 411 252 411Q222 411 195 399Q152 377 139 338T126 246V226Q126 130 145 91Q177 30 250 30Z" transform="translate(764, 0)"></path> <path data-c="72" d="M36 46H50Q89 46 97 60V68Q97 77 97 91T98 122T98 161T98 203Q98 234 98 269T98 328L97 351Q94 370 83 376T38 385H20V408Q20 431 22 431L32 432Q42 433 60 434T96 436Q112 437 131 438T160 441T171 442H174V373Q213 441 271 441H277Q322 441 343 419T364 373Q364 352 351 337T313 322Q288 322 276 338T263 372Q263 381 265 388T270 400T273 405Q271 407 250 401Q234 393 226 386Q179 341 179 207V154Q179 141 179 127T179 101T180 81T180 66V61Q181 59 183 57T188 54T193 51T200 49T207 48T216 47T225 47T235 46T245 46H276V0H267Q249 3 140 3Q37 3 28 0H20V46H36Z" transform="translate(1264, 0)"></path> <path data-c="69" d="M69 609Q69 637 87 653T131 669Q154 667 171 652T188 609Q188 579 171 564T129 549Q104 549 87 564T69 609ZM247 0Q232 3 143 3Q132 3 106 3T56 1L34 0H26V46H42Q70 46 91 49Q100 53 102 60T104 102V205V293Q104 345 102 359T88 378Q74 385 41 385H30V408Q30 431 32 431L42 432Q52 433 70 434T106 436Q123 437 142 438T171 441T182 442H185V62Q190 52 197 50T232 46H255V0H247Z" transform="translate(1656, 0)"></path> <path data-c="73" d="M295 316Q295 356 268 385T190 414Q154 414 128 401Q98 382 98 349Q97 344 98 336T114 312T157 287Q175 282 201 278T245 269T277 256Q294 248 310 236T342 195T359 133Q359 71 321 31T198 -10H190Q138 -10 94 26L86 19L77 10Q71 4 65 -1L54 -11H46H42Q39 -11 33 -5V74V132Q33 153 35 157T45 162H54Q66 162 70 158T75 146T82 119T101 77Q136 26 198 26Q295 26 295 104Q295 133 277 151Q257 175 194 187T111 210Q75 227 54 256T33 318Q33 357 50 384T93 424T143 442T187 447H198Q238 447 268 432L283 424L292 431Q302 440 314 448H322H326Q329 448 335 442V310L329 304H301Q295 310 295 316Z" transform="translate(1934, 0)"></path> <text data-variant="normal" transform="translate(2328, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 知 </tspan> </text> <text data-variant="normal" transform="translate(3262.6, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 识 </tspan> </text> <text data-variant="normal" transform="translate(4197.1, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 库 </tspan> </text> </g> </g> <g data-mml-node="mtext" transform="translate(6079.3, -710)"> <text data-variant="normal" transform="matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 传 </tspan> </text> <text data-variant="normal" transform="translate(934.6, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 统 </tspan> </text> <text data-variant="normal" transform="translate(1869.1, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 人 </tspan> </text> <text data-variant="normal" transform="translate(2803.7, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 工 </tspan> </text> <text data-variant="normal" transform="translate(3738.2, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 培 </tspan> </text> <text data-variant="normal" transform="translate(4672.8, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 训 </tspan> </text> </g> <rect width="17526" height="60" x="120" y="220"></rect> </g> </g> </g><g></g> </svg> </section></span> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">要让AI真正掌握业务精髓,还需:</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <p style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">知识注入</span></strong><span leaf="">:将个人/企业专属的《XXX》存入Doris数据库,相当于给AI装上"行业大脑"</span></p> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <p style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">智能关联</span></strong><span leaf="">:遇到复杂问题时,DeepSeek AI会自动关联多个知识库的章节内容,像资深专家般综合分析,妥妥的AI助手</span></p> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <p style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">精准应答</span></strong><span leaf="">:基于实时更新的个人/企业知识库,DeepSeek AI能给出贴合业务场景的解决方案</span></p> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">简单而已一句话:</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">将自己的知识内容喂给LLM,让LLM结合我们给出的知识去回答问题</span></strong><span leaf="">。</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">4. 数据客户端(Processing)</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">进行常规QA,</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">提问入口</span></strong><span leaf="">。</span></p> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsqnj5xwicjricawate7kicmzdria8lyice261phiavu1wfztvvwx9i9vcaew 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">一分钟撕代码</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">确定好方案后,即刻开撕代码。</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">环境准备</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">Doris环境</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">🔗 Doris部署:<span textstyle="" style="color: rgb(0, 128, 255);text-decoration: underline;">https://doris.apache.org/zh-CN/docs/dev/gettingStarted/quick-start</span></span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">如果已经有Doris集群,直接用即可。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">若当前还没Doris环境,可以参考Doris官方文档,基于Docker或本地化快速部署搭建一套Doris集群:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># Docker为例</span></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 1. 创建 docker-compose.yaml 文件</span></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 复制以下内容到 docker-compose.yaml 文件中,并将 DORIS_QUICK_START_VERSION 替换为指定的 Doris 版本,例如 2.1.8。</span></span><span leaf=""><br></span><span leaf="">version:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"3"</span></span><span leaf=""><br></span><span leaf="">services:</span><span leaf=""><br></span><span leaf="">&nbsp; fe:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; image: apache/doris.fe-ubuntu:</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">${DORIS_QUICK_START_VERSION}</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; hostname: fe</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; environment:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp;- FE_SERVERS=fe1:127.0.0.1:9010</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp;- FE_ID=1</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; network_mode: host</span><span leaf=""><br></span><span leaf="">&nbsp; be:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; image: apache/doris.be-ubuntu:</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">${DORIS_QUICK_START_VERSION}</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; hostname: be</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; environment:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp;- FE_SERVERS=fe1:127.0.0.1:9010</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp;- BE_ADDR=127.0.0.1:9050</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; depends_on:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; - fe</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; network_mode: host</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 2. 启动Doris集群</span></span><span leaf=""><br></span><span leaf="">docker-compose -f ./docker-compose.yaml up -d</span><span leaf=""><br></span></code></pre> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">DeepSeeek环境</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">本地部署的Ollama+DeepSeek,网上教程非常多,本文还是就不单独介绍了。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">简而言之,参考一臻整理的如下简图(两步完成不带WebUI):</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/051fe237c5c66cd08288b99bc6370738.png" class="rich_pages wxw-img" data-ratio="0.5935185185185186" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003870"> </section> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">Python环境</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">本次使用的Python版本是</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">3.8.17</span></strong><span leaf="">,相关的包都可以畅通无阻的install(建议用</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">conda</span></strong><span leaf="">管理py环境):</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">pip install langchain</span><span leaf=""><br></span><span leaf="">pip install langchain-community</span><span leaf=""><br></span><span leaf="">pip install -qU langchain-community</span><span leaf=""><br></span><span leaf="">pip install &nbsp;sqlalchemy</span><span leaf=""><br></span><span leaf="">pip install --upgrade --quiet &nbsp;pymysql</span><span leaf=""><br></span><span leaf="">pip install markdown</span><span leaf=""><br></span></code></pre> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">代码实现</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">经过一臻</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">七七四十九秒</span></strong><span leaf="">的编写调试,完整代码如下:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;dataclasses&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;dataclass</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;contextlib&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;contextmanager</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;langchain_community.llms.ollama&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;Ollama</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;langchain_community.embeddings.ollama&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;OllamaEmbeddings</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;langchain_community.document_loaders&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;DirectoryLoader, UnstructuredMarkdownLoader</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;langchain_core.output_parsers&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;StrOutputParser</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;langchain_core.prompts&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;ChatPromptTemplate</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;langchain_core.runnables&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;RunnablePassthrough, RunnableLambda</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;langchain_text_splitters&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;TokenTextSplitter</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;langchain_community.vectorstores.apache_doris&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;ApacheDorisSettings, ApacheDoris</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;pymysql&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;connect</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;pymysql.connections&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;Connection</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #61aeee;line-height: 26px;"><span leaf="">@dataclass</span></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">class</span></span><span leaf="">&nbsp;</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">DorisConfig</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Apache Doris configuration"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; host: str</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; port: int</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; username: str</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; password: str</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; database: str</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; table: str</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">to_settings</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf="">&nbsp;-&gt; ApacheDorisSettings:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Convert config to ApacheDorisSettings"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; settings = ApacheDorisSettings()</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; settings.host = self.host</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; settings.port = self.port</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; settings.username = self.username</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; settings.password = self.password</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; settings.database = self.database</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; settings.table = self.table</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf="">&nbsp;settings</span><span leaf=""><br></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">class</span></span><span leaf="">&nbsp;</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">DocumentLoader</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Document loading and processing"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">__init__</span></span><span style="line-height: 26px;"><span leaf="">(self, docs_dir: str, chunk_size: int =&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">400</span></span><span leaf="">, chunk_overlap: int =&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">50</span></span><span leaf="">)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.docs_dir = docs_dir</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.chunk_size = chunk_size</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.chunk_overlap = chunk_overlap</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">load_and_split</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Load and split documents into chunks"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; loader = DirectoryLoader(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.docs_dir,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glob=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"**/*.md"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader_cls=UnstructuredMarkdownLoader</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; )</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; docs = loader.load()</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; splitter = TokenTextSplitter(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk_size=self.chunk_size,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk_overlap=self.chunk_overlap</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; )</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf="">&nbsp;splitter.split_documents(docs)</span><span leaf=""><br></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">class</span></span><span leaf="">&nbsp;</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">Doris</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Apache Doris database operations"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">__init__</span></span><span style="line-height: 26px;"><span leaf="">(self, config: DorisConfig)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.config = config</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #61aeee;line-height: 26px;"><span leaf="">&nbsp; &nbsp; @contextmanager</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">get_connection</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf="">&nbsp;-&gt; Connection:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Get database connection with context management"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; conn = connect(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; host=self.config.host,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; port=self.config.port,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user=self.config.username,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; password=self.config.password,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; database=self.config.database</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; )</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">try</span></span><span leaf="">:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">yield</span></span><span leaf="">&nbsp;conn</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">finally</span></span><span leaf="">:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conn.close()</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">get_context</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf="">&nbsp;-&gt; str:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Get context from database"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">with</span></span><span leaf="">&nbsp;self.get_connection()&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">as</span></span><span leaf="">&nbsp;conn:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cursor = conn.cursor()</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cursor.execute(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">f"SELECT document FROM `</span><span style="color: #e06c75;line-height: 26px;"><span leaf="">{self.config.table}</span></span><span leaf="">`"</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rows = cursor.fetchall()</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">"\n"</span></span><span leaf="">.join(row[</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">0</span></span><span leaf="">]&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">for</span></span><span leaf="">&nbsp;row&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf="">&nbsp;rows)</span><span leaf=""><br></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">class</span></span><span leaf="">&nbsp;</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">QASystem</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Question Answering System"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">__init__</span></span><span style="line-height: 26px;"><span leaf="">(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; config: DorisConfig,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; docs_dir: str =&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"./docs"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; embedding_model: str =&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"bge-m3"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; llm_model: str =&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"deepseek-r1"</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; )</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.config = config</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.docs_dir = docs_dir</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.embedding_model = embedding_model</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.llm_model = llm_model</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.db = Doris(config)</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">initialize_vectorstore</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Initialize vector store with documents"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; loader = DocumentLoader(self.docs_dir)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; docs = loader.load_and_split()</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; embeddings = OllamaEmbeddings(model=self.embedding_model)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; ApacheDoris.from_documents(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; docs,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; embeddings,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; config=self.config.to_settings()</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; )</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">get_qa_chain</span></span><span style="line-height: 26px;"><span leaf="">(self, context: str)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Create QA chain"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; template =&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; Answer the question based only on the following context:{context}</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; Question: 请严格结合{context}的内容回答{question}的问题,别发散,说人话。</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; """</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; prompt = ChatPromptTemplate.from_template(template)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; llm = Ollama(model=self.llm_model)</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf="">&nbsp;(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"context"</span></span><span leaf="">: RunnableLambda(</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">lambda</span></span><span leaf="">&nbsp;d: context),</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"question"</span></span><span leaf="">: RunnablePassthrough()</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | prompt</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | llm</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | StrOutputParser()</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; )</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">query</span></span><span style="line-height: 26px;"><span leaf="">(self, question: str)</span></span><span leaf="">&nbsp;-&gt; str:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Query the QA system"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; context = self.db.get_context()</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; qa_chain = self.get_qa_chain(context)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf="">&nbsp;qa_chain.invoke(question)</span><span leaf=""><br></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">main</span></span><span style="line-height: 26px;"><span leaf="">()</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># Configuration</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; config = DorisConfig(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; host=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{按需补齐}"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; port=</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">9030</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; username=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{按需补齐}"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; password=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{按需补齐}"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; database=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{按需补齐}"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; table=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{按需补齐,默认langchain}"</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; )</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># Initialize QA system</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; qa_system = QASystem(config)</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># Initialize vector store (only needed once)</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; qa_system.initialize_vectorstore()</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># Query example</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; question =&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"请介绍下Apache Doris,以及当前最新的Release版本是多少"</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; response = qa_system.query(question)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; print(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"----- Response -----"</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; print(response)</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">if</span></span><span leaf="">&nbsp;__name__ ==&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"__main__"</span></span><span leaf="">:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; main()</span><span leaf=""><br></span></code></pre> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">代码解析</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">代码经过精简,很多block没有进行过多地细化深入。主要是为了让大家能够快速熟悉Doris+DeepSeek的完整流程,后续可以结合自己需求,按模块进行调整应用。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">代码主流程如下:</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/a0641287cca0deeee1a3722aa60e45da.png" class="rich_pages wxw-img" data-ratio="1.1675925925925925" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003871"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin: 16px 0px 0px;padding: 8px 0px;"><span leaf="">从里到外,每一层的解析:</span></p> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">DorisConfig</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要功能分为2个方面:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 配置集中管理</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">封装 Doris 数据库连接所需的 6 个关键参数。使用类型注解确保配置数据的正确性。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 配置格式转换</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">to_settings() 方法将配置转换为 LangChain 官方库 ApacheDoris 模块需要的参数格式,方便与 LangChain 的 Apache Doris进行集成。</span></p> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">Doris</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要职责分为三个层次:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 连接管理</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">基于 DorisConfig 配置创建数据库连接</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">使用 @contextmanager 实现安全的连接上下文管理</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">自动处理连接异常和资源释放</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 数据操作</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">执行指定 SQL 查询(当前实现为获取全部 document 字段,即直接获取全部内容喂给DeepSeek;暂时没用到</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">embedding</span></strong><span leaf="">值,后续可以结合起来用,效果更佳)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">将查询结果拼接为字符串返回</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">为上层 QASystem 提供原始数据输入</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 资源隔离</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">封装所有数据库相关操作细节</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">隔离 SQL 语法与业务逻辑</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">为后续扩展更多数据库操作提供统一入口</span> </section> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">DocumentLoader</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要实现三个关键功能:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 文件加载</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">自动扫描指定目录下的 Markdown 文件(**/*.md)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">使用 UnstructuredMarkdownLoader 解析文件内容</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 文本分割</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">基于 token 数量进行智能分割</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">通过重叠 token 保持上下文连贯性</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">输出格式化的 Document 对象列表</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 参数化配置</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">允许灵活调整块大小(默认 400 tokens)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">可设置块间重叠量(默认 50 tokens)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">为后续向量化存储提供标准化输入</span> </section> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">QASystem</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要承担三个层面的职责:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 系统整合</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">协调 Doris 数据库操作</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">管理文档向量化存储</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">桥接大语言模型(</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">deepseek-r1</span></strong><span leaf="">)</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 处理流程</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">知识库初始化(文档向量化存储到Doris)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">问答处理链构建(LangChain 流水线)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">用户查询执行(端到端响应生成)</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 参数管理</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">集中管理嵌入模型(embedding_model本次选用的是</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">bge-m3</span></strong><span leaf="">)和 LLM 选择(llm本次选用的是</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">deepseek-r1</span></strong><span leaf="">)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">控制知识库文件存储路径</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">维护数据库连接配置</span> </section> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">Client</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要作为入口交互:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 系统配置</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">定义 Doris 数据库连接参数</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">指定文档存储表名(langchain)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">设置认证信息(用户名/密码)</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 初始化流程</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">创建问答系统实例</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">加载文档生成向量数据库(仅首次需要)</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 演示流程</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">预定义测试问题</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">执行端到端问答</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">格式化输出结果</span> </section> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">其它说明</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <h6 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">1. 测试文件</span></span><span style="display: none;"><span leaf=""><br></span></span></h6> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要导入了3个md文件,分别是:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">🔗 Doris README:<span textstyle="" style="color: rgb(0, 128, 255);text-decoration: underline;">https://github.com/apache/doris/edit/master/README.md</span></span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">🔗 Doris简介文档:<span textstyle="" style="color: rgb(0, 128, 255);text-decoration: underline;">https://github.com/apache/doris-website/blob/master/i18n/zh-CN/docusaurus-plugin-content-docs/current/gettingStarted/what-is-apache-doris.md</span></span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">🔗 Doris版本最新发布文档:<span textstyle="" style="color: rgb(0, 128, 255);text-decoration: underline;">https://github.com/apache/doris-website/blob/master/i18n/zh-CN/docusaurus-plugin-content-docs/current/releasenotes/all-release.md</span></span></p> <h6 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">2. Doris表</span></span><span style="display: none;"><span leaf=""><br></span></span></h6> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">在进行ApacheDoris.from_documents时,Doris会自动建如下表:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">CREATE</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">TABLE</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`langchain`</span></span><span leaf="">&nbsp;(</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`id`</span></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">varchar</span></span><span leaf="">(</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">50</span></span><span leaf="">)&nbsp;</span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">NULL</span></span><span leaf="">,</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`document`</span></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">text</span></span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">NULL</span></span><span leaf="">,</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`embedding`</span></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">array</span></span><span leaf="">&lt;</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">float</span></span><span leaf="">&gt;&nbsp;</span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">NULL</span></span><span leaf="">,</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`metadata`</span></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">text</span></span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">NULL</span></span><span leaf=""><br></span><span leaf="">)&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">ENGINE</span></span><span leaf="">=OLAP</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">UNIQUE</span></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">KEY</span></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">`id`</span></span><span leaf="">)</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要存储文档切割后的原文、embedding值和文件元数据:</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/bf7d53e782edeba9759f863b9a1b7bf4.png" class="rich_pages wxw-img" data-ratio="0.4666666666666667" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003872"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">由于Doris当前还没支持vector类型,所以还没法直接转为Retriever检索器,否则会报如下异常:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">Syntax error&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf="">&nbsp;line 4:\n... &nbsp; &nbsp;cosine_distance(array&lt;</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">float</span></span><span leaf="">&gt;</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">因此这块的流程改为将向量化后的Doris数据,直接读取(可以结合Doris</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">倒排索引</span></strong><span leaf="">加速)外挂为上下文context。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">预计7月将完成Doris向量化能力大统一,敬请期待!</span></p> <h6 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">3. 提示词</span></span><span style="display: none;"><span leaf=""><br></span></span></h6> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">构建QA chain时,prompt提示词这块值得一提。大家结合应用时可以个性化调整:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">template =&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; Answer the question based only on the following context:{context}</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; Question: 请严格结合{context}的内容回答{question}的问题,别发散,说人话。</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; """</span></span><span leaf=""><br></span><span leaf="">prompt = ChatPromptTemplate.from_template(template)</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">在langchain中,ChatPromptTemplate是一个定义提问模版的方法,主要有两个功能:from_messages 和 from_template。</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <p style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1. from_messages:把系统指令、用户提问等不同角色的对话片段,像搭积木一样组合,3秒构建多轮对话模板。</span></p> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <p style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">2. from_template</span></strong><span leaf="">:一键复制现有模板,好比PS图层编辑般自由修改,快速生成变体对话方案。本次选用的是from_template。</span></p> </section> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsqnj5xwicjricawate7kicmzdria8lyice261phiavu1wfztvvwx9i9vcaew 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">一分钟看结果</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">代码编写调试完后,来对比下结果。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">首先,本地部署的是ollama+deepseek r1:14b,直接问相同的问题,回答:</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/02d22a4d6fa749914b95cd146d089b20.png" class="rich_pages wxw-img" data-ratio="0.8898148148148148" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003873"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">结果有几个明显的错误点,比如Doris是2017年正式在GitHub上开源,最新发布的 release 版本是 v2.1.8(仅按发布时间排)。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">再基于Doris+DeepSeek,问相同的问题,回答:</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/27f8b5a39d70e19540abac2fe821c397.png" class="rich_pages wxw-img" data-ratio="0.5925925925925926" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003874"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin: 16px 0px 0px;padding: 8px 0px;"><span leaf="">结果准确率明显上升,且完美结合了prompt和Doris知识数据进行回答。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf=""><span textstyle="" style="color: rgb(0, 128, 255);font-weight: bold;">通过DeepSeek 结合 Doris 打造的 RAG 知识库</span>,既发挥了 DeepSeek 强大的模型推理能力,又利用了 Doris 高效的存储与检索优势,大幅提升回答准确度,有效避免AI幻觉,为个人/企业带来高质量的本地知识库。</span></p> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsqnj5xwicjricawate7kicmzdria8lyice261phiavu1wfztvvwx9i9vcaew 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">结语</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"><span leaf=""><br></span></span></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="503003877" data-ratio="0.5425925925925926" data-s="300,640" src="/upload/5c7b3c1a255b9f32cc538b2c9e11e864.png" data-type="png" data-w="1080" type="block"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf=""><span textstyle="" style="color: rgb(0, 128, 255);font-weight: bold;">知识库AI智能化</span>是一个永无止境的进化过程。随着大模型技术的发展,未来可以探索更多优化方向:</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">实时更新:支持增量同步,保持知识时效性</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">知识推理:引入知识图谱,提升问答准确性</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">•&nbsp;</span></span><span leaf="">多模态支持:除文本外,支持图片、音视频等富媒体内容</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">技术在飞速发展,但打造一个好的知识库系统不仅仅是技术问题。建议从小规模试点开始,在实践中不断优化,让系统真正服务于业务需求。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">最后,近期看到很多小伙伴因为AI而感到危机。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">一臻表示:</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">AI不会替代人,但会用AI的人大概率会替代不会用AI的人</span></strong><span leaf="">。好比‌工业时代到互联网时代的转折期,会上网的人,替换了很多不会上网的人。互联网会把工业时代的产业重写一遍,AI也可以重写以往的产业模式。共勉!</span></p> </section>

10 亿数据,实测 Clickhouse 布隆过滤器,性能如何?

作者:微信小助手

<section style="max-width: 100%;box-sizing: border-box;white-space: normal;background-color: rgb(255, 255, 255);overflow-wrap: break-word !important;margin-bottom: 0px;"> <section powered-by="xiumi.us" style="max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;"> <section style="max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;"> <section style="padding-right: 10px;padding-left: 10px;max-width: 100%;box-sizing: border-box;line-height: 1.6;overflow-wrap: break-word !important;"> <section style="color: rgb(62, 62, 62);font-size: 16px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;"> <section style="max-width: 100%;box-sizing: border-box;word-wrap: break-word !important;"> <section style="padding-right: 30px;padding-left: 30px;max-width: 100%;box-sizing: border-box;line-height: 1.6;word-wrap: break-word !important;"> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span leaf=""><br></span></p> </section> </section> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;color: rgb(0, 0, 0);"><span leaf="">上期内容在对 Flink 的背压问题进行二次优化时,用到了 Redis 的布隆过滤器,其实当时在方案选型时发现,原来 clickhouse 也是有这么个东东的。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;color: rgb(0, 0, 0);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">说到底,不管是 Redis 还是 CK 的布隆过滤器(Doris 也有),本质目的都在于「快速过滤」掉不相关数据(本质上,所有的索引都是这个目的)。</span></span></span></p> <blockquote> <p><span leaf=""><span textstyle="" style="font-size: 16px;letter-spacing: 2px;font-style: italic;">之所以上次的 Flink 背压问题没有选择 CK 的布隆过滤器,根本原因在于:</span></span></p> <p><span leaf=""><br></span></p> <p><span leaf=""><span textstyle="" style="font-size: 16px;letter-spacing: 2px;font-style: italic;">即便在被碰撞的 CK 表里,对查询字段启用了它,本质上还是基于「磁盘IO」,对于问题的解决可能帮助并不算太大。</span></span></p> </blockquote> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">那么今天这篇文章,我们就一起来聊聊 CK 的布隆过滤器,以及测试一下它的性能表现,看它到底值不值得一用。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 24px;color: #3da742;font-weight: bold;font-style: italic;">0. 概念理一下</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">首先我们要明晰一个问题,那就是 CK 的索引种类到底有哪些?</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">总结起来有两大类:<span textstyle="" style="color: #0052ff;font-weight: bold;font-style: italic;">「主键索引(primary key index)」</span>跟<span textstyle="" style="color: #0052ff;font-weight: bold;font-style: italic;">「跳数索引(data skipping index)」</span>。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">不知道有多少同学跟我一样,至今为止,暂时还没用过 CK 除主键索引之外的的其他索引功能(可能是就算不用,查询效率就足够快了吧)。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">而一开头提到的 CK 布隆过滤器,其实就属于「跳数索引」中的 3 种实现。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">为啥是 3 种?</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">根据 CK 官网的介绍,它的「跳数索引」一共分为 5 个小类:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;font-style: italic;">类1,MinMax 索引:</span>这个好理解,从名字就可以知道,它是用来额外记录某个列的最大值,跟最小值的;</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="color: #000000;font-weight: bold;font-style: italic;">类2,Set 索引:</span>底层实现应该就是一个哈希表,用来存储某个列中的「不同值」,根据经验应该知道,这个索引类型,特别适合那种「低基列」,而且它可以接收一个参数,用来确定底层哈希表数组的大小。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">比如对于一个枚举字段来说,你明明知道它的值一共就 100 种,那就直接设置为 set(100) 好了,避免了哈希表数组需要中途为了扩容,要额外重建的麻烦;</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;font-style: italic;">类3,普通布隆过滤器:</span>之所以普通(对比后面 2 种特殊的),原因在于你写进什么数据,它就给你存什么,不给你额外做任何处理。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">一般而言,布隆过滤器至少要接受 2 个参数(对比上次说的 Redis 布隆过滤器),但这里,只需要设置一个你期望的「误判率」就可以,其他的比如底层「位数组大小」,「哈希函数个数」,都交由 CK 自己去计算;</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;font-style: italic;">类4,N-gram 布隆过滤器(N-gram Bloom Filter):</span>一种特殊的布隆过滤器,特殊之处在于它会对你写进来的数据先进行「切词」,而它的切词规则,则是基于这个 N 来确定,假如 N 为 3 ,对于字符 clickhouse,会被切为 cli、lic、ick、ckh、kho、hou、ous、use 这些碎字符,然后再写到布隆过滤器里,相比普通布隆过滤器原来的「只写一份」,变成了「要写多份」;</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;font-style: italic;">类5,token 布隆过滤器(Token Bloom Filter):</span>另一种特殊的布隆过滤器,跟上面一样,也需要先对存进来的数据(比如字符),进行切词,只不过它的切词规则,很像我们熟悉的「倒排索引」,默认会根据「非文字或者英文字符」(比如空格、各种标点符号等)进行切分,同样也是要将切分后的 token,全部写入到布隆过滤器。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 24px;color: #3da742;font-weight: bold;font-style: italic;">1. 布隆过滤器间的对比</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">对于 CK 的这 3 种布隆过滤器来说,第 1 种普通的布隆过滤器,很明显最适合那种「以整个内容作为搜索条件」的字段。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">而对于 N-gram 布隆过滤器,因为它的特点是属于毫无章法的「无脑切」,适合那种脑子不清醒,只能大概记住一些「模糊字符片段」(甚至允许个别错误)的搜索方式,存储的字段内容,一般是一大段的文本。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">对于 token 布隆过滤器,相比 N-gram 的无脑切词,要更符合人理解的切词规则,适合那种对「某个关键字」进行准确搜索匹配的方式,存储的字段内容,同样也一般是一大段文本。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 24px;color: #3da742;font-weight: bold;font-style: italic;">2. 测试案例准备</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">上面理论罗里吧嗦说了那么多,这个 CK 支持的「跳数索引」的几种布隆过滤器,到底使用起来表现怎么样?</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">前面说过,因为之前的经验,很多时候我们就算不用这个「跳数索引」,CK 的查询效率也是能让人满意的,那为了尽可能凸显出使用它的价值,我这里准备了 2 张存储相同 10 亿条数据的表。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">其中第 1 张表不添加「跳数索引」,表结构如下:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005686" data-s="300,640" src="/upload/4ffe0dae4c7682e40d97b311ebb28e41.png" data-type="png" style="width:292px;height:257px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">第 2 张表,根据字段特点添加了「跳数索引」,表结构如下:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005687" data-s="300,640" src="/upload/8223a4e219842a204e4114c223d384a8.png" data-type="png" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">瞅一眼数据量:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005720" data-s="300,640" src="/upload/357407ea505fbba0d84c97ed95fdcd92.png" data-type="png" style="width:308px;height:324px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 20px;color: #3da742;font-weight: bold;font-style: italic;">2.1 写入速度对比</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">同样的一份 10 亿数据,写入到不带「跳数索引」表里,需要的总时间:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005688" data-s="300,640" src="/upload/ae7cdd97eb6922b8c8122fd74de40aec.png" data-type="png" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">为&nbsp;<span textstyle="" style="color: #0052ff;font-weight: bold;font-style: italic;">3653&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">而写入到带有 4 个「跳数索引」的表里,需要的总时间:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005689" data-s="300,640" src="/upload/75bfca82708e5ad71864c6ac0af6fb0d.png" data-type="png" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">为&nbsp;<span textstyle="" style="color: #0052ff;font-weight: bold;font-style: italic;">12141&nbsp;</span>秒,是上面的 3.3 倍。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">很明显,因为索引过程需要额外花时间,所以需要的写时间会更长。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 20px;color: #3da742;font-weight: bold;font-style: italic;">2.2 存储大小对比</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">对于 CK 来说,原始数据占用大小跟「跳数索引」占用大小,是通过不同的元数据表进行统计的。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">单纯从原始数据占用大小来看,用不用「跳数索引」,存储大小都一样:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005690" data-s="300,640" src="/upload/3abcd4990375168d31247a69b5f2cc74.png" data-type="png" style="width:500px;height:232px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;text-align: center;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 12px;font-style: italic;text-decoration: underline;">非跳数索引表的原始数据存储大小</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005691" data-s="300,640" src="/upload/2e0dd97775f0e102fefca429c456b416.png" data-type="png" style="width:513px;height:225px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;text-align: center;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 12px;font-style: italic;text-decoration: underline;">带跳数索引表的原始数据存储大小</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">对于额外的「跳数索引」占用情况如下:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005692" data-s="300,640" src="/upload/2b11c68c8de7bb4bb803608c0d2995eb.png" data-type="png" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">从查询到的元数据来看,额外创建的「跳数索引」,需要的磁盘空间接近&nbsp;<span textstyle="" style="color: #0052ff;font-weight: bold;font-style: italic;">10G</span>(压缩后)。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 24px;color: #3da742;font-weight: bold;font-style: italic;">3. 查询效率测试</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">因为这份数据有多个不同字段,且字段间的数据特点各不相同,这里根据字段特点,以及不同「跳数索引」的适配场景,分别创建了:token 布隆过滤器、普通布隆过滤器、以及 2 个 Set 过滤器。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005693" data-s="300,640" src="/upload/5833979beafd22afbfd64cc7540d2217.png" data-type="png" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 20px;color: #3da742;font-weight: bold;font-style: italic;">3.1 token 布隆过滤器效率测试</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">之所以会创建这个「跳数索引」,因为这个 details 字段的数据内容非常丰富,类似长这样:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005695" data-s="300,640" src="/upload/17d0eb2ed66dff9bcf13203c821b8ddd.png" data-type="png" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="color: #0052ff;font-weight: bold;">测试条件01:查找这个字段包含 IP 为「162.159.24.4」的记录总数。</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 1 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005696" data-s="300,640" src="/upload/a2ccbec6ca1a826468a4293ffd1a827d.png" data-type="png" style="width:458px;height:176px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">401&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005697" data-s="300,640" src="/upload/32d042a0010ec496a392dcb55c481224.png" data-type="png" style="width:474px;height:170px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">88&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">很明显,第 1 次测试时,带索引的表查询效率,要明显比不带索引的高出几倍。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 2 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005698" data-s="300,640" src="/upload/e945940b3b693cd2cff8659fe04b01f6.png" data-type="png" style="width:476px;height:176px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">32&nbsp;</span>秒 (效率大幅提高)。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005699" data-s="300,640" src="/upload/f2263dd659686efeb5abd1711a1de43c.png" data-type="png" style="width:481px;height:174px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">40&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">而第 2 次测试,因为缓存的原因,不带索引表的查询效率反而超过了带索引的表效率。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">而且后续经过多次测试确认,<span textstyle="" style="color: #0052ff;font-weight: bold;font-style: italic;">针对这个 IP 查询场景,带索引的查询效率,跟不带索引的相比,效率已经没有了优势</span>。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="color: #0052ff;font-weight: bold;">测试条件02:查询包含汉字「美国佛罗里达州墨尔本」的数据条数。</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 1 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005700" data-s="300,640" src="/upload/079e57d7f36df2b9fa990603ecfe56be.png" data-type="png" style="width:489px;height:183px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">57&nbsp;</span>秒</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005701" data-s="300,640" src="/upload/e2ffc2c1e81d5472fb072eeb9e1d713e.png" data-type="png" style="width:498px;height:187px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">64&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">虽然差不多,但有索引的查询效率居然还要更慢一点。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 2 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005702" data-s="300,640" src="/upload/7d607f185e05df337cfee7cd13cb2b54.png" data-type="png" style="width:475px;height:180px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">34&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005703" data-s="300,640" src="/upload/e47909cb7d7140d8bd5591acfadf7cad.png" data-type="png" style="width:473px;height:179px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">49&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">第 3 次、第 4 次...</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="color: #0052ff;font-weight: bold;font-style: italic;">这轮测试中,带索引表的效率表现,总体都不如不带索引表的效率。</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="color: #0052ff;font-weight: bold;">测试条件 03:查找这个字段包含关键字「myshopify」的记录总数。</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 1 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005704" data-s="300,640" src="/upload/1abdcac5eceebd265f69d3008e39a89d.png" data-type="png" style="width:492px;height:183px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">28&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005705" data-s="300,640" src="/upload/546b8750691a4c25db91c359db835a1d.png" data-type="png" style="width:499px;height:185px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">40&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 2 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005706" data-s="300,640" src="/upload/0a5b10d128ecf7dec7dd1ede8012259b.png" data-type="png" style="width:486px;height:180px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">34&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005707" data-s="300,640" src="/upload/96d462ca232d36d67cd00360cc16395d.png" data-type="png" style="width:489px;height:191px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">36&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">还是一样,不管后续查多少次,带索引跟不带索引的查询效率虽然总体上差不多,但依然还是不带索引的效率略胜一筹。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">好了,就测到这样,基本上可以得出结论:<span textstyle="" style="color: #0052ff;font-weight: bold;font-style: italic;">对于当前场景(数据特点),「token 布隆过滤器」的表现非常鸡肋,除了徒增存储空间外,几乎没有表现出任何优势(偶尔一次),差评!</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 20px;color: #3da742;font-weight: bold;font-style: italic;">3.2 普通布隆过滤器效率测试</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">这次针对的是域名字段,字段名为 domain。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="color: #0052ff;font-weight: bold;">测试条件:查找 domain 值为「ns4.dwpov.com.」的数据条数。</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 1 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005708" data-s="300,640" src="/upload/c1b4cd8adbd0b4732db39453dfdb35b6.png" data-type="png" style="width:470px;height:178px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">13&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005709" data-s="300,640" src="/upload/2f2fcb07c4365ec50ac803a9ff8c9e24.png" data-type="png" style="width:503px;height:186px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">1&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 2 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005710" data-s="300,640" src="/upload/7d9fd5d54543e0de22d9c33c97b203d4.png" data-type="png" style="width:474px;height:185px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">2&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005711" data-s="300,640" src="/upload/08b84804f0bd1962cfff76040483dbed.png" data-type="png" style="width:486px;height:182px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">0.1</span>&nbsp;秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">经过多次测试,可以得出结论:<span textstyle="" style="color: #0052ff;font-weight: bold;font-style: italic;">针对当前场景,「普通布隆过滤器索引」表现出了应有的水准,确实能大幅提高查询效率。</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 20px;color: #3da742;font-weight: bold;font-style: italic;">3.3 Set 索引效率测试</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">这个索引一般会被应用到「低基列」,对于当前这张测试表,有 2 个地基列:tld 跟 status。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">这两个字段的区别在于,tld 的基数为 1000+,而 status 的基数则只有 4 个。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 16px;color: #3da742;font-weight: bold;font-style: italic;">测试条件 01:查找 status 为「unknown」的数据条数。</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 1 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005712" data-s="300,640" src="/upload/c57f9619356808367414b138045440e3.png" data-type="png" style="width:493px;height:184px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">15&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005713" data-s="300,640" src="/upload/bf85340f3aead94aff735c89d23c7020.png" data-type="png" style="width:487px;height:185px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">4&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 2 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005714" data-s="300,640" src="/upload/610191865d9c340e2797f2649608d335.png" data-type="png" style="width:487px;height:182px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">1</span>&nbsp;秒多。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005715" data-s="300,640" src="/upload/4908e12ea5ec44bf6d6ae0fc8060ff4a.png" data-type="png" style="width:495px;height:182px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时也&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">1</span>&nbsp;秒多。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 16px;color: rgb(61, 167, 66);font-weight: bold;font-style: italic;">测试条件 02:查找 tld 为「net」的数据条数。</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 1 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005716" data-s="300,640" src="/upload/c578a2330dd1b5cef66ee55dbec2bd94.png" data-type="png" style="width:483px;height:183px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">4&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005717" data-s="300,640" src="/upload/f3c30f8c048215cd83cfa19023c219bf.png" data-type="png" style="width:480px;height:181px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">2&nbsp;</span>秒。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;">第 2 次测试:</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">无索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005718" data-s="300,640" src="/upload/72e59be187642a9b4684732ce041804d.png" data-type="png" style="width:486px;height:185px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">1&nbsp;</span>秒多。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">有索引表的效率:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100005719" data-s="300,640" src="/upload/ada2b5716a648f3c71f1c8e226766ac1.png" data-type="png" style="width:498px;height:193px;" type="block"> </section> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">耗时也&nbsp;<span textstyle="" style="font-weight: bold;font-style: italic;">1</span>&nbsp;秒多。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">结论:<span textstyle="" style="color: #0052ff;font-weight: bold;font-style: italic;">CK 的 Set 索引也能表现出应有的水准,虽然效率提升没有那么惊艳,但额外占用的存储空间非常小,主打一个成本低,效果还可以</span>。</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-size: 24px;color: #3da742;font-weight: bold;font-style: italic;">最后</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf="">针对 CK 的这次「跳数索引」测试表现,总结如下:</span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;font-style: italic;">1,表现最扑街的是「token 布隆过滤器」,消耗额外的存储空间最多(近10G),但表现却最差,甚至大部分时候有它,还不如没有(至于是不是我参数设置的不合理,有待进一步验证);</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;font-style: italic;">2,表现最好的要算是「普通布隆过滤器」,查询效率能明显提升的同时,消耗的额外存储空间也不高(约150MB),是这次测试的所有索引类型中,性价比最高的,好评;</span></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><br></span></span></span></p> <p style="max-width: 100%;box-sizing: border-box;min-height: 1em;margin-left: 0px;margin-right: 0px;line-height: 1.75em;overflow-wrap: break-word !important;"><span style="font-size: 16px;letter-spacing: 2px;"><span style="font-size: 16px;text-indent: 0em;color: rgb(62, 62, 62);"><span leaf=""><span textstyle="" style="font-weight: bold;font-style: italic;">3,至于 Set 索引,表现中规中矩,虽然没有提供多么惊艳的查询效率,但也实实在在提速了,也值得一个赞。</span></span></span></span></p> </section> </section> </section> </section>

开源向量数据库Milvus简介

作者:微信小助手

<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 10px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;font-family: Optima, 'Microsoft YaHei', PingFangSC-regular, serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;overflow-wrap: break-word;text-align: left;"> <h1 data-tool="mdnice编辑器" style=" border-bottom-color: rgb(37, 132, 181);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 20px;color: rgb(37, 132, 181);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf=""><br></span></span><span style="display: none;"></span></h1> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Milvus 是一个开源的、高性能、高扩展性的向量数据库,专门用于处理和检索高维向量数据。它适用于相似性搜索(Approximate Nearest Neighbor Search,ANN),特别适合</span><strong style="color: rgb(37, 132, 181);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">AI、推荐系统、计算机视觉、自然语言处理(NLP)</span></strong><span leaf="">等领域。Milvus 由 Zilliz 开发,并已捐赠给 LF AI &amp; Data 基金会。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">向量是神经网络模型的输出数据格式,可以有效地对信息进行编码,在知识库、语义搜索、检索增强生成(RAG)等人工智能应用中发挥着举足轻重的作用。</span></p> <h2 data-tool="mdnice编辑器" style=" margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 18px;color: rgb(37, 132, 181);border-bottom-color: rgb(37, 132, 181);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 2px;padding-bottom: 0px;padding-left: 0px;padding-right: 4px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">1. 非结构化数据、Embeddings 和 Milvus</span></span><span style="display: none;"></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(37, 132, 181);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">文本、图像和音频等非结构化数据</span></strong><span leaf="">格式各异,并带有丰富的底层</span><strong style="color: rgb(37, 132, 181);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">语义</span></strong><span leaf="">,因此分析起来极具挑战性。为了处理这种复杂性,</span><strong style="color: rgb(37, 132, 181);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Embeddings</span></strong><span leaf="">&nbsp;被用来将非结构化数据转换成能够捕捉其基本特征的</span><strong style="color: rgb(37, 132, 181);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">数字向量</span></strong><span leaf="">。然后将这些向量存储在向量数据库中,从而实现快速、可扩展的搜索和分析。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Milvus 提供强大的数据建模功能,使您能够将非结构化或多模式数据组织成</span><strong style="color: rgb(37, 132, 181);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">结构化的 Collections</span></strong><span leaf="">。它支持多种数据类型,适用于不同的属性模型,包括常见的数字和字符类型、各种向量类型、数组、集合和 JSON。</span></p> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img alt="unstructured-data-embedding-and-milvus" class="rich_pages wxw-img" data-imgfileid="100005488" src="/upload/a70779e975cba6a96ddc7d89bd1d413f.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> <figcaption style="color: rgb(136, 136, 136);font-size: 14px;line-height: 1.5em;letter-spacing: 0em;text-align: center;font-weight: normal;margin-top: 5px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"> <span leaf="">unstructured-data-embedding-and-milvus</span> </figcaption> </figure> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Milvus 提供三种部署模式,涵盖各种数据规模:</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(37, 132, 181);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Milvus Lite</span></strong><span leaf="">&nbsp;是一个 Python 库,可以轻松集成到您的应用程序中。作为 Milvus 的轻量级版本,它非常适合在 Jupyter Notebooks 中进行快速原型开发,或在资源有限的边缘设备上运行。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(37, 132, 181);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Milvus Standalone</span></strong><span leaf="">&nbsp;是单机服务器部署,所有组件都捆绑在一个 Docker 镜像中,方便部署。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(37, 132, 181);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Milvus Distributed</span></strong><span leaf="">&nbsp;可部署在 Kubernetes 集群上,采用云原生架构,专为十亿规模甚至更大的场景而设计。该架构可确保关键组件的冗余。</span> </section></li> </ul> <h2 data-tool="mdnice编辑器" style=" margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 18px;color: rgb(37, 132, 181);border-bottom-color: rgb(37, 132, 181);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 2px;padding-bottom: 0px;padding-left: 0px;padding-right: 4px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">2. Milvus架构</span></span><span style="display: none;"></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Milvus 主要由以下组件组成:</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Coordinator(协调器):管理元数据、查询和数据分片。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Proxy(代理):处理 API 请求并转发给计算节点。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">QueryNode(查询节点):执行 ANN 查询,返回最近邻数据。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">DataNode(数据节点):存储和管理向量数据。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">IndexNode(索引节点):构建和存储索引以加速查询。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">MetaStore(元数据存储):使用 etcd 存储元数据。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Storage(存储层):使用 MinIO/S3 存储向量数据和索引。</span> </section></li> </ul> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img alt="highly-decoupled-architecture" class="rich_pages wxw-img" data-imgfileid="100005487" src="/upload/18e3d82decb3f6e14244813a92e2b01e.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> <figcaption style="color: rgb(136, 136, 136);font-size: 14px;line-height: 1.5em;letter-spacing: 0em;text-align: center;font-weight: normal;margin-top: 5px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"> <span leaf="">highly-decoupled-architecture</span> </figcaption> </figure> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Milvus 的云原生和高度解耦的系统架构确保了系统可以随着数据的增长而不断扩展:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Milvus 本身是完全无状态的,因此可以借助 Kubernetes 或公共云轻松扩展。此外,Milvus 的各个组件都有很好的解耦,其中最关键的三项任务--</span><strong style="color: rgb(37, 132, 181);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">搜索、数据插入和索引/压实</span></strong><span leaf="">--被设计为易于并行化的流程,复杂的逻辑被分离出来。这确保了相应的查询节点、数据节点和索引节点可以独立地向上和向下扩展,从而优化了性能和成本效率。</span></p> <h2 data-tool="mdnice编辑器" style=" margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 18px;color: rgb(37, 132, 181);border-bottom-color: rgb(37, 132, 181);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 2px;padding-bottom: 0px;padding-left: 0px;padding-right: 4px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">3. Milvus 支持的搜索类型</span></span><span style="display: none;"></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Milvus 支持各种类型的搜索功能,以满足不同用例的需求:</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">ANN 搜索:查找最接近查询向量的前 K 个向量。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">过滤搜索:在指定的过滤条件下执行 ANN 搜索。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">范围搜索:查找查询向量指定半径范围内的向量。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">混合搜索:基于多个向量场进行 ANN 搜索。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">全文搜索:基于 BM25 的全文搜索。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Rerankers:根据附加标准或辅助算法调整搜索结果顺序,完善初始 ANN 搜索结果。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">获取:根据主键检索数据。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">查询: 使用特定表达式检索数据。</span> </section></li> </ul> <h2 data-tool="mdnice编辑器" style=" margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 18px;color: rgb(37, 132, 181);border-bottom-color: rgb(37, 132, 181);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 2px;padding-bottom: 0px;padding-left: 0px;padding-right: 4px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">4. 相关资料</span></span><span style="display: none;"></span></h2> <ol style="list-style-type: decimal;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Milvus 是什么?:&nbsp;</span><span leaf="">https://milvus.io/docs/zh/overview.md</span> </section></li> </ol> </section> <section> <span leaf=""><br></span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

高并发系统必看!G1如何让亿级JVM吞吐量提升300%?

作者:微信小助手

<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin-bottom: 0px;padding-left: 10px;padding-right: 10px;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;font-family: Optima, PingFangSC-light, serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;text-align: left;"> <figure data-tool="mdnice编辑器" style="-webkit-tap-highlight-color: transparent;margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(0, 0, 0);font-family: Optima, PingFangSC-regular, serif;font-size: 16px;letter-spacing: normal;text-align: left;background-color: rgb(255, 255, 255);display: flex;flex-direction: column;justify-content: center;align-items: center;visibility: visible;"> <p style="-webkit-tap-highlight-color: transparent;outline: 0px;font-family: Optima, " microsoft yahei, pingfangsc-regular, serif;text-align: center;>正文开始......</p> <figcaption style="-webkit-tap-highlight-color: transparent;margin-top: 5px;outline: 0px;color: rgb(136, 136, 136);font-size: 14px;line-height: 1.5em;letter-spacing: 0em;text-align: center;"> <span style="-webkit-tap-highlight-color: transparent;outline: 0px;letter-spacing: 0em;word-spacing: 0em;"><br style="-webkit-tap-highlight-color: transparent;outline: 0px;"></span> </figcaption> </figure> <h2 data-tool="mdnice编辑器" style="-webkit-tap-highlight-color: transparent;margin-top: 30px;margin-bottom: 15px;outline: 0px;color: rgb(0, 0, 0);font-family: Optima, PingFangSC-regular, serif;letter-spacing: normal;text-align: left;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(255, 255, 255);align-items: unset;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: 657px;-webkit-box-reflect: unset;"></h2> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 20px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 5px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 191, 82);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">G1 分区模型</span><span style="display: none;"></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">Region 分区模型</strong></p> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <img alt="" class="rich_pages wxw-img" data-imgfileid="100021488" data-ratio="0.34627831715210355" data-type="png" data-w="927" style="display: block;margin-right: auto;margin-left: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 4px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;height: auto !important;" src="/upload/85f0ea79ae228ac00ec968ff8182e1a1.png"> </figure> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">G1 将堆内存划分为多个等大小的 Region(默认 1MB-32MB),每个 Region 可以是 Eden、Survivor 或 Old 区,默认是将堆内存按照 2048 份均分。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">这种灵活的分区方式打破了传统代际的物理隔离,允许动态调整各代内存占比。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">Region 的角色(年轻代、老年代或大对象区)是动态分配的。例如,一个 Region 可能初始作为 Eden 区,回收后被标记为 Survivor 区,后续可能转为老年代区。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">大对象(Humongous 对象)</strong>:若对象大小超过 Region 的 50%,则分配到连续的 Humongous Region。此类对象回收需特殊处理,若空间不足可能触发 Full GC。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">例如,当老年代占用过高时,G1 会<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">优先回收垃圾最多的 Region,而非全堆扫描</strong>。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">跨代引用的智能追踪</strong></p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">卡表(Card Table)</strong>:记录跨 Region 的引用关系。例如,老年代对象引用年轻代对象时,对应的卡表条目会被标记为“脏卡”。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">记忆集(RSet)</strong>:每个 Region 维护一个 RSet,存储其他 Region 对其内部对象的引用。通过 RSet 快速定位跨 Region 引用,避免全堆扫描。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">写屏障(Write Barrier)</strong>:在对象引用修改时触发,更新卡表和 RSet。例如,当老年代对象引用新生代对象时,写屏障会记录该引用。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">混合回收(Mixed GC)</strong></p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">混合回收是 G1 的精髓:在一次回收中,<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">同时处理年轻代和老年代的 Region</strong>。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">通过计算回收收益(垃圾量/耗时),G1 选择性价比最高的 Region 集合(Collection Set),在用户设定的最大停顿时间内(如 200ms)完成回收。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">在逻辑上,G1 分为年轻代和老年代,但它的年轻代和老年代比例,并不是那么“固定”,为了达到 MaxGCPauseMillis 所规定的效果,G1 会自动调整两者之间的比例。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">如果你强行使用 -Xmn 或者 -XX:NewRatio 去设定它们的比例的话,我们给 G1 设定的这个目标将会失效。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">G1 的回收过程主要分为 3 类:</p> <ol data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> G1“年轻代”的垃圾回收,同样叫 Minor GC,这个过程和我们前面描述的类似,发生时机就是 Eden 区满的时候。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> 老年代的垃圾收集,严格上来说其实不算是收集,它是一个“并发标记”的过程,顺便清理了一点点对象。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> 真正的清理,发生在“混合模式”,它不止清理年轻代,还会将老年代的一部分区域进行清理。 </section></li> </ol> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 20px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 5px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 191, 82);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><strong style="align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">年轻代回收(Young GC)</strong></span><span style="display: none;"></span></h2> <blockquote data-tool="mdnice编辑器" style="margin-top: 20px;margin-bottom: 20px;padding: 10px 10px 10px 20px;border-top: 1px solid rgb(255, 191, 82);border-bottom: 1px solid rgb(255, 191, 82);border-right: 1px solid rgb(255, 191, 82);border-left-width: 1px;border-left-color: rgb(255, 191, 82);border-radius: 8px;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(255, 248, 230);width: auto;height: auto;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;overflow: auto;"> <span style="display: none;color: rgb(0, 0, 0);font-size: 16px;line-height: 1.5em;letter-spacing: 0em;"></span> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;">Chaya:年轻代回收触发流程是什么?</p> </blockquote> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">Eden 区占满时触发,仅回收年轻代 Region。回收流程如下所示:</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <p style="line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">根扫描</strong>:标记 GC Roots 直接可达的对象(如栈帧局部变量、静态变量)。</p> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <p style="line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">RSet 处理</strong>:通过脏卡队列更新 RSet,将老年代对年轻代的引用加入 GC Roots。</p> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <p style="line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">复制存活对象</strong>:将 Eden 和 Survivor 区的存活对象复制到新 Survivor 区,年龄达阈值(默认 15)则晋升老年代。</p> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <p style="line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">这个过程通常是 Stop-The-World(STW)的,即在回收过程中,应用程序的其他线程会被暂停。</p> </section></li> </ul> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <img alt="" class="rich_pages wxw-img" data-imgfileid="100021489" data-ratio="0.4068901303538175" data-type="png" data-w="1074" style="display: block;margin-right: auto;margin-left: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 4px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;height: auto !important;" src="/upload/9e028d03689144ba13abac05322608cc.png"> </figure> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 20px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 5px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 191, 82);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><strong style="align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">混合回收(Mixed GC)</strong></span><span style="display: none;"></span></h2> <blockquote data-tool="mdnice编辑器" style="margin-top: 20px;margin-bottom: 20px;padding: 10px 10px 10px 20px;border-top: 1px solid rgb(255, 191, 82);border-bottom: 1px solid rgb(255, 191, 82);border-right: 1px solid rgb(255, 191, 82);border-left-width: 1px;border-left-color: rgb(255, 191, 82);border-radius: 8px;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(255, 248, 230);width: auto;height: auto;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;overflow: auto;"> <span style="display: none;color: rgb(0, 0, 0);font-size: 16px;line-height: 1.5em;letter-spacing: 0em;"></span> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;">Chaya:混合回收的触发条件是什么?</p> </blockquote> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">多次回收之后,会出现很多 Old 老年代区,此时总堆占有率达到阈值(默认 45%)时会触发混合回收 MixedGC。混合回收会回收 整个年轻代 + 部分老年代。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">回收过程如下:</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">初始标记(STW)</strong>:标记 GC Roots 直接可达对象,耗时短。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">并发标记</strong>:与应用线程并行,遍历堆标记存活对象,使用三色标记法(黑、灰、白)避免漏标。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">重新(最终)标记(STW)</strong>:处理并发标记期间引用变化(通过 SATB 算法保证一致性),修正标记结果。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">筛选回收</strong>:根据 Region 的回收价值(垃圾占比与回收时间)选择 Region 集合(Collection Set),复制存活对象并清理。 </section></li> </ul> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <img alt="" class="rich_pages wxw-img" data-imgfileid="100021490" data-ratio="0.36907216494845363" data-type="png" data-w="485" style="display: block;margin-right: auto;margin-left: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 4px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;height: auto !important;" src="/upload/18e7ed3fd777d47970d04a18b2d21b97.png"> </figure> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">注意:当混合回收无法快速释放足够空间时触发 Full GC(如大对象分配失败),采用单线程标记-整理算法,导致长停顿。</strong></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 4px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 227, 163);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">初始标记</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">初始标记会暂停所有用户线程,只标记从 GC Root 可直达的对象,所以停顿时间不会太长。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">采用三色标记法进行标记,三色标记法在原有双色标记(黑也就是 1 代表存活,白 0 代表可回收)增加了一种灰色。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">三色标记法</strong></p> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <img alt="" class="rich_pages wxw-img" data-imgfileid="100021487" data-ratio="0.7068965517241379" data-type="png" data-w="406" style="display: block;margin-right: auto;margin-left: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 4px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;height: auto !important;" src="/upload/6069c157f1aae8784e652bb1d673e283.png"> </figure> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">黑色</strong>:对象及其引用均完成标记。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">灰色</strong>:对象已标记,但引用未完全处理。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">白色</strong>:未标记或待回收对象。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">漏标问题解决</strong>:通过 SATB(Snapshot-At-The-Beginning)机制,记录并发标记开始时的对象快照,确保标记一致性 </section></li> </ul> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 4px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 227, 163);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">并发标记</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">默认线程数为<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>ParallelGCThreads</code>的 1/4(通过<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>-XX:ConcGCThreads</code>调整),减少应用线程阻塞。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">允许系统程序的运行,同时进行"GC Roots"追踪,追踪所有存活对象(间接引用的对象)。该阶段很耗时,因为要追踪全部的存活对象。但是是并发运行,对系统影响不大。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">GC 开始前所有对象都是白色,GC 一开始所有根能够直达的对象被压到栈中,待搜索,此时颜色是灰色。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">然后灰色对象依次从栈中取出搜索子对象,子对象也会被涂为灰色,入栈。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">当其所有的子对象都涂为灰色之后该对象被涂为黑色。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">当 GC 结束之后灰色对象将全部没了,剩下黑色的为存活对象,白色的为垃圾。</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <img alt="" class="rich_pages wxw-img" data-imgfileid="100021491" data-ratio="0.8363636363636363" data-type="gif" data-w="330" style="display: block;margin-right: auto;margin-left: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 4px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;height: auto !important;" src="/upload/5c8231abd0441b8fc0b1b6d2bbf690f1.png"> </figure> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">需要注意的是:由于用户线程可能同时在修改对象的引用关系,就会出现错标的情况</strong></p> <blockquote data-tool="mdnice编辑器" style="margin-top: 20px;margin-bottom: 20px;padding: 10px 10px 10px 20px;border-top: 1px solid rgb(255, 191, 82);border-bottom: 1px solid rgb(255, 191, 82);border-right: 1px solid rgb(255, 191, 82);border-left-width: 1px;border-left-color: rgb(255, 191, 82);border-radius: 8px;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(255, 248, 230);width: auto;height: auto;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;overflow: auto;"> <span style="display: none;color: rgb(0, 0, 0);font-size: 16px;line-height: 1.5em;letter-spacing: 0em;"></span> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;">Chaya:那咋办呢?</p> </blockquote> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">G1 为了解决这个问题,使用了<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">SATB 技术(Snapshot At The Beginning, 初始快照)</strong>。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">在并发标记开始时,G1 会创建一个堆内存的快照,记录所有存活对象的初始状态。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">在最终标记阶段,系统会处理并发期间新增的引用变化,通过<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">写前屏障(Write Barrier)</strong>记录这些变化,确保新对象不被错误回收。</p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 4px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 227, 163);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">最终标记</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">触发时机</strong>:在并发标记(Concurrent Marking)完成后,G1 需要暂停所有应用线程(STW),以处理并发标记期间遗漏的引用变化,确保标记结果的准确性。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">核心目标</strong>:修正并发标记阶段因应用线程并发执行导致的对象引用变化(如新对象创建或引用更新),并生成最终的存活对象快照。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">处理漏标对象</strong>:通过遍历<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">卡表(Card Table)</strong>中的“脏页”(记录引用修改的区域),重新扫描这些区域的对象,修正标记状态</p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 4px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 227, 163);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">筛选回收</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">最终标记完成后,G1 根据<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">停顿时间目标(MaxGCPauseMillis)</strong>和<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">Region 回收价值</strong>,选择最合适的区域进行回收。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">优先回收垃圾比例高(存活对象少)的 Region,以最小化回收时间并最大化内存释放效率。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">根据每个 Region 的<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">存活对象数量</strong>和<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">回收时间成本</strong>计算“回收价值”,优先选择存活率低、回收效率高的 Region 组成回收集(Collection Set, CSet)。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">标记-复制算法</strong>:将存活对象从回收集的 Region 复制到空闲 Region,同时整理内存以减少碎片。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">主要步骤如下所示:</p> <ol data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">构建回收集(CSet)</strong>: </section></li> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> 根据 Region 的存活对象比例和用户设定的停顿时间目标(如<code style="background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>-XX:MaxGCPauseMillis</code>),动态选择需要回收的 Region。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> 通常包括所有年轻代 Region(Eden/Survivor)和部分老年代 Region(混合收集模式) </section></li> </ul> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">并行迁移存活对象</strong>: </section></li> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> 暂停应用线程(STW),启动多个 GC 线程并行执行。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> 将回收集内的存活对象复制到空闲 Region(如 Survivor 区或 Old 区的新 Region),并更新对象引用指针。 </section></li> </ul> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">清理与释放内存</strong> </section></li> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> 清空原 Region 的所有内容,将其标记为“空闲区域”。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> 更新<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">Remembered Set(RSet)</strong>和卡表,记录跨 Region 引用的变化。 </section></li> </ul> </ol> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 20px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 5px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 191, 82);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">调优策略与参数</span><span style="display: none;"></span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 4px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 227, 163);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">案例一:年轻代配置</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">案例</strong>:某线上服务因误设<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>-Xmn256m</code>覆盖 G1 的自动调节,导致 Eden 区过小(仅 256MB),频繁触发 Young GC(600+次/压测),响应时间激增。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">解决方案</strong>:删除<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>-Xmn</code>参数,由 G1 根据<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>G1NewSizePercent</code>(默认 5%)和<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>G1MaxNewSizePercent</code>(默认 60%)动态调整新生代大小,GC 时间从 25 秒降至 1 秒内。</p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 4px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 227, 163);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">案例二:<strong style="align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">老年代“拥堵治理”</strong></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">动态年龄判定</strong>:若 Survivor 区使用超过 50%(<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>TargetSurvivorRatio</code>默认值),对象会直接晋升老年代。需通过增大 Survivor 区或降低晋升阈值(<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>MaxTenuringThreshold</code>),避免过早“占道”。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">混合回收触发阈值</strong>:默认<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>InitiatingHeapOccupancyPercent=45%</code>(老年代占比),高并发场景可适度调低以提前回收,避免 Full GC。</p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 4px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 227, 163);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><strong style="align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">大对象“专车配送”</strong></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">大对象(超过 Region 50%)直接进入老年代,类似超重订单需特殊车辆处理。通过<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>G1HeapRegionSize</code>调整 Region 大小(如 32MB),或设置<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>PretenureSizeThreshold</code>控制大对象阈值,减少内存碎片。</p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 4px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 227, 163);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><strong style="align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">Full GC 的应急处理</strong></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">内存不足</strong>:堆内存过小或老年代晋升过快,需检查<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>-Xmx/-Xms</code>是否一致(建议设为物理内存 75%-80%)。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">并发失败</strong>:若 Mixed GC 无法及时回收,触发 Full GC,需优化<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>MaxGCPauseMillis</code>或降低<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>InitiatingHeapOccupancyPercent</code>。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">启用 GC 日志:<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>-XX:+PrintGCDetails -Xloggc:/path/gc.log</code>,关注<code style="color: rgb(244, 138, 0);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>Full GC</code>关键字及耗时。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">关键调优参数</strong></p> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <code style="background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>-XX:MaxGCPauseMillis</code>:设定最大停顿时间(默认 200ms),G1 根据此目标动态调整回收 Region 数量. </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <code style="background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>-XX:G1HeapRegionSize</code>:手动指定 Region 大小(需为 2 的幂次方)。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <code style="background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>-XX:G1MixedGCCountTarget</code>:控制混合回收次数(默认 8 次),分批次回收老年代 Region 以减少单次停顿。 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> <code style="background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>-XX:G1ReservePercent</code>:预留堆内存(默认 10%)防止晋升失败。 </section></li> </ul> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;border-style: none;border-width: 1px;border-color: rgb(0, 0, 0);border-radius: 0px;box-shadow: none;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow: unset;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 20px;color: rgb(244, 138, 0);line-height: 1.8em;letter-spacing: 0em;padding-left: 10px;border-style: none none none solid;border-width: 1px 1px 1px 5px;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(255, 191, 82);border-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;overflow: unset;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;">总结</span><span style="display: none;"></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">G1 是一款非常优秀的垃圾收集器,不仅适合堆内存大的应用,同时也简化了调优的工作。通过主要的参数初始和最大堆空间、以及最大容忍的 GC 暂停目标,就能得到不错的性能;同时,我们也看到 G1 对内存空间的浪费较高,但通过<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">首先收集尽可能多的垃圾</strong>(Garbage First)的设计原则,可以及时发现过期对象,从而让内存占用处于合理的水平。</p> <p data-tool="mdnice编辑器" style="color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;">虽然 G1 也有类似 CMS 的收集动作:初始标记、并发标记、重新标记、清除、转移回收,并且也以一个串行收集器做担保机制,但单纯地以类似前三种的过程描述显得并不是很妥当。</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> G1 的设计原则是"<strong style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;">首先收集尽可能多的垃圾</strong>(Garbage First)"。因此,G1 并不会等内存耗尽(串行、并行)或者快耗尽(CMS)的时候开始垃圾收集,而是在内部采用了启发式算法,在老年代找出具有高收集收益的分区进行收集。同时 G1 可以根据用户设置的暂停时间目标自动调整年轻代和总堆大小,暂停目标越短年轻代空间越小、总空间就越大; </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> G1 采用内存分区(Region)的思路,将内存划分为一个个相等大小的内存分区,回收时则以分区为单位进行回收,存活的对象复制到另一个空闲分区中。由于都是以相等大小的分区为单位进行操作,因此 G1 天然就是一种压缩方案(局部压缩); </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> G1 虽然也是分代收集器,但整个内存分区不存在物理上的年轻代与老年代的区别,也不需要完全独立的 survivor(to space)堆做复制准备。G1 只有逻辑上的分代概念,或者说每个分区都可能随 G1 的运行在不同代之间前后切换; </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(20, 20, 20);line-height: 1.8em;letter-spacing: 0em;"> G1 的收集都是 STW 的,但年轻代和老年代的收集界限比较模糊,采用了混合(mixed)收集的方式。即每次收集既可能只收集年轻代分区(年轻代收集),也可能在收集年轻代的同时,包含部分老年代分区(混合收集),这样即使堆内存很大时,也可以限制收集范围,从而降低停顿。 </section></li> </ul> </section>

2025年值得关注的21个RAG开源项目

作者:微信小助手

<section class="mp_profile_iframe_wrp"> <mp-common-profile class="custom_select_card mp_profile_iframe mp_common_widget" data-pluginname="mp-common-profile" data-from="0" data-id="MzIyMzg4NzU5MQ==" data-alias="liugddx" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/7TPZWAFAKlresh4VZTybb9wCwfJNS089StjNibvIaicEVibRBh0vqcer1LnRLbVN9eQh5D6OSu4fDSDtJWTaw8ZXQ/0?wx_fmt=png" data-nickname="沉浸式学AI" data-signature="专注于AI+大数据" data-service_type="1"></mp-common-profile> </section> <section style="line-height: 2;font-size: 15px;text-align: left;"> <h1 style="display: table;padding: 0 1em;border-bottom: 2px solid rgb(0, 179, 138);margin: 2em auto 1em;color: rgb(0, 179, 138);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">引言</span></strong></h1> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">检索增强生成(RAG)框架通过将检索机制与生成模型相结合,彻底改变了大型语言模型(LLM)的使用方式。随着人工智能解决方案需求的不断上升,GitHub 上陆续出现了多个开源的 RAG 框架,每个框架都提供了独特的功能和特性。</span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000648" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.7185185185185186" data-w="1080" src="/upload/edf341a18aa6898ddfe71d0f6674224b.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">以下是 RAG 框架的主要特点:</span></p> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">知识检索</span></strong><span leaf="">&nbsp;—— 这一核心功能使 RAG 框架能够通过从外部知识库中提取相关信息,为大型语言模型提供上下文支持。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">生成模型增强</span></strong><span leaf="">&nbsp;—— 通过利用检索到的信息来改善 LLM 的输入,从而使模型能够生成更准确、更新、更符合上下文的响应。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">多轮交互</span></strong><span leaf="">&nbsp;—— 此功能允许 RAG 系统通过与用户的多次交互不断完善查询和生成内容,从而提升用户满意度和系统的整体准确率。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">模型优化</span></strong><span leaf="">&nbsp;—— 通过各种技术手段(例如查询消歧、查询抽象以及索引优化)提升 RAG 系统的性能。</span></p> <h1 style="display: table;padding: 0 1em;border-bottom: 2px solid rgb(0, 179, 138);margin: 2em auto 1em;color: rgb(0, 179, 138);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">21 大著名的 RAG 框架</span></strong></h1> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">这些框架通过将大型语言模型与外部知识库相结合,提高了生成内容的准确性和可靠性,在医疗、金融、客户服务及教育等领域具有重要价值。</span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000649" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.7212962962962963" data-w="1080" src="/upload/50c9a38407dafffc9b57aa2e6a135ff1.png"> </section> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">RAGFlow</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000650" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.5555555555555556" data-w="1080" src="/upload/3f7c850820e83099edc03d80f8037cdb.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/infiniflow/ragflow</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:简化的工作流设计,内置预构建组件,并与向量数据库集成。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:希望快速构建 RAG 应用的开发者和组织。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">工作流设计</span></strong><span leaf="">:直观的界面用于设计和配置 RAG 工作流。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">预配置工作流</span></strong><span leaf="">:提供常见场景的即用型工作流。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">向量数据库集成</span></strong><span leaf="">:与向量数据库无缝集成,实现高效检索。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">应用场景</span></strong><span leaf="">:实时应用,如聊天机器人和即时问答系统。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">用户体验</span></strong><span leaf="">:用户友好且高效,降低了学习曲线和开发时间。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">社区支持</span></strong><span leaf="">:因其简单有效,RAGFlow 正逐渐受到越来越多人的青睐。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">Haystack</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000651" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.5657142857142857" data-w="700" src="/upload/87c3068353b378e84be67f036d77e0da.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/deepset-ai/haystack</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:模块化设计,包含文档检索、问答和文本摘要等组件;支持 Elasticsearch、FAISS 和 SQL 等多种文档存储方案。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:开发者、研究人员以及构建端到端问答与搜索系统的组织。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">文档检索</span></strong><span leaf="">:采用多种索引方法高效地检索相关文档。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">问答生成</span></strong><span leaf="">:利用预训练模型,根据检索到的文档生成答案。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">文本摘要</span></strong><span leaf="">:提供工具对大文档进行摘要处理。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">应用场景</span></strong><span leaf="">:广泛应用于医疗、金融以及客户支持领域的问答系统和搜索引擎。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">用户体验</span></strong><span leaf="">:具有简单的 API 和详尽的文档,新手和有经验的开发者都能轻松使用。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">社区支持</span></strong><span leaf="">:拥有活跃的社区和不断更新的开发成果。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">STORM</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000652" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.65" data-w="1080" src="/upload/ea60a7426aa28b8f5c76b3e37f7170cf.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/stanford-oval/storm</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:侧重于高效的检索机制和生成过程。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:需要快速、准确地完成文本检索和响应生成的开发者及组织。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">高度可配置的检索</span></strong><span leaf="">:支持多种检索策略和嵌入模型。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优化的生成</span></strong><span leaf="">:灵活地与生成模型集成,以提高响应质量。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">应用场景</span></strong><span leaf="">:特别适用于在线客户支持和智能助手。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">性能特点</span></strong><span leaf="">:设计注重高性能和高效率,适合实时应用。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">社区支持</span></strong><span leaf="">:在学术研究与实际应用中均有涉及。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">LLM-App</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000653" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.5625" data-w="800" src="/upload/73d0a57ee2bb1140702fdff81200dd78.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/pathwaycom/llm-app</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:提供文档解析、索引、检索及响应生成的一体化工具链。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:面向希望利用大型语言模型构建 RAG 应用的企业和开发者。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">文档解析</span></strong><span leaf="">:具备文档解析和预处理工具。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">索引功能</span></strong><span leaf="">:支持多种文档存储解决方案。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">检索与生成</span></strong><span leaf="">:集成高效的检索模块与高质量的响应生成模块。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">应用场景</span></strong><span leaf="">:在法律、医疗和客户服务等领域构建问答系统或搜索引擎。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">用户体验</span></strong><span leaf="">:凭借详细的文档和丰富示例,使得系统搭建与使用更加便捷。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">兼容性</span></strong><span leaf="">:支持多种语言模型和文档存储方案,提供均衡的 RAG 解决方案。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">txtai</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000654" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.625" data-w="1080" src="/upload/5558614b70d89abd3fbb607ea6014c90.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/neuml/txtai</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:一个集成了语义搜索、语言模型工作流与文档处理管道的一体化平台。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:需要全面解决方案以应对多项 AI 任务的各类组织。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">语义搜索</span></strong><span leaf="">:利用内嵌数据库实现高效的相似性搜索。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">语言模型工作流</span></strong><span leaf="">:轻松整合各种语言模型及 AI 服务。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">文档处理</span></strong><span leaf="">:支持多语言、多格式数据处理。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">应用场景</span></strong><span leaf="">:适用于客户服务、内容推荐以及数据分析。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">用户体验</span></strong><span leaf="">:高度集成且使用方便,适合小规模和大规模项目,同时提供详尽文档与实例帮助用户快速上手。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">R2R</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000655" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.3537037037037037" data-w="1080" src="/upload/aa13a7b4fe7a3fe2bb7be6b76a150a45.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/SciPhi-AI/R2R</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:一个轻量化框架,旨在简化从检索到响应的整个流程。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">功能</span></strong><span leaf="">:支持多步检索与生成,优化中间步骤;灵活的检索和生成策略。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">应用场景</span></strong><span leaf="">:适用于实时应用,如聊天机器人和即时问答系统。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:能够在不牺牲准确性的前提下大幅降低推理延迟。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">Cognita</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000656" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.6157407407407407" data-w="1080" src="/upload/04b1047938a38a4e672e0b6a9da39fd4.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/truefoundry/cognita</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:针对知识密集型应用设计,集成了高效的文档管理和检索机制。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于处理复杂知识图谱和问答系统的专业人士与组织。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">支持</span></strong><span leaf="">:多模态数据支持、可定制的索引方案以及高级生成模型。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">应用场景</span></strong><span leaf="">:例如医疗咨询、法律咨询等。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:高度定制化和灵活,适合需要精细知识管理的大型项目。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">FlashRAG</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000657" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.5083333333333333" data-w="1080" src="/upload/8c4b81e1d0289b1d65b451c4bca595cc.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/RUC-NLPIR/FlashRAG</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:针对推理速度进行了优化,采用了多种加速技术。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于需要实时 RAG 应用的开发者和组织。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">功能</span></strong><span leaf="">:支持多种检索模型、经过优化的重排序器以及高性能生成器。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">应用场景</span></strong><span leaf="">:例如在线客户支持和智能助手等需要即时、准确响应的系统。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:在保持准确性的同时,显著降低了推理延迟。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">Neurite</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000658" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.6314814814814815" data-w="1080" src="/upload/dce4b2278b753a963fd465c67ae0f615.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/satellitecomponent/Neurite</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:将神经网络技术与检索机制相结合。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于需要高精度和高性能的研究人员及组织。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">支持</span></strong><span leaf="">:支持各种深度学习模型、经过优化的大规模向量检索以及灵活的生成策略。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">应用场景</span></strong><span leaf="">:特别适合科学研究和数据驱动应用。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:高精度与高性能,能够显著提升检索和生成的准确性。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">Canopy</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000659" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.4027777777777778" data-w="1080" src="/upload/c78e36481293a1f3cebbfdb25b477427.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/pinecone-io/canopy</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:采用模块化和递归设计,允许灵活组合各组件。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于需要高度定制的 RAG 系统的开发者和组织。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">功能</span></strong><span leaf="">:支持多步检索与生成(通过递归调用模型)、完全可定制的组件以及广泛的模型集成。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">应用场景</span></strong><span leaf="">:适合企业级知识管理系统,能够处理复杂和动态数据。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">EasyRAG</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000660" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.46574074074074073" data-w="1080" src="/upload/276f486b68325f8ca454efdf4546e9fd.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://github.com/BUAADreamer/EasyRAG</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:专为提升 RAG 系统效率而设计,尤其适用于自动化网络操作。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:对于希望自动化网络任务(例如自动内容生成、网页抓取、社交媒体分析等)的开发者和组织非常合适。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:简化了 RAG 系统的搭建过程,提供友好的 API 和工具;其检索和生成算法经过精心优化,可在处理海量数据时保持高效。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">工作流程</span></strong><span leaf="">:通常包括双向稀疏检索初步排序、随后利用 LLM 进行重排序进行细调,再由 LLM 生成最终答案,从而确保响应的精准性。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">额外优点</span></strong><span leaf="">:基于灵活的代码库,支持多种检索与生成策略,无需微调模型即可实现低内存占用、易于部署和极佳的可扩展性。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">TableRAG</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000661" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.5518518518518518" data-w="1080" src="/upload/a691f3b0a074a762dc1f360562ee79c5.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://arxiv.org/html/2410.04739v1</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:专为处理大规模标签化的表格数据而设计,能够高效理解和生成与表格相关的内容。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于进行数据分析、报告生成以及财务报表处理等场景。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:通过查询扩展、模式和单元格检索,为语言模型提供关键信息,从而提高生成响应的准确性和效率。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">流程</span></strong><span leaf="">:包括多步检索和生成过程,显著缩短提示长度并降低重要信息丢失的风险。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">Modular RAG</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000662" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.4981481481481482" data-w="1080" src="/upload/7730e219f159987508c57d8dc52bc2da.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://arxiv.org/html/2407.21059v1</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:将 RAG 系统转变成类似乐高积木般可重构的框架。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于需要高度灵活和可定制的 RAG 应用,如企业知识管理系统、个性化推荐系统等。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:支持多步检索与生成,用户可以自选和配置各个组件,打造高度定制化的 RAG 系统。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">Speculative RAG</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000663" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.40185185185185185" data-w="1080" src="/upload/5b8d729fc49049c225bf0c1e29597754.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://arxiv.org/pdf/2407.08223</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:它首先生成草稿,然后在生成过程中通过检索和优化不断完善草稿,从而提高准确性和效率。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:特别适合要求高精度输出的场景,如内容创作、基于知识的问答、技术文档生成等。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:采用多步检索与生成流程,用户可以灵活配置组件,打造高度定制的系统。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">RAGAR</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000664" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.4988532110091743" data-w="872" src="/upload/f88fc7d90250817c61d8c21c1146fc0a.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://arxiv.org/html/2404.12065v2</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:将多模态数据与 RAG 技术整合,专为政治事实核查设计。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于新闻机构、政府部门以及政治研究机构等需要进行政治事实核查的环境。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:通过多步检索与生成,用户可自定义组件,打造高度定制化系统,以应对复杂和不断变化的数据需求。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">Blended RAG</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000665" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.8068535825545171" data-w="963" src="/upload/9ff9eaaad2cc1b8a16fb88cb98f54e59.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://arxiv.org/html/2404.07220v1</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:结合语义搜索和混合查询检索技术,提升检索准确性和效率。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适合处理大量长尾知识,如企业内部知识库或专业领域问答系统。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:通过多步检索和生成流程实现高效响应,用户可以灵活定制各组件以满足具体需求。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">ARAGOG (Advanced Retrieval Augmented Generation Output Grading)</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000666" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.2574074074074074" data-w="1080" src="/upload/9e3c65f8d4c1229e0cb5861841f51083.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://arxiv.org/html/2404.01037v1</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:评估 RAG 系统生成答案的质量。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于教育、医疗和法律咨询等需要对生成响应进行质量控制的场景。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:采用多步骤流程进行检索与生成,并通过高级输出评分定制各组件,实现高精度控制。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">RAPTOR</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000667" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.44722222222222224" data-w="1080" src="/upload/9c3b9ea9b3c855bff7b2163409b42c8c.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">• 网址:</span><span leaf="">https://arxiv.org/html/2401.18059v1</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:通过递归方法提升数据检索的效率和准确性。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于处理层级数据,例如法律文件、企业记录以及技术手册等。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:利用递归技术实现多步检索与生成,用户可灵活配置组件,打造专属定制化的 RAG 系统。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">LightRAG</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000669" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.2351851851851852" data-w="1080" src="/upload/69320aa383d361953587dba09cc31c88.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://arxiv.org/pdf/2410.05779</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:利用图结构提升检索流程效率。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于处理复杂查询和海量数据集,如企业知识库和学术研究。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:采用双层检索系统实现多步检索与生成,用户可以定制各组件以构建高度定制化的系统。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">Invar-RAG</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000668" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.5064814814814815" data-w="1080" src="/upload/8eb4a6bdc553d533e63be68246a1b53e.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://arxiv.org/html/2411.07021v1</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:利用不变对齐技术提升检索和生成过程。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于需要高精度响应生成和检索的场景,如知识密集型任务和专业领域问答。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:通过多步流程和不变对齐方法,实现高精度定制化检索与生成。</span></p> <h2 style="display: table;padding: 0 0.2em;margin: 2em auto 2em;color: rgb(0, 179, 138);background: var(--themeColor);font-size: 1.2em;font-weight: bold;text-align: center;"><strong><span leaf="">RankRAG</span></strong></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000670" data-s="300,640" data-type="png" type="block" style="height: auto !important;" data-ratio="0.2814814814814815" data-w="1080" src="/upload/50e6ff1ea646b6ea2b3576536a7c5742.png"> </section> <p style="font-size: 15px;margin: 1.5em 8px;letter-spacing: 0.1em;color: hsl(var(--foreground));text-align: justify;line-height: 2;"><span leaf="">•&nbsp;</span><strong><span leaf="">网址</span></strong><span leaf="">:</span><span leaf="">https://arxiv.org/pdf/2407.02485</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">特点</span></strong><span leaf="">:通过对大型语言模型进行微调,实现检索增强生成流程的简化。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">适用对象</span></strong><span leaf="">:适用于要求高性能和高效率的 RAG 应用,如企业内部知识库和专业领域问答系统。</span><br><span leaf="">•&nbsp;</span><strong><span leaf="">优势</span></strong><span leaf="">:采用微调方法实现多步检索与生成过程,允许用户灵活选取和配置组件,打造高度定制的 RAG 系统。</span></p> </section>

一文学会基于LangChain开发大模型RAG知识问答应用

作者:微信小助手

<section data-role="outer" label="edit by 135editor" style="line-height: 2em;"> <section data-role="outer" label="edit by 135editor" style="text-align: justify;"> <section style="line-height: 1em;text-align: center;"> <p style="text-align: justify;margin-top: 0px;line-height: 2em;margin-bottom: 24px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span style="font-size: 15px;text-decoration-thickness: initial;display: inline !important;"><span leaf="">RAG全称是</span></span><span style="font-size: 15px;color: rgba(0, 0, 0, 0.85);text-decoration-thickness: initial;display: inline !important;"><span leaf="">Retrieval-Augmented Generation,即检索增强生成。通俗来讲,就是在用户提的问题的基础上,引入相关资料信息,把“问题+相关资料” 一起给大模型,让大模型在参考资料的约束或提示下回答问题而不是随意发挥,从而期望大模型生成质量更高、更准确的答案,改善大模型”幻觉“、训练数据过时、 知识范围有限等带来的负面问题。</span></span></span></p> <p style="text-align: justify;margin-top: 0px;line-height: 2em;margin-bottom: 24px;display: block;"><span style="letter-spacing: 1px;font-size: 15px;color: rgba(0, 0, 0, 0.85);text-decoration-thickness: initial;display: inline !important;"><span leaf=""><img src="/upload/1882dde00db0625e59cf1b30ad14b7f9.null" class="rich_pages wxw-img" data-ratio="0.512962962962963" data-w="1080" style="vertical-align:baseline;"></span></span></p> <p style="text-align: justify;margin-top: 0px;line-height: 2em;margin-bottom: 24px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span style="font-size: 15px;color: rgba(0, 0, 0, 0.85);text-decoration-thickness: initial;display: inline !important;"><span leaf="">在涉及到专业领域知识或企业内部知识的应用场景中,这项技术发挥着重要作用。相比于</span></span><strong><span style="font-size: 15px;color: rgba(0, 0, 0, 0.85);text-decoration-thickness: initial;display: inline !important;"><span leaf="">大模型微调</span></span></strong><span style="font-size: 15px;color: rgba(0, 0, 0, 0.85);text-decoration-thickness: initial;display: inline !important;"><span leaf="">,RAG时间成本、经济成本和技术难度都更低。</span></span></span></p> </section> <section> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">本期内容涉及到以下知识点:</span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">1.使用LangChain调用</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">DeekSeek-v3</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">模型服务</span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">2.设计提示词模板,包括</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">系统提示词</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">和</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">用户提示词</span></span></strong></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">3.加载知识库,具体来说是本地或在线文档</span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">4.将知识库中的文档分割成</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">chunks</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">,即多个片段</span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">5.使</span></span><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;"><span leaf="">用</span><strong><span leaf="">阿里云百炼</span></strong><span leaf="">的text-embedding-v2模型做</span></span><strong style="caret-color: red;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">文本嵌入</span></span></strong><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;"><span leaf="">,然后将这些向量保存到</span></span><strong draggable="true" style="caret-color: red;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">向量数据库</span></span></strong><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;"><span leaf="">中,供之后检索使用,即</span><strong><span style="color: rgba(0, 0, 0, 0.85);font-size: 16px;font-family:Inter, -apple-system, BlinkMacSystemFont, " segoe ui, sf pro sc, display, icons, pingfang hiragino sans gb, microsoft yahei, helvetica neue, helvetica, arial, sans-serif;><span leaf="">indexing</span></span></strong></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><strong style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;color: #333333;font-size: 15px;letter-spacing: 1px;text-align: justify;caret-color: #ff0000;text-decoration-thickness: initial;font-family:mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;color: rgba(0, 0, 0, 0.85);font-size: 16px;text-decoration-thickness: initial;display: inline !important;font-family:Inter, -apple-system, BlinkMacSystemFont, " segoe ui, sf pro sc, display, icons, pingfang hiragino sans gb, microsoft yahei, helvetica neue, helvetica, arial, sans-serif;><span leaf=""><img src="/upload/57881f40507e22057f271672bfe1a484.null" class="rich_pages wxw-img" data-ratio="0.5027777777777778" data-w="1080" style="vertical-align:baseline;"></span></span></strong></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">6.使用</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">BAAI/bge-reranker-large模型</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">自定义LangChain的</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">ReRank</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">类,用于提升知识库检索结果的质量</span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">7.</span><span style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;color: #333333;text-align: justify;caret-color: #ff0000;text-decoration-thickness: initial;font-size: 15px;letter-spacing: 1px;font-family:mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span leaf="">设计</span></span><strong style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;color: #333333;font-size: 17px;text-align: justify;caret-color: #ff0000;text-decoration-thickness: initial;font-family:mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;font-size: 15px;letter-spacing: 1px;"><span leaf="">输出解析器</span></span></strong><span style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;color: #333333;text-align: justify;caret-color: #ff0000;text-decoration-thickness: initial;font-size: 15px;letter-spacing: 1px;font-family:mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span leaf="">,LangChain中的输入输出一般不是简单的字符串,比如大模型输出的是AIMessage对象,我们需要将结果格式化为目标形式</span></span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">8.</span><span style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;color: #333333;text-align: justify;caret-color: #ff0000;text-decoration-thickness: initial;font-size: 15px;letter-spacing: 1px;font-family:mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span leaf="">构建</span></span><strong style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;color: #333333;font-size: 17px;text-align: justify;caret-color: #ff0000;text-decoration-thickness: initial;font-family:mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;font-size: 15px;letter-spacing: 1px;"><span leaf="">LCEL链</span></span></strong><span style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;color: #333333;text-align: justify;caret-color: #ff0000;text-decoration-thickness: initial;font-size: 15px;letter-spacing: 1px;font-family:mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span leaf="">,chain是LangChain框架的核心特点</span></span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;color: #000000;"><span leaf="">9.给链传入</span></span><strong><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;color: #000000;"><span leaf="">回调函数</span></span></strong><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;color: #000000;"><span leaf="">,用于在链运行时获取状态信息或执行业务逻辑等</span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;color: #000000;"><span leaf="">LangChain对各种功能进行了封装,所以上述的内容虽然很多,但实际代码量却比较少。</span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;color: #ff0000;"><span leaf="">代码基于当前LangChain的最新版本v0.3</span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;color: #ff0000;"><span leaf=""><span textstyle="" style="font-size: 15px;letter-spacing: 1px;color: rgb(255, 41, 65);">向观智能公众号发送文件码 7330 即可获取本文相关文件</span></span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;color: #000000;"><span leaf="">Python库版本信息如下,使用pip默认安装最新版本即可:</span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="caret-color: red;font-size: 15px;letter-spacing: 1px;color: #000000;"><span leaf=""><img src="/upload/03cb6ee05d610f6a1527c3aa6e3ba6eb.null" class="rich_pages wxw-img" data-ratio="0.18042813455657492" data-w="981" style="vertical-align:baseline;"></span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="color: #000000;font-size: 15px;letter-spacing: 1px;caret-color: red;"><span leaf="">本期内容采用递进的方式展开。</span></span></p> <section data-role="title" data-tools="135编辑器" data-id="86264"> <section style="margin: 10px 0px;border-width: 1px 1px 1px 6px;border-style: solid;border-color: #ffffff #ffffff #ffffff #f7770e;width: 100%;border-radius: 4px;max-width:100% !important;box-sizing:border-box;" data-width="100%"> <section style="margin: 5px;padding:0 10px;box-sizing:border-box;"> <p data-brushtype="text" style="text-align: left;line-height: 2em;"><span leaf="" style="font-size: 24px;letter-spacing: 2px;"><span textstyle="" style="font-weight: bold;">大模型调用</span></span></p> </section> </section> </section> </section> <section style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 24px;"> <span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><span textstyle="" style="letter-spacing: 1px;">LangChain可以接入本地模型和云服务模型,模型来源有OpenAI、DeepSeek、</span>Anthropic、<span textstyle="" style="letter-spacing: 1px;">Hugging Face等等,可调用的模型十分丰富。</span></span></span> </section> <section style="text-align: left;margin-bottom: 0px;line-height: 1.75em;"> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><span textstyle="" style="letter-spacing: 1px;">比如可以在DeepSeek开放平台上获取我们的API Key,用它来请求DeepSeek-v3的推理服务:</span><span textstyle="" style="letter-spacing: 1px;color: rgb(178, 178, 178);">(link=&gt;https://platform.deepseek.com/)</span></span></span></p> </section> <section style="text-align: justify;margin-top: 0px;line-height: 2em;" nodeleaf=""> <img src="/upload/d246911a2545d1e655be5453878aef82.png" class="rich_pages wxw-img" data-ratio="0.262037037037037" data-s="300,640" data-type="png" data-w="1080" style="height: auto !important;vertical-align: baseline;width: 100%;box-sizing:border-box;max-width:100% !important;" type="block" data-imgfileid="100000777"> </section> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;caret-color: red;"><span leaf=""><img src="/upload/13f834d2c5d55916f2c8eb221980e783.null" class="rich_pages wxw-img" data-ratio="0.23397761953204477" data-w="983" style="vertical-align:baseline;"></span></span></p> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;caret-color: red;"><span leaf="">这里在自定义的函数env_settings()中设置了DeepSeek的API Key和服务地址两个环境变量,DeepSeek采用了和OpenAI相同的环境变量名称与调用方式:</span></span></p> <p style="text-align: justify;line-height: 2em;margin-bottom: 0px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;caret-color: red;"><span leaf=""><img src="/upload/27773a845d5ff38759a916b4aa6e0ab7.null" class="rich_pages wxw-img" data-ratio="0.1415478615071283" data-w="982" style="vertical-align:baseline;"></span></span></p> <p style="text-align:justify;line-height: 1.75em;margin-bottom: 32px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;caret-color: red;"><span leaf=""><br></span></span></p> </section> <section data-role="title" data-tools="135编辑器" data-id="86264" style="margin-bottom: 32px;line-height: 1.75em;text-align: justify;"> <section style="margin: 10px 0px;border-width: 1px 1px 1px 6px;border-style: solid;border-color: #ffffff #ffffff #ffffff #f7770e;width: 100%;border-radius: 4px;max-width:100% !important;box-sizing:border-box;" data-width="100%"> <section style="margin: 5px;padding:0 10px;box-sizing:border-box;"> <p data-brushtype="text" style="text-align: left;line-height: 2em;margin-bottom: 0px;"><span leaf="" style="font-size: 24px;"><span textstyle="" style="font-weight: bold;">提示词模板</span></span></p> </section> </section> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 24px;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">在LangChain中提示词模板推荐用ChatPromptTemplate。from_messages从消息对象模板构造整个提示词模板,每个元组的第一个元素代表消息对象模板类,第二个元素是该消息的提示词模板:</span></span></p> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 24px;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><img src="/upload/032bb4b48675a1b59aba58829a2888b6.null" class="rich_pages wxw-img" data-ratio="0.2459349593495935" data-w="984" style="vertical-align:baseline;"></span></span></p> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 0px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">如上面的system和user分别代表对应的SystemMessageTemplate和用户消息模板HumanMessageTemplate,用字符串比传入实例对象的代码要简洁。</span></span></p> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 0px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">下面看提示词的写法:</span></span></p> </section> <section data-class="_mbEditor"> <section data-class="_mbEditor"> <section style="margin: 10px;font-size: 0;" data-mid=""> <section style="width: 100%;display: flex;justify-content: flex-start;align-items: center;flex-direction: column;" data-mid=""> <section style="align-self: flex-start;margin-left: 40px;z-index: 3;margin-bottom: -3.1px;display: flex;justify-content: center;align-items: center;" data-mid=""> <section style="width: 30px;height: 5px;background: #ffffff;" data-mid=""> <span leaf=""><br></span> </section> <section style="width: 5px;height: 5px;border-radius: 2.5px;background: #9DB4C3;" data-mid=""> <span leaf=""><br></span> </section> </section> <section style="border-radius: 4px;border-width: 1px;border-style: solid;border-color: rgb(99, 125, 141);padding: 24px 14px 24px 15px;" data-mid=""> <section data-mid=""> <p style="font-size: 14px;font-family: PingFangSC-Medium, PingFang SC;font-weight: bold;color: rgb(135, 161, 178);line-height: 2em;" data-mid=""><span leaf="">("system","你是一个信息整理归纳助手,在回答用户的问题时,你需要参考上下文信息,结合用户的问题以及上下文信息,你归纳出简练、准确的答案,简练是指不要加入与问题的答案无关的语言,准确是指答案要严格与上下文保持一致。请注意,如果上下文的内容为空,那么你就返回”在资料中没有相关信息“这句话,而不要自己生成答案。上下文的信息如下:{context}")</span></p> <p style="font-size: 14px;font-family: PingFangSC-Medium, PingFang SC;font-weight: bold;color: #87A1B2;line-height: 22px;" data-mid=""><span leaf=""><br></span></p> <p style="font-size: 14px;font-family: PingFangSC-Medium, PingFang SC;font-weight: bold;color: rgb(135, 161, 178);line-height: 2em;" data-mid=""><span leaf="">("user","{question}")</span></p> </section> </section> </section> </section> </section> <p style="text-align: justify;margin-top: 0px;margin-bottom: 20px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">system即</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">系统提示词</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">部分主要用来提供上下文信息,其中的context是<span textstyle="" style="font-weight: bold;">占位符</span>,后面用从知识库中检索到的与question相近的内容填充,作为对用户问题的补充说明。</span></span></p> <p style="text-align: justify;margin-top: 0px;margin-bottom: 32px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span style="color: #333333;font-size: 15px;letter-spacing: 1px;text-align: justify;caret-color: #ff0000;text-decoration-thickness: initial;display: inline !important;font-family:mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span leaf="">用户的问题将用来填充</span></span><span leaf="">question<span textstyle="" style="font-weight: bold;">占位符</span>。</span></span></p> <section data-role="title" data-tools="135编辑器" data-id="86264"> <section style="margin: 10px 0px;border-width: 1px 1px 1px 6px;border-style: solid;border-color: #ffffff #ffffff #ffffff #f7770e;width: 100%;border-radius: 4px;max-width:100% !important;box-sizing:border-box;" data-width="100%"> <section style="margin: 5px;padding:0 10px;box-sizing:border-box;"> <p data-brushtype="text" style="text-align: left;line-height: 2em;"><span leaf="" style="font-size: 24px;"><span textstyle="" style="font-weight: bold;">文档加载、分割与向量存储</span></span></p> </section> </section> </section> <p style="text-align: justify;margin-top: 24px;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">这一部分是做信息的索引(</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">indexing</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">)</span></span></p> <p style="margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">langchain_community.document_loaders中提供了各种文档加载器,如PDF、MarkDown、HTML、网络链接、txt等等。</span></span></p> <p style="margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><img src="/upload/1e880e05d83807643c7a608f08bd0e35.null" class="rich_pages wxw-img" data-ratio="0.09837728194726167" data-w="986" style="vertical-align:baseline;"></span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">任何类型的文档被加载后都成为</span><strong><span leaf="">Document对象</span></strong><span leaf="">,该对象的page_content字段保存文档内容,元信息字段保存文档的附加信息,比如位置。</span></span></p> <p style="margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size:15px;"><span leaf="">加载得到的文档对象一般需要</span></span><strong><span style="font-size:15px;"><span leaf="">分割</span></span></strong><span style="font-size:15px;"><span leaf="">,原因有多种,比如文档太长模型无法处理、无法用向量表征语义等。</span></span></p> <p style="margin-bottom: 24px;display: block;line-height: 2em;"><span style="font-size:15px;"><span leaf=""><img src="/upload/900a3de983a6d1791d1ee0f1f2f4c714.null" class="rich_pages wxw-img" data-ratio="0.2461851475076297" data-w="983" style="vertical-align:baseline;"></span></span></p> <p style="margin-bottom: 24px;display: block;letter-spacing: 1px;text-align: justify;line-height: 2em;"><span style="font-size:15px;"><span leaf="">加载器推荐使用代码示例中的,chunk_size是指每块的最大字符长度;chunk_overlop是相邻块的重叠字符数,很简单,这样做是为了减少语义不完整的情况;separator是分割的依据:遇到双换行就分割,没有的话遇到换行就分割,以此类推。</span></span></p> <p style="margin-bottom: 24px;display: block;letter-spacing: 1px;line-height: 2em;"><span style="font-size: 15px;"><span leaf="">分割后的文档变成了多个块,每个块依然是一个Document对象,其中page_content就是该块包含的内容,元信息则和它源自的那个文档保持一致,有的提高检索质量的算法会用到这个元信息。</span></span></p> <p style="margin-bottom: 24px;display: block;letter-spacing: 1px;line-height: 2em;"><span style="font-size: 15px;"><span leaf="">接下来是做文本嵌入和词向量保存:</span></span></p> <p style="margin-bottom: 24px;display: block;letter-spacing: 1px;line-height: 2em;"><span style="font-size: 15px;"><span leaf=""><img src="/upload/0e31b473e5261f087e2dadbd2de35d92.null" class="rich_pages wxw-img" data-ratio="0.24693877551020407" data-w="980" style="vertical-align:baseline;"></span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;letter-spacing: 1px;line-height: 2em;"><span style="font-size:15px;"><span leaf="">和大语言模型一样,LangChain也集成了OpenAI、Hugging Face等多种</span></span><strong><span style="font-size:15px;"><span leaf="">嵌入模型。</span></span></strong><span style="font-size:15px;"><span leaf="">这里用的是阿里云百炼的</span></span><strong><span style="font-size:15px;"><span leaf="">DashScopeEmbeddings</span></span></strong><span style="font-size:15px;"><span leaf="">接口,申请API Key即可调用</span><span style="color: #d8d8d8;font-size: 15px;"><span leaf="">(link=&gt;https://bailian.console.aliyun.com/)&nbsp;</span></span></span></p> <p style="text-align: justify;margin-bottom: 24px;display: block;letter-spacing: 1px;line-height: 2em;"><span style="font-size:15px;"><span leaf="">同样,LangChain集成了众多的向量数据库,如Chroma、Milvus、FAISS等。</span></span><span style="font-size: 15px;caret-color: red;"><span leaf="">通过传入分割后的chunks列表以及嵌入模型对象,创建向量数据库。这里FAISS也支持将数据持久化到本地。</span></span></p> <p style="text-align: justify;letter-spacing: 1px;margin-bottom: 32px;display: block;line-height: 2em;"><span style="font-size: 15px;caret-color: red;"><span leaf="">然后使用</span></span><strong><span style="font-size: 15px;caret-color: red;"><span leaf="">RunnableLambda</span></span></strong><span style="font-size: 15px;caret-color: red;"><span leaf="">类来包装向量数据库的相似度检索函数,将其变成Runnable对象,从而能够参与构建链。</span></span></p> </section> <section data-role="title" data-tools="135编辑器" data-id="86264"> <section style="margin: 10px 0px;border-width: 1px 1px 1px 6px;border-style: solid;border-color: #ffffff #ffffff #ffffff #f7770e;width: 100%;border-radius: 4px;max-width:100% !important;box-sizing:border-box;" data-width="100%"> <section style="margin: 5px;padding:0 10px;box-sizing:border-box;"> <p data-brushtype="text" style="text-align: left;line-height: 2em;"><span leaf="" style="font-size: 24px;"><span textstyle="" style="font-weight: bold;">ReRank重排</span></span></p> </section> </section> </section> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 24px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">LangChain提供了丰富的解决方案来用于提高RAG中向量检索结果的质量,比如混合检索、多检索器检索、压缩上下文(ReRank也属于此种)等等。这里我们使用ReRank模型对向量检索的结果进行重排。</span></span><span leaf=""><br></span></p> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 0px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">在</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">Hugging Face</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">上,北京智源人工智能研究院BAAI的</span></span><span style="caret-color: red;"><span leaf="">bge-reranker-large是下载量最高的,中文语境效果很好。</span></span></p> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 0px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><img src="/upload/f27aaa152e07157d35da2a52b96c7a73.null" class="rich_pages wxw-img" data-ratio="0.38796296296296295" data-w="1080" style="vertical-align: baseline;width: 644px;box-sizing:border-box;" width="644" data-width="644px"></span></span></p> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 0px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">我们将使用这个模型做ReRank。需要安装FlagEmbedding库,创建rerank对象(第一次运行自动从网络下载到默认缓存位置):</span></span></p> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 0px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><img src="/upload/1823f1ac6bf1f02917cc391025d83bf2.null" class="rich_pages wxw-img" data-ratio="0.10133060388945753" data-w="977" style="vertical-align:baseline;"></span></span></p> <p style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 0px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">在LangChain中ReRank也属于文本压缩器compressor中的一员。我们需要自定义一个LangChain的Compressor类,继承BaseDocumentCompressor并实现compress_document方法:</span></span></p> <section style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 0px;display: block;" nodeleaf=""> <img src="/upload/d86dd8a57d46f2f0e96d7a71166a4da9.null" class="rich_pages wxw-img" data-ratio="0.17768595041322313" data-w="968" style="margin: 0px;padding: 0px;cursor: pointer;color: rgb(51, 51, 51);font-size: 15px;letter-spacing: 1px;text-align: justify;caret-color: rgb(255, 0, 0);background-color: rgb(255, 255, 255);text-decoration-thickness: initial;vertical-align: baseline;max-inline-size: 100%;overflow-wrap: break-word !important;height: auto !important;width: 100%;box-sizing:border-box;max-width:100% !important;font-family:mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;> </section> <section style="text-align: justify;margin-bottom: 24px;line-height: 2em;margin-top: 0px;display: block;" nodeleaf=""> <img src="/upload/252d9d3ca17dfc50cf3f0e3b011c93c4.null" class="rich_pages wxw-img" data-ratio="0.45871559633027525" data-w="981" style="vertical-align:baseline;"> </section> <p style="text-align: justify;line-height: 2em;margin-top: 0px;margin-bottom: 32px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">上述代码非常简单,similarity_compute函数调用了上述创建的开源rerank模型对象,来计算用户问题和上阶段检索出来的文本的相似度,然后在compress_document中叫仅仅是使用Python内建的sorted函数对检索出来的文本根据相似度得分从大到小排序,最终返回最相似的前两个。</span></span></p> <p style="text-align: justify;line-height: 2em;margin-top: 0px;margin-bottom: 32px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">然后把检索加重排的逻辑利用ContextualCompressRetriever整合起来,即将rerank对象和上面得到的向量检索器作为参数传入,该类在只是在内部依次调用它们做了向量检索和重排而已:</span></span></p> <p style="text-align: justify;line-height: 2em;margin-top: 0px;margin-bottom: 32px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><img src="/upload/f64d4c774f882f51f6991aa001cd133c.null" class="rich_pages wxw-img" data-ratio="0.17116182572614108" data-w="964" style="vertical-align:baseline;"></span></span></p> <section data-role="title" data-tools="135编辑器" data-id="86264"> <section style="margin: 10px 0px;border-width: 1px 1px 1px 6px;border-style: solid;border-color: #ffffff #ffffff #ffffff #f7770e;width: 100%;border-radius: 4px;max-width:100% !important;box-sizing:border-box;" data-width="100%"> <section style="margin: 5px;padding:0 10px;box-sizing:border-box;"> <p data-brushtype="text" style="text-align: left;line-height: 2em;"><span leaf="" style="font-size: 24px;"><span textstyle="" style="font-weight: bold;">构建链</span></span></p> </section> </section> </section> <p style="text-align: justify;line-height: 2em;margin-top: 24px;margin-bottom: 24px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">用户输入问题,然后检索得到相似上下文,此时问题和检索到上下文将被同时传入</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">提示词模板</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">来生成提示词,所以我们需要一个并行的组件</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">RunnableParallel</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">,以及一个将问题也变成Runnable对象的组件</span></span><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">RunablePassthroug</span></span></strong><strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">h</span></span></strong><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">&nbsp;(Runnable对象才能用来构建链),前者是可以同时运行两个Runable对象, 后者是将信息包装成Runanble对象并原封不动的地输出 (ps:正如很多人吐槽的那样,LangChain大量的封装逻辑往往也会引起学习或使用者理解上的困难)</span></span></p> <p style="text-align: justify;line-height: 2em;margin-top: 0px;margin-bottom: 24px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><img src="/upload/aa6073cb3e36752ca3d18242ccbc4f15.null" class="rich_pages wxw-img" data-ratio="0.1783893985728848" data-w="981" style="vertical-align:baseline;"></span></span></p> <p style="text-align: justify;line-height: 2em;margin-top: 0px;margin-bottom: 24px;display: block;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">上面第二行代码则是将整个流程中的Runnable对象组成了一个链,链本身也是Runnable。</span></span></p> <section data-role="title" data-tools="135编辑器" data-id="86264"> <section style="margin: 10px 0px;border-width: 1px 1px 1px 6px;border-style: solid;border-color: #ffffff #ffffff #ffffff #f7770e;width: 100%;border-radius: 4px;max-width:100% !important;box-sizing:border-box;" data-width="100%"> <section style="margin: 5px;padding:0 10px;box-sizing:border-box;"> <p data-brushtype="text" style="text-align: left;line-height: 2em;"><span style="font-size: 24px;"><strong><span leaf="">添加回调</span></strong></span></p> </section> </section> </section> <p style="margin-bottom: 24px;margin-top: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">可以在运行时添加自定义回调,这需要继承BaseCallbackHandler,这里我简单地实现了on_chat_model_start函数,它用于在调用大模型推理时的回调:</span></span></p> <p style="margin-bottom: 24px;margin-top: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><img src="/upload/2fb6c0caea6dc3af083b3f6160677b57.null" class="rich_pages wxw-img" data-ratio="0.19042769857433808" data-w="982" style="vertical-align:baseline;"></span></span></p> <p style="margin-bottom: 24px;margin-top: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">最后就可以运行我们的问答应用了:</span></span></p> <p style="margin-bottom: 24px;margin-top: 24px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><img src="/upload/d4b25c73056702f7b3bc90b59cc70c50.null" class="rich_pages wxw-img" data-ratio="0.13846153846153847" data-w="975" style="vertical-align:baseline;"></span></span></p> <p style="margin-top: 24px;margin-bottom: 32px;display: block;line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">链的最后是一个输出解析器,用来将大模型的回答格式化。</span></span></p> <section data-role="title" data-tools="135编辑器" data-id="86264" style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;color: #333333;font-size: 17px;text-align: justify;caret-color: #ff0000;text-decoration-thickness: initial;font-family:mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;> <section data-width="100%" style="margin: 10px 0px;padding: 0px;border-width: 1px 1px 1px 6px;border-style: solid;border-color: #ffffff #ffffff #ffffff #f7770e;width: 100%;border-radius: 4px;max-inline-size: 100%;max-width: 100%;overflow-wrap: break-word !important;box-sizing:border-box;"> <section style="max-inline-size: 100%;margin: 5px;padding: 0px 10px;box-sizing: border-box;overflow-wrap: break-word !important;"> <p data-brushtype="text" style="text-align: left;max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;clear: both;min-height: 1em;cursor: text;line-height: 2em;"><span leaf="" style="max-inline-size: 100%;margin: 0px;padding: 0px;cursor: text;font-size: 24px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span textstyle="" style="font-weight: bold;">输出解析器</span></span></p> </section> </section> </section> <p style="text-align: justify;max-inline-size: 100%;margin: 24px 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;clear: both;min-height: 1em;cursor: text;color: rgb(51, 51, 51);font-size: 17px;caret-color: rgb(255, 0, 0);text-decoration-thickness: initial;line-height: 2em;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span leaf="" style="max-inline-size: 100%;margin: 0px;padding: 0px;cursor: text;font-size: 15px;letter-spacing: 1px;box-sizing: border-box !important;overflow-wrap: break-word !important;">LangChain中的消息都用消息对象封装,比如大模型输出的是AIMessage对象。所以我们需要把结果结构化成我们期望的格式,比如框架自带的StrOutputParser就是提取模型输出对象中content信息。</span></p> <p style="text-align: justify;max-inline-size: 100%;margin: 0px 0px 24px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;clear: both;min-height: 1em;cursor: text;color: rgb(51, 51, 51);font-size: 17px;caret-color: rgb(255, 0, 0);text-decoration-thickness: initial;line-height: 2em;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span leaf="" style="max-inline-size: 100%;margin: 0px;padding: 0px;cursor: text;font-size: 15px;letter-spacing: 1px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><img src="/upload/c4f03774762176e004aed80c42b37a04.null" class="rich_pages wxw-img" data-ratio="0.1747173689619733" data-w="973" style="vertical-align:baseline;"></span></p> <p style="text-align: justify;max-inline-size: 100%;margin: 0px 0px 24px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;clear: both;min-height: 1em;cursor: text;color: rgb(51, 51, 51);font-size: 17px;caret-color: rgb(255, 0, 0);text-decoration-thickness: initial;line-height: 2em;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;font-size: 15px;"><span style="max-inline-size: 100%;margin: 0px;padding: 0px;cursor: text;letter-spacing: 1px;caret-color: red;"><span leaf="">通过继承解析器基类</span></span><strong style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;"><span style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;letter-spacing: 1px;caret-color: red;"><span leaf="">BaseOutputParser</span></span></strong><span style="max-inline-size: 100%;margin: 0px;padding: 0px;cursor: text;letter-spacing: 1px;caret-color: red;"><span leaf="">,重写parse方法,自定义输出形式:</span></span></span></p> <p style="text-align: justify;max-inline-size: 100%;margin: 0px 0px 32px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;clear: both;min-height: 1em;cursor: text;color: rgb(51, 51, 51);font-size: 17px;caret-color: rgb(255, 0, 0);text-decoration-thickness: initial;line-height: 2em;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;><span style="max-inline-size: 100%;margin: 0px;padding: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;cursor: text;font-size: 15px;"><span style="max-inline-size: 100%;margin: 0px;padding: 0px;cursor: text;letter-spacing: 1px;caret-color: red;"><span leaf=""><img src="/upload/c261f662a9b8d1ffd6d4f399d953adc4.null" class="rich_pages wxw-img" data-ratio="0.22346938775510203" data-w="980" style="vertical-align:baseline;"></span></span></span></p> <section data-role="title" data-tools="135编辑器" data-id="86264"> <section style="margin: 10px 0px;border-width: 1px 1px 1px 6px;border-style: solid;border-color: #ffffff #ffffff #ffffff #f7770e;width: 100%;border-radius: 4px;max-width:100% !important;box-sizing:border-box;" data-width="100%"> <section style="margin: 5px;padding:0 10px;box-sizing:border-box;"> <p data-brushtype="text" style="text-align: left;line-height: 2em;"><span style="font-size: 24px;"><strong><span leaf="">效果测试</span></strong></span></p> </section> </section> </section> <p style="text-align: justify;line-height: 2em;margin-bottom: 24px;margin-top: 24px;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">测试文档中有一些人物的介绍信息,我希望通过大模型帮我快速总结关键信息,而不用自己阅读完整文档,在提示词中已经限制大模型要用简练的语言回答,并且文档中不存在的人物就按约定的内容回答不知道,下面看一下模型效果:</span></span></p><span leaf=""><span textstyle="" style="font-weight: bold;">问</span>:<span textstyle="" style="font-size: 15px;">林悦喜欢吃什么</span></span> </section> <p style="line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><span textstyle="" style="font-weight: bold;">答</span>:</span></span></p> <p style="line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">根据您的问题,我找到的相关答案是:</span></span></p> <p style="line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">林悦喜欢吃火锅,尤其是涮毛肚和鸭肠,蘸香油蒜泥调料。她还喜欢各种川味小吃,如钟水饺和龙抄手,以及一些清淡的川菜,如开水白菜。</span></span></p> <p style="line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">^^_^^感谢您的咨询^^_^^</span></span></p> <p style="line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><span textstyle="" style="font-weight: bold;">问</span>:诸葛亮喜欢吃什么</span></span></p> <p style="line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><span textstyle="" style="font-weight: bold;">答</span>:</span></span></p> <p style="line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">根据您的问题,我找到的相关答案是:</span></span></p> <p style="line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">在资料中没有相关信息。</span></span></p> <p style="line-height: 2em;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf="">^^_^^感谢您的咨询^^_^^</span></span></p> <p style="line-height: 2em;text-align: left;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><img src="/upload/c0ef5946360eeb898705fa8efe363d88.png" class="rich_pages wxw-img" data-ratio="0.14285714285714285" data-type="gif" data-w="1078" style="height:40px;display:block;" data-imgfileid="100000600"></span></span></p> <p style="line-height: 2em;text-align: left;"><span style="font-size: 15px;letter-spacing: 1px;"><span leaf=""><span textstyle="" style="font-size: 12px;color: rgb(178, 178, 178);">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 喜欢作者的文章就关注吧~</span></span></span></p> <section class="mp_profile_iframe_wrp" nodeleaf="" style="line-height: 2em;"> <mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-nickname="观智能" data-alias="WMZ113508PLUS" data-from="0" data-headimg="http://mmbiz.qpic.cn/sz_mmbiz_png/w0d0t6xrs0kDPRFkX0m9ibpAWzHLhoXuXbl7C5f1oc1hLwDrrxaQQgdsh2nuub3dicueBOIscoawXFLX3I0775hQ/0?wx_fmt=png" data-signature="AI技术分析、项目实战与资讯解读" data-id="MzU3Nzc0MzE3MA==" data-is_biz_ban="0" data-service_type="1"></mp-common-profile> </section> <p><span leaf=""><br></span></p> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

利用时间戳校验防止爬虫滥用接口

作者:微信小助手

<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 10px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;font-family: Optima, 'Microsoft YaHei', PingFangSC-regular, serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;overflow-wrap: break-word;text-align: left;"> <h1 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: 100%;-webkit-box-reflect: unset;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 22px;border-bottom-color: rgb(0, 150, 136);color: rgb(0, 150, 136);line-height: 1.5em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: 100%;height: auto;align-items: unset;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 10px;padding-left: 0px;padding-right: 0px;text-align: center;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;"><span leaf="">利用时间戳校验防止爬虫滥用接口</span></span><span style="display: none;"><span leaf=""><br></span></span></h1> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: justify;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">爬虫是现代互联网中常见的恶意行为,尤其是在接口暴露给外部时,爬虫往往通过自动化脚本频繁访问接口、获取数据,甚至滥用接口导致服务器压力增大,影响正常用户的使用体验。为了有效防止爬虫的恶意抓取行为,除了常规的防护手段外,利用</span><strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">带校验位的时间戳</span></strong><span leaf="">也是一种非常巧妙且高效的防护方式。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: justify;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">本文将介绍如何通过时间戳校验来增加接口的防爬虫能力,具体是通过在接口中加入一个带校验位的时间戳,令爬虫抓取时多次失败,成功几率极低,从而达到防止爬虫滥用接口的目的。</span></p> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(0, 150, 136);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 3px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 150, 136);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">一、带校验位的时间戳防止爬虫</span></span><span style="display: none;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: justify;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">为了防止爬虫轻松抓取接口数据,我们可以利用时间戳并附加校验位。爬虫在爬取接口时,通常会认为接口中的时间戳是一个简单的时间标识,而忽略了背后的校验机制。这样,通过在时间戳中加入一个校验位,爬虫大多数情况下无法正确猜测出校验位,从而导致请求失败。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 18px;color: rgb(34, 34, 34);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 2px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 150, 136);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">1.1 时间戳生成与校验位机制</span></span><span style="display: none;"><span leaf=""><br></span></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: justify;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">时间戳本身作为接口的一个参数,可以用来标记请求的时间,确保请求的时效性。而通过附加校验位,爬虫无法轻易预测正确的时间戳。具体的步骤如下:</span></p> <ol style="list-style-type: decimal;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">生成时间戳</span></strong><span leaf="">:获取当前系统的13位毫秒级时间戳。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">计算校验位</span></strong><span leaf="">:根据前12位时间戳,使用某种算法计算一个校验位(通常是取前12位各位数字和对10取模)。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">拼接时间戳和校验位</span></strong><span leaf="">:将计算出的校验位附加在时间戳的第13位,形成一个新的13位时间戳。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">接口校验</span></strong><span leaf="">:当客户端请求时,接口会验证时间戳的校验位是否正确,如果不匹配,则认为该请求是无效的。</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: justify;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">通过这种方式,爬虫在尝试访问接口时,由于无法知道校验位的生成规则,因此即便发送了带有时间戳的请求,绝大多数情况下也会因为校验失败而导致请求被拒绝。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 18px;color: rgb(34, 34, 34);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 2px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 150, 136);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">1.2 示例:Java实现时间戳校验</span></span><span style="display: none;"><span leaf=""><br></span></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: justify;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">以下是一个简单的Java实现代码,通过该代码可以生成带校验位的时间戳,并校验其有效性。</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg qd3u5ihsyticatex1fludtkhmwjwmia113xyynm6zyre4pldianxwitibibf03ul9jv8zfhicovswic7ahqt6qxtt1bxzidh5ziaibypz 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">public</span></span><span leaf="">&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">class</span></span><span leaf="">&nbsp;</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">TimestampWithCheck</span></span><span leaf="">&nbsp;</span></span><span leaf="">{</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 生成带校验位的13位时间戳</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">public</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">static</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">long</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">generateTimestampWithCheck</span></span><span style="line-height: 26px;"><span leaf="">()</span></span><span leaf="">&nbsp;</span></span><span leaf="">{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 获取当前的13位时间戳</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">long</span></span><span leaf="">&nbsp;timestamp = System.currentTimeMillis();</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 提取前12位时间戳</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">long</span></span><span leaf="">&nbsp;timestampWithoutCheck = timestamp /&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">10</span></span><span leaf="">;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 计算校验位</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">int</span></span><span leaf="">&nbsp;checkBit = calculateCheckBit(timestampWithoutCheck);</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 拼接时间戳和校验位</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf="">&nbsp;timestampWithoutCheck *&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">10</span></span><span leaf="">&nbsp;+ checkBit;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; }</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 校验位计算:取前12位各位数之和的个位数</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">private</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">static</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">int</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">calculateCheckBit</span></span><span style="line-height: 26px;"><span leaf="">(</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">long</span></span><span leaf="">&nbsp;timestampWithoutCheck)</span></span><span leaf="">&nbsp;</span></span><span leaf="">{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">int</span></span><span leaf="">&nbsp;sum =&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">0</span></span><span leaf="">;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">while</span></span><span leaf="">&nbsp;(timestampWithoutCheck &gt;&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">0</span></span><span leaf="">) {</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sum += timestampWithoutCheck %&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">10</span></span><span leaf="">;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timestampWithoutCheck /=&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">10</span></span><span leaf="">;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; }</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf="">&nbsp;sum %&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">10</span></span><span leaf="">;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 取个位数作为校验位</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; }</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 校验时间戳的有效性</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">public</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">static</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">boolean</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">validateTimestamp</span></span><span style="line-height: 26px;"><span leaf="">(</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">long</span></span><span leaf="">&nbsp;timestampWithCheck)</span></span><span leaf="">&nbsp;</span></span><span leaf="">{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 提取时间戳的前12位和校验位</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">long</span></span><span leaf="">&nbsp;timestampWithoutCheck = timestampWithCheck /&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">10</span></span><span leaf="">;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">int</span></span><span leaf="">&nbsp;providedCheckBit = (</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">int</span></span><span leaf="">) (timestampWithCheck %&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">10</span></span><span leaf="">);</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 计算正确的校验位</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">int</span></span><span leaf="">&nbsp;calculatedCheckBit = calculateCheckBit(timestampWithoutCheck);</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 校验时间戳的校验位是否正确</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf="">&nbsp;providedCheckBit == calculatedCheckBit;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; }</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">public</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">static</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">void</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">main</span></span><span style="line-height: 26px;"><span leaf="">(String[] args)</span></span><span leaf="">&nbsp;</span></span><span leaf="">{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 生成带校验位的时间戳</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">long</span></span><span leaf="">&nbsp;timestampWithCheck = generateTimestampWithCheck();</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"Generated Timestamp with Check: "</span></span><span leaf="">&nbsp;+ timestampWithCheck);</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">// 验证时间戳是否有效</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">boolean</span></span><span leaf="">&nbsp;isValid = validateTimestamp(timestampWithCheck);</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"Is the Timestamp Valid? "</span></span><span leaf="">&nbsp;+ isValid);</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; }</span><span leaf=""><br></span><span leaf="">}</span><span leaf=""><br></span></code></pre> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(0, 150, 136);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 3px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 150, 136);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">二、为什么带校验位的时间戳能有效防止爬虫?</span></span><span style="display: none;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: justify;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">爬虫通常会直接抓取接口的数据,并通过时间戳作为一个普通的参数进行请求。然而,在我们的方案中,时间戳并不仅仅是一个简单的时间标识。爬虫无法轻易知道校验位的生成规则,因此:</span></p> <ol style="list-style-type: decimal;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">难以猜测校验位</span></strong><span leaf="">:时间戳的校验位是通过前12位的时间戳计算出来的,如果爬虫不清楚这个规则,它就无法正确预测校验位。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">大多数请求失败</span></strong><span leaf="">:即使爬虫抓取时随机生成时间戳,也会因为校验位不匹配导致请求失败。这样,爬虫很难找到正确的时间戳,造成它在频繁访问接口时,大多数请求都会失败。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">增加猜测的难度</span></strong><span leaf="">:爬虫若要猜测校验位,需要大量的请求尝试,并且无法确定正确的校验位,这会显著增加爬虫的抓取难度。</span> </section></li> </ol> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(0, 150, 136);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 3px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 150, 136);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">三、好处与局限性</span></span><span style="display: none;"><span leaf=""><br></span></span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 18px;color: rgb(34, 34, 34);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 2px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 150, 136);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">3.1 好处</span></span><span style="display: none;"><span leaf=""><br></span></span></h3> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">简洁有效</span></strong><span leaf="">:通过在时间戳中增加校验位,爬虫难以绕过这种防护方式,成功率低,能有效减少接口被滥用的可能性。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">无需复杂配置</span></strong><span leaf="">:该方法实现简单,不需要太复杂的设置,适用于大多数接口。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">增加爬虫抓取成本</span></strong><span leaf="">:每次请求需要进行时间戳计算,爬虫无法直接复制时间戳,因此增加了其抓取的成本。</span> </section></li> </ul> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 18px;color: rgb(34, 34, 34);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 2px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 150, 136);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">3.2 局限性</span></span><span style="display: none;"><span leaf=""><br></span></span></h3> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(0, 150, 136);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">可能的猜测成功</span></strong><span leaf="">:在某些情况下,爬虫可能通过反复尝试猜测到正确的校验位,但这种概率非常低,且无法持续稳定。</span> </section></li> </ul> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(0, 150, 136);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 3px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 150, 136);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">四、总结</span></span><span style="display: none;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: justify;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">通过在接口中加入带校验位的时间戳,可以有效防止爬虫对接口的滥用。爬虫通常会将时间戳视为普通的时间标识,而无法猜测到隐藏在时间戳背后的校验位规则。这样,它们大多数情况下会因校验失败而无法成功抓取数据。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: justify;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">虽然这种方法并非绝对的防护手段,但它增加了爬虫抓取的难度,提高了接口的安全性,适合用作防爬虫策略之一。结合其他技术(如验证码、IP限制等),可以进一步加强接口的安全防护,保障系统的稳定运行。</span></p> </section> <section> <span leaf=""><br></span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

什么是向量化?ElasticSearch如何存储向量?

作者:微信小助手

<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 10px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;font-family: Optima, 'Microsoft YaHei', PingFangSC-regular, serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;overflow-wrap: break-word;text-align: left;"> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">向量化(Vectorization)是一种将数据或操作转换为向量的过程,以便利用并行计算和高效处理。向量化将非数值数据(如文本、图像)转换为数值向量,以便计算机处理。而向量化在AIGC中非常的常见,例如知识库对话等等。如果大家感兴趣,后面专门来聊聊。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">向量长什么样?例如:[0.25, -0.1, 0.7]</span><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">,向量化后的数据通常是一个</span></strong><span leaf="">数值数组</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">那我们如何将文本向量化呢,有很多种方式,这里我们使用Embedding。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Embedding(嵌入)是一种将高维、离散的数据(如单词、类别、图像等)映射到低维、连续的向量空间的技术。这些向量能够捕捉数据的语义或特征信息,广泛应用于自然语言处理(NLP)、推荐系统和机器学习等领域。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">例如通过下面的代码我们可以将文本转换为向量化:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 574vdhmfwafog4qvgurhcxtyiaxricew5kib7axxb3d5egipnzl3tianv0izons5yyvfyrfsphkztqtaeqluiccalreqjg8tfntkg 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;transformers&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;BertTokenizer, BertModel</span><br><br><span leaf="">tokenizer = BertTokenizer.from_pretrained(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'bert-base-uncased'</span></span><span leaf="">)</span><br><span leaf="">model = BertModel.from_pretrained(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'bert-base-uncased'</span></span><span leaf="">)</span><br><span leaf="">inputs = tokenizer(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"I love programming"</span></span><span leaf="">, return_tensors=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"pt"</span></span><span leaf="">)</span><br><span leaf="">outputs = model(**inputs)</span><br><span leaf="">embeddings = outputs.last_hidden_state &nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 获取单词或句子的向量</span></span><br></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">向量数据库是一种专门设计用于存储和查询向量数据的数据库,而ElasticSearch就可以用来存储我们的向量</span></p> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100003050" src="/upload/5902ff97e99883a3fc7c77324674d857.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> </figure> <h2 data-tool="mdnice编辑器" style=" border-bottom-color: rgb(239, 112, 96);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.1em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 22px;color: rgb(255, 255, 255);background-color: rgb(239, 112, 96);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 5px;overflow-x: unset;overflow-y: unset;padding-top: 3px;padding-bottom: 1px;padding-left: 10px;padding-right: 10px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">定义向量字段</span></span><span style="display: none;"></span><span style=" border-bottom-color: rgb(239, 235, 233);align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: solid;border-top-width: 1px;border-bottom-width: 36px;border-left-width: 1px;border-right-width: 20px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: transparent;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 16px;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.1em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">&nbsp;</span></span></h2> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 574vdhmfwafog4qvgurhcxtyiaxricew5kib7axxb3d5egipnzl3tianv0izons5yyvfyrfsphkztqtaeqluiccalreqjg8tfntkg 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">PUT /test2</span><br><span leaf="">{</span><br><span leaf="">&nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"mappings"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"properties"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"my_vector"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"type"</span></span><span leaf="">:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"dense_vector"</span></span><span leaf="">,</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"dims"</span></span><span leaf="">: 3</span><br><span leaf="">&nbsp; &nbsp; &nbsp; },</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"my_text"</span></span><span leaf="">&nbsp;: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"type"</span></span><span leaf="">&nbsp;:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"keyword"</span></span><br><span leaf="">&nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; }</span><br><span leaf="">&nbsp; }</span><br><span leaf="">}</span><br></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">这里我们定义test2 文档的内容如下(my_vector 和 my_text):</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">my_vector</span></code><span leaf="">&nbsp;是一个密集向量(dense vector),用于存储多维数据,如嵌入式表示;而&nbsp;</span><code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">my_text</span></code><span leaf="">&nbsp;是一个关键字类型的字段,通常用于精确匹配和聚合。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">dims</span></code><span leaf="">: 3:指定向量的维度为 3。这意味着每个文档的 my_vector 字段将包含 3 个浮点数。</span></p> <h2 data-tool="mdnice编辑器" style=" border-bottom-color: rgb(239, 112, 96);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.1em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 22px;color: rgb(255, 255, 255);background-color: rgb(239, 112, 96);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 5px;overflow-x: unset;overflow-y: unset;padding-top: 3px;padding-bottom: 1px;padding-left: 10px;padding-right: 10px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">添加向量</span></span><span style="display: none;"></span><span style=" border-bottom-color: rgb(239, 235, 233);align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: solid;border-top-width: 1px;border-bottom-width: 36px;border-left-width: 1px;border-right-width: 20px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: transparent;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 16px;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.1em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">&nbsp;</span></span></h2> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 574vdhmfwafog4qvgurhcxtyiaxricew5kib7axxb3d5egipnzl3tianv0izons5yyvfyrfsphkztqtaeqluiccalreqjg8tfntkg 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">PUT /test2/_doc/2</span><br><span leaf="">{</span><br><span leaf="">&nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"my_text"</span></span><span leaf="">&nbsp;:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"text1"</span></span><span leaf="">,</span><br><span leaf="">&nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"my_vector"</span></span><span leaf="">&nbsp;: [0.5, 10, 6]</span><br><span leaf="">}</span><br></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">假设&nbsp;</span><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">text1</span></strong><span leaf="">&nbsp;的向量为&nbsp;</span><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">[0.5, 10, 6]</span></strong></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">my_text</span></code><span leaf="">: "text1":设置 my_text 字段的值为 "text1"。根据之前的映射,my_text 是一个 keyword 类型的字段,适用于精确匹配和聚合。</span><code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">my_vector</span></code><span leaf="">: [0.5, 10, 6]:设置 my_vector 字段的值为 [0.5, 10, 6],my_vector 是一个 dense_vector 类型的字段,维度为 3。</span></p> <h2 data-tool="mdnice编辑器" style=" border-bottom-color: rgb(239, 112, 96);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.1em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 22px;color: rgb(255, 255, 255);background-color: rgb(239, 112, 96);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 5px;overflow-x: unset;overflow-y: unset;padding-top: 3px;padding-bottom: 1px;padding-left: 10px;padding-right: 10px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">余弦相似度:cosineSimilarity</span></span><span style="display: none;"></span><span style=" border-bottom-color: rgb(239, 235, 233);align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: solid;border-top-width: 1px;border-bottom-width: 36px;border-left-width: 1px;border-right-width: 20px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: transparent;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 16px;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.1em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">&nbsp;</span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">那么我们存入了向量是不是也要查询,假如我们有一个字符串&nbsp;</span><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">test2</span></strong><span leaf="">&nbsp;向量化之后的数据为 &nbsp;</span><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">[-0.5, 10, 7]</span></strong></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 574vdhmfwafog4qvgurhcxtyiaxricew5kib7axxb3d5egipnzl3tianv0izons5yyvfyrfsphkztqtaeqluiccalreqjg8tfntkg 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">POST /test2/_search</span><br><span leaf="">{</span><br><span leaf="">&nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"script_score"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"match_all"</span></span><span leaf="">: {}</span><br><span leaf="">&nbsp; &nbsp; &nbsp; },</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"script"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"source"</span></span><span leaf="">:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"cosineSimilarity(params.queryVector, 'my_vector') + 1.0"</span></span><span leaf="">,</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"params"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"queryVector"</span></span><span leaf="">: [-0.5, 10, 7]</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; }</span><br><span leaf="">&nbsp; }</span><br><span leaf="">}</span><br></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">这个请求使用了&nbsp;</span><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">script_score</span></strong><span leaf="">&nbsp;查询,结合 cosineSimilarity 函数来计算文档中 my_vector 字段与给定查询向量之间的余弦相似度。为了确保查询结果的分数是非负的,cosineSimilarity 的结果加了 1.0。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">cosineSimilarity</span></code><span leaf="">&nbsp;函数:cosineSimilarity 是 Elasticsearch 提供的一个内置函数,用于计算两个向量之间的余弦相似度。它适用于 dense_vector 类型的字段。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">余弦相似度(Cosine Similarity)</span></strong></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">定义</span></strong><span leaf="">:余弦相似度通过计算两个向量的夹角余弦值来衡量它们的相似性。公式为:</span></p> <figure style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100003047" src="/upload/37c1d1103c8d295666452ebc257e7381.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> </figure> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">其中,A⋅B</span><em style="color: rgb(0, 0, 0);font-style: italic;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">A</span></em><span leaf="">⋅</span><em style="color: rgb(0, 0, 0);font-style: italic;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">B</span></em><span leaf="">&nbsp;是向量的点积,∥A∥∥</span><em style="color: rgb(0, 0, 0);font-style: italic;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">A</span></em><span leaf="">∥ 和 ∥B∥∥</span><em style="color: rgb(0, 0, 0);font-style: italic;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">B</span></em><span leaf="">∥ 是向量的模。</span></p> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">用途</span></strong><span leaf="">:常用于文本相似度计算、推荐系统等场景,因为它对向量的绝对大小不敏感,只关注方向。</span></p> </section></li> </ul> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">向量维度:确保 queryVector 的维度与索引映射中定义的 my_vector 字段的维度一致,my_vector 的维度是 3,因此 queryVector 也必须是 3 维向量。如果维度不匹配,Elasticsearch 将返回错误。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">评分范围:cosineSimilarity 的结果范围是 [-1, 1],其中 1 表示完全相同,-1 表示完全相反。为了确保评分是非负的,通常会将结果加 1.0,这样评分范围变为 [0, 2]。我们可以根据需要调整这个偏移量。</span></p> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100003049" src="/upload/34eb2396cc48e728e6f34f1d24a9d9e3.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> </figure> <h2 data-tool="mdnice编辑器" style=" border-bottom-color: rgb(239, 112, 96);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.1em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 22px;color: rgb(255, 255, 255);background-color: rgb(239, 112, 96);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 5px;overflow-x: unset;overflow-y: unset;padding-top: 3px;padding-bottom: 1px;padding-left: 10px;padding-right: 10px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">计算点积:dotProduct</span></span><span style="display: none;"></span><span style=" border-bottom-color: rgb(239, 235, 233);align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: solid;border-top-width: 1px;border-bottom-width: 36px;border-left-width: 1px;border-right-width: 20px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: transparent;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 16px;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.1em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">&nbsp;</span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">除了余弦相似度这种算法,我们还可以使用&nbsp;</span><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">计算点积:dotProduct</span></strong><span leaf="">&nbsp;来计算</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 574vdhmfwafog4qvgurhcxtyiaxricew5kib7axxb3d5egipnzl3tianv0izons5yyvfyrfsphkztqtaeqluiccalreqjg8tfntkg 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">POST /test2/_search</span><br><span leaf="">{</span><br><span leaf="">&nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"script_score"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"match_all"</span></span><span leaf="">: {}</span><br><span leaf="">&nbsp; &nbsp; &nbsp; },</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"script"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"source"</span></span><span leaf="">:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"dotProduct(params.queryVector, 'my_vector') + 1.0"</span></span><span leaf="">,</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"params"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"queryVector"</span></span><span leaf="">: [-0.5, 10, 7]</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; }</span><br><span leaf="">&nbsp; }</span><br><span leaf="">}</span><br></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">点积(Dot Product)</span></strong></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">定义</span></strong><span leaf="">:点积是两个向量对应元素相乘后的和。公式为:</span></p> <figure style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100003046" src="/upload/e82d8829a4b0cc07057481ab5d37de5f.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> </figure> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">用途</span></strong><span leaf="">:点积可以用于衡量两个向量的相似性,尤其是在向量已经归一化的情况下。它也是许多机器学习算法中的基本操作。</span></p> </section></li> </ul> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100003048" src="/upload/4c684f6e68865075c3c98aec2b301c9f.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> </figure> <h2 data-tool="mdnice编辑器" style=" border-bottom-color: rgb(239, 112, 96);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.1em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 22px;color: rgb(255, 255, 255);background-color: rgb(239, 112, 96);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 5px;overflow-x: unset;overflow-y: unset;padding-top: 3px;padding-bottom: 1px;padding-left: 10px;padding-right: 10px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">曼哈顿距离:l1norm</span></span><span style="display: none;"></span><span style=" border-bottom-color: rgb(239, 235, 233);align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: solid;border-top-width: 1px;border-bottom-width: 36px;border-left-width: 1px;border-right-width: 20px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: transparent;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 16px;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.1em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">&nbsp;</span></span></h2> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 574vdhmfwafog4qvgurhcxtyiaxricew5kib7axxb3d5egipnzl3tianv0izons5yyvfyrfsphkztqtaeqluiccalreqjg8tfntkg 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">POST /test2/_search</span><br><span leaf="">{</span><br><span leaf="">&nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"script_score"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"match_all"</span></span><span leaf="">: {}</span><br><span leaf="">&nbsp; &nbsp; &nbsp; },</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"script"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"source"</span></span><span leaf="">:</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"1 / (1 + l1norm(params.queryVector, 'my_vector'))"</span></span><span leaf="">,</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"params"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"queryVector"</span></span><span leaf="">: [-0.5, 10, 7]</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; }</span><br><span leaf="">&nbsp; }</span><br><span leaf="">}</span><br></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">曼哈顿距离(Manhattan Distance, L1 Norm)</span></strong></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">定义</span></strong><span leaf="">:曼哈顿距离是两个向量在标准坐标系下的绝对差之和。公式为:</span></p> <figure style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100003052" src="/upload/a375679d9a97ce2f10877a2c91c1cc4d.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> </figure> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">用途</span></strong><span leaf="">:适用于需要衡量向量之间绝对差异的场景,如路径规划、图像处理等。</span></p> </section></li> </ul> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100003055" src="/upload/cdc2d4f54b94005707614f9a3a20e9b5.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> </figure> <h2 data-tool="mdnice编辑器" style=" border-bottom-color: rgb(239, 112, 96);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.1em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 22px;color: rgb(255, 255, 255);background-color: rgb(239, 112, 96);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 5px;overflow-x: unset;overflow-y: unset;padding-top: 3px;padding-bottom: 1px;padding-left: 10px;padding-right: 10px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">欧几里得距离:l2norm</span></span><span style="display: none;"></span><span style=" border-bottom-color: rgb(239, 235, 233);align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: solid;border-top-width: 1px;border-bottom-width: 36px;border-left-width: 1px;border-right-width: 20px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: transparent;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 16px;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.1em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">&nbsp;</span></span></h2> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 574vdhmfwafog4qvgurhcxtyiaxricew5kib7axxb3d5egipnzl3tianv0izons5yyvfyrfsphkztqtaeqluiccalreqjg8tfntkg 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">POST /test2/_search</span><br><span leaf="">{</span><br><span leaf="">&nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"script_score"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"match_all"</span></span><span leaf="">: {}</span><br><span leaf="">&nbsp; &nbsp; &nbsp; },</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"script"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"source"</span></span><span leaf="">:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"1 / (1 + l2norm(params.queryVector, 'my_vector'))"</span></span><span leaf="">,</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"params"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"queryVector"</span></span><span leaf="">: [</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -0.5,</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 10,</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; }</span><br><span leaf="">&nbsp; }</span><br><span leaf="">}</span><br></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">欧几里得距离(Euclidean Distance, L2 Norm)</span></strong></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">定义</span></strong><span leaf="">:欧几里得距离是两个向量之间的直线距离。公式为:</span></p> <figure style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100003051" src="/upload/ba4d9ea55ccbdaaa5dac06e9ca6f3b6b.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> </figure> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">用途</span></strong><span leaf="">:广泛用于聚类分析、图像识别等领域,因为它直观地反映了向量之间的几何距离。</span></p> </section></li> </ul> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100003054" src="/upload/d7be843759b17f11122c0c86cb688eb1.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> </figure> <h2 data-tool="mdnice编辑器" style=" border-bottom-color: rgb(239, 112, 96);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.1em;overflow-x: unset;overflow-y: unset; text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span style="display: none;"></span><span style=" font-size: 22px;color: rgb(255, 255, 255);background-color: rgb(239, 112, 96);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 5px;overflow-x: unset;overflow-y: unset;padding-top: 3px;padding-bottom: 1px;padding-left: 10px;padding-right: 10px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">自定义函数</span></span><span style="display: none;"></span><span style=" border-bottom-color: rgb(239, 235, 233);align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: solid;border-top-width: 1px;border-bottom-width: 36px;border-left-width: 1px;border-right-width: 20px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: transparent;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 16px;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.1em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px; text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset; "><span leaf="">&nbsp;</span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">除了上面的内置函数,这些算法在信息检索、推荐系统、聚类分析等领域有广泛应用。我们甚至可以自定义函数:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 574vdhmfwafog4qvgurhcxtyiaxricew5kib7axxb3d5egipnzl3tianv0izons5yyvfyrfsphkztqtaeqluiccalreqjg8tfntkg 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">POST /test2/_search</span><br><span leaf="">{</span><br><span leaf="">&nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"script_score"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"match_all"</span></span><span leaf="">: {}</span><br><span leaf="">&nbsp; &nbsp; &nbsp; },</span><br><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"script"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"source"</span></span><span leaf="">:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"float[] v = doc['my_vector'].vectorValue; float vm = doc['my_vector'].magnitude; float dotProduct = 0; for (int i = 0; i &lt; v.length; i++) { dotProduct += v[i] * params.queryVector[i]; } return dotProduct / (vm * (float) params.queryVectorMag);"</span></span><span leaf="">,</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"params"</span></span><span leaf="">: {</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"queryVector"</span></span><span leaf="">: [</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -0.5,</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 10,</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ],</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"queryVectorMag"</span></span><span leaf="">: 5.25357</span><br><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; &nbsp; }</span><br><span leaf="">&nbsp; &nbsp; }</span><br><span leaf="">&nbsp; }</span><br><span leaf="">}</span><br></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(0, 0, 0);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">脚本逻辑</span></strong></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 574vdhmfwafog4qvgurhcxtyiaxricew5kib7axxb3d5egipnzl3tianv0izons5yyvfyrfsphkztqtaeqluiccalreqjg8tfntkg 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #e6c07b;line-height: 26px;"><span leaf="">float</span></span><span leaf="">[] v = doc[</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'my_vector'</span></span><span leaf="">].vectorValue; &nbsp;// 获取文档中的向量</span><br><span style="color: #e6c07b;line-height: 26px;"><span leaf="">float</span></span><span leaf="">&nbsp;vm = doc[</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'my_vector'</span></span><span leaf="">].magnitude; &nbsp; &nbsp;// 获取文档向量的模</span><br><span style="color: #e6c07b;line-height: 26px;"><span leaf="">float</span></span><span leaf="">&nbsp;dotProduct = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 初始化点积</span><br><span style="color: #c678dd;line-height: 26px;"><span leaf="">for</span></span><span leaf="">&nbsp;(int i = 0; i &lt; v.length; i++) { &nbsp; &nbsp; &nbsp;// 遍历向量维度</span><br><span leaf="">&nbsp; dotProduct += v[i] * params.queryVector[i]; // 计算点积</span><br><span leaf="">}</span><br><span style="color: #e6c07b;line-height: 26px;"><span leaf="">return</span></span><span leaf="">&nbsp;dotProduct / (vm * (</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">float</span></span><span leaf="">) params.queryVectorMag); // 返回余弦相似度</span><br></code></pre> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">POST /test2/_search</span></code><span leaf="">:在索引&nbsp;</span><code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">test2</span></code><span leaf="">&nbsp;中执行搜索。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">query</span></code><span leaf="">:定义查询逻辑。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">script_score</span></code><span leaf="">:使用自定义脚本对文档评分。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">match_all</span></code><span leaf="">:匹配所有文档。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">script</span></code><span leaf="">:定义评分脚本。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">params</span></code><span leaf="">:传递给脚本的参数,包括查询向量&nbsp;</span><code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">queryVector</span></code><span leaf="">&nbsp;和它的模&nbsp;</span><code style="color: rgb(239, 112, 96);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">queryVectorMag</span></code><span leaf="">。</span> </section></li> </ul> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">向量化作为一种将高维、离散数据转换为低维、连续向量的技术,已经成为现代数据科学和机器学习领域的核心工具之一。通过将文本、图像、类别等复杂数据转化为数值向量,我们不仅能够更高效地处理和分析这些数据,还能捕捉到数据之间的深层次关系和语义信息。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">例如我们公司就是在将文本转存为向量化存储到ES中,从而加入更好的算法,例如RAG Reranker重排,确保能检索到最相关的内容。</span></p> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100003053" src="/upload/6d2bf898680e9adcbc2d0035642e6dcd.png" data-type="png" style="display: block;margin-top: 0px;margin-right: auto;margin-bottom: 0px;margin-left: auto;max-width: 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;"></span> </figure> </section> <section> <span leaf=""><br></span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

太给力了!刚刚开源的TTS模型,1:1零样本声音克隆,连呼吸节奏都能控制!

作者:微信小助手

<p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px;color: rgb(10, 10, 10);font-family: ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 0px;line-height: 0;><span leaf="">&nbsp;</span></p> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.5em;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">在 TTS(文本转语音)技术的快速发展下,如何生成更加自然、可控、个性化的 AI 语音,成为了语音合成领域的核心挑战。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">传统的 TTS 系统虽然能生成高质量语音,但往往存在 控制能力有限、跨语言表现较差、声音风格固定 等问题。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">Spark-TTS</span></strong><span leaf="">&nbsp;作为一款刚刚开源的高质量语音合成(TTS)系统。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">不仅支持零样本语音克隆,还能进行细粒度语音控制,包括语速、音调、语气等多项参数调节,同时具备跨语言生成能力,让 AI 语音变得更加灵活、多样化。</span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100017917" data-ratio="0.5845238095238096" data-s="300,640" src="/upload/cd8dc9ba58ed52044c935ce80de9798b.png" data-type="png" data-w="1680" type="block"> </section> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 15px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(66, 166, 101);><span leaf="">核心能力</span></h4> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">•&nbsp;</span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">零样本语音克隆</span></strong><span leaf="">:只需提供几秒钟的语音样本,便能克隆目标说话人的声音</span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">•&nbsp;</span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">细粒度语音控制</span></strong><span leaf="">:粗粒度控制(性别、说话风格等);细粒度调整(音高、语速等)</span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">•&nbsp;</span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">跨语言语音生成</span></strong><span leaf="">:支持跨语言语音合成,支持中文和英文,并保持自然度和准确性</span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">•&nbsp;</span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">高质量自然语音</span></strong><span leaf="">:结合 Qwen-2.5 思维链技术,增强语音表达逻辑,自动调整语气、停顿、强调等语音表达</span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">•&nbsp;</span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">音质 &amp; 语音控制能力</span></strong><span leaf="">:采用 BiCodec 单流语音编解码器,将语音分解为语义信息和说话人属性</span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">•&nbsp;</span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">Web界面支持</span></strong><span leaf="">: 提供了使用 Web UI 进行语音克隆和语音创建的界面</span> </section></li> </ul> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">Spark-TTS 兼具高音质、可控性、跨语言能力,并且 完全开源,是当前最灵活的开源 TTS 方案之一。</span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100017918" data-ratio="0.4128113879003559" data-s="300,640" src="/upload/a2fa2628b5b2bbd6a5e1d6693737f837.png" data-type="png" data-w="1686" type="block"> </section> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 15px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(66, 166, 101);><span leaf="">安装部署</span></h4> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">克隆项目</span></p> <pre style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;margin: 10px 8px;background: rgb(39, 40, 34);color: rgb(221, 221, 221);text-align: left;line-height: 1.5;overflow-x: auto;border-radius: 8px;padding: 0px !important;><span hidden style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: flex;padding: 10px 14px 0px;"> <svg viewbox="0 0 450 130" height="13px" width="45px" y="0px" x="0px" version="1.1" xmlns="http://www.w3.org/2000/svg"> <ellipse fill="rgb(237,108,96)" stroke-width="2" stroke="rgb(220,60,54)" ry="52" rx="50" cy="65" cx="50"></ellipse><ellipse fill="rgb(247,193,81)" stroke-width="2" stroke="rgb(218,151,33)" ry="52" rx="50" cy="65" cx="225"></ellipse><ellipse fill="rgb(100,200,86)" stroke-width="2" stroke="rgb(27,161,37)" ry="52" rx="50" cy="65" cx="400"></ellipse> </svg></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: Menlo, " operator mono, consolas, monaco, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 15px;display: -webkit-box;padding: 0.5em 1em 1em;overflow-x: auto;text-indent: 0px;text-align: left;line-height: 1.75;margin: 0px;white-space: nowrap;><span leaf="">git&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">clone</span></span><span leaf="">&nbsp;https://github.com/SparkAudio/Spark-TTS.git</span><span leaf=""><br></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">cd</span></span><span leaf="">&nbsp;Spark-TTS</span></code></pre> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">创建Python虚拟环境,安装Python依赖</span></p> <pre style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;margin: 10px 8px;background: rgb(39, 40, 34);color: rgb(221, 221, 221);text-align: left;line-height: 1.5;overflow-x: auto;border-radius: 8px;padding: 0px !important;><span hidden style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: flex;padding: 10px 14px 0px;"> <svg viewbox="0 0 450 130" height="13px" width="45px" y="0px" x="0px" version="1.1" xmlns="http://www.w3.org/2000/svg"> <ellipse fill="rgb(237,108,96)" stroke-width="2" stroke="rgb(220,60,54)" ry="52" rx="50" cy="65" cx="50"></ellipse><ellipse fill="rgb(247,193,81)" stroke-width="2" stroke="rgb(218,151,33)" ry="52" rx="50" cy="65" cx="225"></ellipse><ellipse fill="rgb(100,200,86)" stroke-width="2" stroke="rgb(27,161,37)" ry="52" rx="50" cy="65" cx="400"></ellipse> </svg></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: Menlo, " operator mono, consolas, monaco, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 15px;display: -webkit-box;padding: 0.5em 1em 1em;overflow-x: auto;text-indent: 0px;text-align: left;line-height: 1.75;margin: 0px;white-space: nowrap;><span leaf="">conda create -n sparktts -y python=3.12</span><span leaf=""><br></span><span leaf="">conda activate sparktts</span><span leaf=""><br></span><span leaf="">pip install -r requirements.txt</span><span leaf=""><br></span></code></pre> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">模型下载(两种方式):</span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">• 通过Python代码下载</span> </section></li> </ul> <pre style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;margin: 10px 8px;background: rgb(39, 40, 34);color: rgb(221, 221, 221);text-align: left;line-height: 1.5;overflow-x: auto;border-radius: 8px;padding: 0px !important;><span hidden style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: flex;padding: 10px 14px 0px;"> <svg viewbox="0 0 450 130" height="13px" width="45px" y="0px" x="0px" version="1.1" xmlns="http://www.w3.org/2000/svg"> <ellipse fill="rgb(237,108,96)" stroke-width="2" stroke="rgb(220,60,54)" ry="52" rx="50" cy="65" cx="50"></ellipse><ellipse fill="rgb(247,193,81)" stroke-width="2" stroke="rgb(218,151,33)" ry="52" rx="50" cy="65" cx="225"></ellipse><ellipse fill="rgb(100,200,86)" stroke-width="2" stroke="rgb(27,161,37)" ry="52" rx="50" cy="65" cx="400"></ellipse> </svg></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: Menlo, " operator mono, consolas, monaco, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 15px;display: -webkit-box;padding: 0.5em 1em 1em;overflow-x: auto;text-indent: 0px;text-align: left;line-height: 1.75;margin: 0px;white-space: nowrap;><span leaf="">from huggingface_hub import snapshot_download</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">snapshot_download(</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">"SparkAudio/Spark-TTS-0.5B"</span></span><span leaf="">, local_dir=</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">"pretrained_models/Spark-TTS-0.5B"</span></span><span leaf="">)</span></code></pre> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">• 通过 git 下载</span> </section></li> </ul> <pre style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;margin: 10px 8px;background: rgb(39, 40, 34);color: rgb(221, 221, 221);text-align: left;line-height: 1.5;overflow-x: auto;border-radius: 8px;padding: 0px !important;><span hidden style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: flex;padding: 10px 14px 0px;"> <svg viewbox="0 0 450 130" height="13px" width="45px" y="0px" x="0px" version="1.1" xmlns="http://www.w3.org/2000/svg"> <ellipse fill="rgb(237,108,96)" stroke-width="2" stroke="rgb(220,60,54)" ry="52" rx="50" cy="65" cx="50"></ellipse><ellipse fill="rgb(247,193,81)" stroke-width="2" stroke="rgb(218,151,33)" ry="52" rx="50" cy="65" cx="225"></ellipse><ellipse fill="rgb(100,200,86)" stroke-width="2" stroke="rgb(27,161,37)" ry="52" rx="50" cy="65" cx="400"></ellipse> </svg></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: Menlo, " operator mono, consolas, monaco, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 15px;display: -webkit-box;padding: 0.5em 1em 1em;overflow-x: auto;text-indent: 0px;text-align: left;line-height: 1.75;margin: 0px;white-space: nowrap;><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">mkdir</span></span><span leaf="">&nbsp;-p pretrained_models</span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(117, 113, 94);"><span leaf=""># Make sure you have git-lfs installed (https://git-lfs.com)</span></span><span leaf=""><br></span><span leaf="">git lfs install</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">git&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">clone</span></span><span leaf="">&nbsp;https://huggingface.co/SparkAudio/Spark-TTS-0.5B pretrained_models/Spark-TTS-0.5B</span></code></pre> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">运行演示:</span></p> <pre style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;margin: 10px 8px;background: rgb(39, 40, 34);color: rgb(221, 221, 221);text-align: left;line-height: 1.5;overflow-x: auto;border-radius: 8px;padding: 0px !important;><span hidden style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: flex;padding: 10px 14px 0px;"> <svg viewbox="0 0 450 130" height="13px" width="45px" y="0px" x="0px" version="1.1" xmlns="http://www.w3.org/2000/svg"> <ellipse fill="rgb(237,108,96)" stroke-width="2" stroke="rgb(220,60,54)" ry="52" rx="50" cy="65" cx="50"></ellipse><ellipse fill="rgb(247,193,81)" stroke-width="2" stroke="rgb(218,151,33)" ry="52" rx="50" cy="65" cx="225"></ellipse><ellipse fill="rgb(100,200,86)" stroke-width="2" stroke="rgb(27,161,37)" ry="52" rx="50" cy="65" cx="400"></ellipse> </svg></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: Menlo, " operator mono, consolas, monaco, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 15px;display: -webkit-box;padding: 0.5em 1em 1em;overflow-x: auto;text-indent: 0px;text-align: left;line-height: 1.75;margin: 0px;white-space: nowrap;><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">cd</span></span><span leaf="">&nbsp;example</span><span leaf=""><br></span><span leaf="">bash infer.sh</span></code></pre> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">或者直接在命令行中进行推理:</span></p> <pre style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;margin: 10px 8px;background: rgb(39, 40, 34);color: rgb(221, 221, 221);text-align: left;line-height: 1.5;overflow-x: auto;border-radius: 8px;padding: 0px !important;><span hidden style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: flex;padding: 10px 14px 0px;"> <svg viewbox="0 0 450 130" height="13px" width="45px" y="0px" x="0px" version="1.1" xmlns="http://www.w3.org/2000/svg"> <ellipse fill="rgb(237,108,96)" stroke-width="2" stroke="rgb(220,60,54)" ry="52" rx="50" cy="65" cx="50"></ellipse><ellipse fill="rgb(247,193,81)" stroke-width="2" stroke="rgb(218,151,33)" ry="52" rx="50" cy="65" cx="225"></ellipse><ellipse fill="rgb(100,200,86)" stroke-width="2" stroke="rgb(27,161,37)" ry="52" rx="50" cy="65" cx="400"></ellipse> </svg></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: Menlo, " operator mono, consolas, monaco, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 15px;display: -webkit-box;padding: 0.5em 1em 1em;overflow-x: auto;text-indent: 0px;text-align: left;line-height: 1.75;margin: 0px;white-space: nowrap;><span leaf="">python -m cli.inference \</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; --text&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">"text to synthesis."</span></span><span leaf="">&nbsp;\</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; --device 0 \</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; --save_dir&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">"path/to/save/audio"</span></span><span leaf="">&nbsp;\</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; --model_dir pretrained_models/Spark-TTS-0.5B \</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; --prompt_text&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">"transcript of the prompt audio"</span></span><span leaf="">&nbsp;\</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; --prompt_speech_path&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(166, 226, 46);"><span leaf="">"path/to/prompt_audio"</span></span></code></pre> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">如果使用Web界面,可以使用以下命令启用:</span></p> <pre style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;margin: 10px 8px;background: rgb(39, 40, 34);color: rgb(221, 221, 221);text-align: left;line-height: 1.5;overflow-x: auto;border-radius: 8px;padding: 0px !important;><span hidden style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: flex;padding: 10px 14px 0px;"> <svg viewbox="0 0 450 130" height="13px" width="45px" y="0px" x="0px" version="1.1" xmlns="http://www.w3.org/2000/svg"> <ellipse fill="rgb(237,108,96)" stroke-width="2" stroke="rgb(220,60,54)" ry="52" rx="50" cy="65" cx="50"></ellipse><ellipse fill="rgb(247,193,81)" stroke-width="2" stroke="rgb(218,151,33)" ry="52" rx="50" cy="65" cx="225"></ellipse><ellipse fill="rgb(100,200,86)" stroke-width="2" stroke="rgb(27,161,37)" ry="52" rx="50" cy="65" cx="400"></ellipse> </svg></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: Menlo, " operator mono, consolas, monaco, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 15px;display: -webkit-box;padding: 0.5em 1em 1em;overflow-x: auto;text-indent: 0px;text-align: left;line-height: 1.75;margin: 0px;white-space: nowrap;><span leaf="">python webui.py --device 0</span></code></pre> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">可以直接通过界面执行语音克隆和语音创建。支持上传参考音频或直接录制音频。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><img alt="Image 1" class="rich_pages wxw-img" data-imgfileid="100017919" data-ratio="0.6666666666666666" src="/upload/a6251ca6e8020c5e42376b34e119b908.png" data-type="png" data-w="1863"><img alt="Image 2" class="rich_pages wxw-img" data-imgfileid="100017920" data-ratio="0.6663107314468767" src="/upload/5e616855153b894209011f7863deb04f.png" data-type="png" data-w="1873"></span></p> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 15px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(66, 166, 101);><span leaf="">语音演示</span></h4> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">后裔:</span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="后裔TTS配音" author="开源星探" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E5%90%8E%E8%A3%94TTS%E9%85%8D%E9%9F%B3&amp;play_length=6%E7%A7%92" isaac2="1" low_size="12.66" source_size="12.7" high_size="19.98" play_length="6000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzkwMjQ0NzI0OV8yMjQ3NTAxNTg3" cover="http://mmbiz.qpic.cn/mmbiz_jpg/NjA8gwicXyeLJoEPibicYTMbdDOxicCL7fJgINsPzcux1q7NJg5VsFe5tdTRJ88D7PNG4GNacrKFDicTcXEJN6garLQ/0?wx_fmt=jpeg"></mp-common-mpaudio> </section> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">周杰伦:</span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="jay_zh" author="开源星探" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=jay_zh&amp;play_length=10%E7%A7%92" isaac2="1" low_size="21.01" source_size="21" high_size="31.47" play_length="10000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzkwMjQ0NzI0OV8yMjQ3NTAxNTg2" cover="http://mmbiz.qpic.cn/mmbiz_jpg/NjA8gwicXyeLJoEPibicYTMbdDOxicCL7fJgINsPzcux1q7NJg5VsFe5tdTRJ88D7PNG4GNacrKFDicTcXEJN6garLQ/0?wx_fmt=jpeg"></mp-common-mpaudio> </section> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">徐志胜:</span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="zhisheng_zh" author="开源星探" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=zhisheng_zh&amp;play_length=11%E7%A7%92" isaac2="1" low_size="22.87" source_size="22.9" high_size="34.11" play_length="11000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzkwMjQ0NzI0OV8yMjQ3NTAxNTg1" cover="http://mmbiz.qpic.cn/mmbiz_jpg/NjA8gwicXyeLJoEPibicYTMbdDOxicCL7fJgINsPzcux1q7NJg5VsFe5tdTRJ88D7PNG4GNacrKFDicTcXEJN6garLQ/0?wx_fmt=jpeg"></mp-common-mpaudio> </section> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">哪吒:</span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="哪吒TTS配音" author="开源星探" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E5%93%AA%E5%90%92TTS%E9%85%8D%E9%9F%B3&amp;play_length=18%E7%A7%92" isaac2="1" low_size="34.92" source_size="34.9" high_size="54.89" play_length="18000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzkwMjQ0NzI0OV8yMjQ3NTAxNTg4" cover="http://mmbiz.qpic.cn/mmbiz_jpg/NjA8gwicXyeLJoEPibicYTMbdDOxicCL7fJgINsPzcux1q7NJg5VsFe5tdTRJ88D7PNG4GNacrKFDicTcXEJN6garLQ/0?wx_fmt=jpeg"></mp-common-mpaudio> </section> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">殷夫人:</span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="殷夫人TTS配音" author="开源星探" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E6%AE%B7%E5%A4%AB%E4%BA%BATTS%E9%85%8D%E9%9F%B3&amp;play_length=15%E7%A7%92" isaac2="1" low_size="29.34" source_size="29.3" high_size="46.98" play_length="15000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzkwMjQ0NzI0OV8yMjQ3NTAxNTg5" cover="http://mmbiz.qpic.cn/mmbiz_jpg/NjA8gwicXyeLJoEPibicYTMbdDOxicCL7fJgINsPzcux1q7NJg5VsFe5tdTRJ88D7PNG4GNacrKFDicTcXEJN6garLQ/0?wx_fmt=jpeg"></mp-common-mpaudio> </section> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 15px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(66, 166, 101);><span leaf="">应用场景</span></h4> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">由于其自然的声音效果和强大的控制能力,Spark-TTS 非常适合以下用途:</span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">•&nbsp;</span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">有声读物</span></strong><span leaf="">:通过调整语速、音高和风格,生成富有表现力的朗读语音,提升听众体验。</span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">•&nbsp;</span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">多语言内容</span></strong><span leaf="">:支持中英文跨语言生成,适用于国际化应用。</span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">•&nbsp;</span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">AI 角色配音</span></strong><span leaf="">:利用零样本克隆技术,快速生成特定说话者的声音,用于虚拟角色或定制化服务。</span> </section></li> </ul> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 15px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(66, 166, 101);><span leaf="">写在最后</span></h4> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(66, 166, 101);><span leaf="">Spark-TTS</span></strong><span leaf="">&nbsp;是一款创新的 TTS 模型,凭借 BiCodec 编解码器和 Qwen-2.5 思维链技术,实现了高质量、可控的语音生成。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">它支持零样本语音克隆、细粒度语音调整和跨语言合成,效果自然且高效,非常适合有声读物、AI配音等应用场景。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">GitHub 项目地址:</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;color: rgb(87, 107, 149);><span leaf="">https://github.com/SparkAudio/Spark-TTS</span></span></p> </section>

阿里巴巴通义实验室发布语音合成新标杆CosyVoice2-0.5B

作者:微信小助手

<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 10px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;font-family: Optima, 'Microsoft YaHei', PingFangSC-regular, serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;overflow-wrap: break-word;text-align: left;"> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 100% 100%;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;height: 35px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: -20px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 35px;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn mmbiz_png q8dliaibuqya8wfhdtw5t4m1ectczzrrxhibnjt4mcq2kcvo0pfcx5umoolkxz7edhwpwl3obhjk5wib9oprfukbog 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"></span><span style="font-size: 18px;color: rgb(130, 127, 196);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: center;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><strong style="align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf=""><img alt="SVG Banners" class="rich_pages wxw-img" data-imgfileid="100000508" data-ratio="0.2625" src="/upload/02e9b5580339f3477cdb4eb2c525a910.png" data-type="svg" data-w="800"></span></strong></span></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100000512" data-ratio="0.38796296296296295" data-s="300,640" src="/upload/922c50c2de6b35597ddc4e67f45da2ac.png" data-type="png" data-w="1080" type="block"> </section> <section> <span leaf=""><br></span> </section> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="font-size: 18px;color: rgb(130, 127, 196);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: center;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><strong style="align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf=""><br></span></strong></span></h2> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="font-size: 18px;color: rgb(130, 127, 196);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: center;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><strong style="align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">150ms超低延迟 + 跨语言情感控制,重新定义人机交互</span></strong></span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="font-size: 20px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">一、语音合成的技术革命:从机械发声到情感共鸣</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">传统语音合成技术长期面临三大瓶颈:</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">高延迟</span></strong><span leaf="">(&gt;500ms)、</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">情感单一</span></strong><span leaf="">(“机器人腔调”)、</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">多语言适配难</span></strong><span leaf="">(需独立训练不同语种模型)。而阿里巴巴通义实验室最新开源的CosyVoice2-0.5B,通过三大技术突破彻底打破桎梏:</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">1.&nbsp;</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">超低延迟流式生成</span></strong><span leaf="">:首包响应仅需150ms,比人类眨眼速度快3倍</span></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">技术原理</span></strong><span leaf=""><br></span><span leaf="">采用</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">块感知因果流匹配技术(Chunk-Aware Causal Flow Matching, CA-CFM)</span></strong><span leaf="">,结合自回归与非自回归生成优势:</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">前馈编码器</span></strong><span leaf="">:以文本块(chunk)为单位预计算语义特征,避免逐字处理的冗余计算。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">因果解码器</span></strong><span leaf="">:基于Flow Matching理论建模声学特征的连续概率流,通过隐式微分方程实现声学参数的平滑过渡,消除传统流式生成的断句生硬问题。</span> </section></li> </ul> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 8h9qxaj70ibdkkzptsjic4c9j3bc3rscf5vebfqqbewbyxweua40icsqrb8l1byanyn2mfoeovxkr8rxsxbx4nbllqzemqqucvf 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 流式语音生成核心逻辑(简化版)</span></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">class</span></span><span leaf="">&nbsp;</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">ChunkFlowMatching</span></span><span style="line-height: 26px;"><span leaf="">(nn.Module)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">__init__</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.encoder = ChunkTransformer() &nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 块级语义编码器</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; self.flow = NeuralODE() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 基于神经常微分方程的流匹配</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">forward</span></span><span style="line-height: 26px;"><span leaf="">(self, text_chunk)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; semantic = self.encoder(text_chunk) &nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; acoustic_flow = self.flow(semantic) &nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 生成连续声学流</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf="">&nbsp;acoustic_flow.sample()</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">性能对比</span></strong></p> <section data-tool="mdnice编辑器" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;overflow-x: auto;"> <table style="display: table;text-align: left;"> <thead> <tr> <th style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf="">模型</span> </section></th> <th style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf="">首包延迟 (ms)</span> </section></th> <th style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf="">语音自然度 (MOS)</span> </section></th> </tr> </thead> <tbody> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(255, 255, 255);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">Tacotron2</span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">520</span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">3.8</span> </section></td> </tr> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 248, 248);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">VITS-Stream</span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">220</span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">4.1</span> </section></td> </tr> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(255, 255, 255);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">CosyVoice2</span></strong></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">150</span></strong></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">4.6</span></strong></td> </tr> </tbody> </table> </section> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">2.&nbsp;</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">零样本音色克隆</span></strong><span leaf="">:3秒音频复刻任意人声</span></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">创新架构</span></strong><span leaf=""><br></span><span leaf="">基于对比学习与解耦表示:</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">多尺度声纹编码器</span></strong><span leaf="">:采用CNN+Transformer混合结构,从时域(基频、共振峰)和频域(MFCC、梅尔谱)多维度提取说话人特征。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">对抗式风格解耦</span></strong><span leaf="">:通过对抗训练分离音色特征(128维向量)与发音内容,确保克隆语音的发音清晰度。</span> </section></li> </ul> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">数学建模</span></strong><span leaf=""><br></span><span leaf="">声纹特征解耦损失函数:</span></p><span style="cursor:pointer;" data-tool="mdnice编辑器"> <section data-formula="\mathcal{L}_{adv} = \mathbb{E}[D(enc(x))] + \mathbb{E}[1-D(enc(permute(x)))] " style="text-align: center;overflow-x: auto;overflow-y: auto;display: block;"> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -750 21934.1 1000" aria-hidden="true" style="vertical-align: -0.566ex;width: 49.625ex;height: 2.262ex;max-width: 300% !important;"> <g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"> <g data-mml-node="math"> <g data-mml-node="msub"> <g data-mml-node="TeXAtom" data-mjx-texclass="ORD"> <g data-mml-node="mi"> <path data-c="4C" d="M62 -22T47 -22T32 -11Q32 -1 56 24T83 55Q113 96 138 172T180 320T234 473T323 609Q364 649 419 677T531 705Q559 705 578 696T604 671T615 645T618 623V611Q618 582 615 571T598 548Q581 531 558 520T518 509Q503 509 503 520Q503 523 505 536T507 560Q507 590 494 610T452 630Q423 630 410 617Q367 578 333 492T271 301T233 170Q211 123 204 112L198 103L224 102Q281 102 369 79T509 52H523Q535 64 544 87T579 128Q616 152 641 152Q656 152 656 142Q656 101 588 40T433 -22Q381 -22 289 1T156 28L141 29L131 20Q111 0 87 -11Z"></path> </g> </g> <g data-mml-node="TeXAtom" transform="translate(690, -150) scale(0.707)" data-mjx-texclass="ORD"> <g data-mml-node="mi"> <path data-c="61" d="M33 157Q33 258 109 349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 254 59T298 110Q300 114 325 217T351 328Z"></path> </g> <g data-mml-node="mi" transform="translate(529, 0)"> <path data-c="64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path> </g> <g data-mml-node="mi" transform="translate(1049, 0)"> <path data-c="76" d="M173 380Q173 405 154 405Q130 405 104 376T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Q21 294 29 316T53 368T97 419T160 441Q202 441 225 417T249 361Q249 344 246 335Q246 329 231 291T200 202T182 113Q182 86 187 69Q200 26 250 26Q287 26 319 60T369 139T398 222T409 277Q409 300 401 317T383 343T365 361T357 383Q357 405 376 424T417 443Q436 443 451 425T467 367Q467 340 455 284T418 159T347 40T241 -11Q177 -11 139 22Q102 54 102 117Q102 148 110 181T151 298Q173 362 173 380Z"></path> </g> </g> </g> <g data-mml-node="mo" transform="translate(2102.5, 0)"> <path data-c="3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path> </g> <g data-mml-node="TeXAtom" data-mjx-texclass="ORD" transform="translate(3158.3, 0)"> <g data-mml-node="mi"> <path data-c="45" d="M12 666Q12 675 24 683H582Q590 680 593 672V588Q593 514 591 502T575 490Q567 490 563 495T555 517Q552 556 517 590Q486 623 445 634T340 648H282Q266 636 264 620T260 492V370H277Q329 375 358 391T404 439Q420 480 420 506Q420 529 436 529Q445 529 451 521Q455 517 455 361Q455 333 455 298T456 253Q456 217 453 207T437 197Q420 196 420 217Q420 240 406 270Q377 328 284 335H260V201Q261 174 261 134Q262 73 264 61T278 38Q281 36 282 35H331Q400 35 449 50Q571 93 602 179Q605 203 622 203Q629 203 634 197T640 183Q638 181 624 95T604 3L600 -1H24Q12 5 12 16Q12 35 51 35Q92 38 97 52Q102 60 102 341T97 632Q91 645 51 648Q12 648 12 666ZM137 341Q137 131 136 89T130 37Q129 36 129 35H235Q233 41 231 48L226 61V623L231 635L235 648H129Q132 641 133 638T135 603T137 517T137 341ZM557 603V648H504Q504 646 515 639Q527 634 542 619L557 603ZM420 317V397L406 383Q394 370 380 363L366 355Q373 350 382 346Q400 333 409 328L420 317ZM582 61L586 88Q585 88 582 83Q557 61 526 46L511 37L542 35H577Q577 36 578 39T580 49T582 61Z"></path> </g> </g> <g data-mml-node="mo" transform="translate(3825.3, 0)"> <path data-c="5B" d="M118 -250V750H255V710H158V-210H255V-250H118Z"></path> </g> <g data-mml-node="mi" transform="translate(4103.3, 0)"> <path data-c="44" d="M287 628Q287 635 230 637Q207 637 200 638T193 647Q193 655 197 667T204 682Q206 683 403 683Q570 682 590 682T630 676Q702 659 752 597T803 431Q803 275 696 151T444 3L430 1L236 0H125H72Q48 0 41 2T33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM703 469Q703 507 692 537T666 584T629 613T590 629T555 636Q553 636 541 636T512 636T479 637H436Q392 637 386 627Q384 623 313 339T242 52Q242 48 253 48T330 47Q335 47 349 47T373 46Q499 46 581 128Q617 164 640 212T683 339T703 469Z"></path> </g> <g data-mml-node="mo" transform="translate(4931.3, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mi" transform="translate(5320.3, 0)"> <path data-c="65" d="M39 168Q39 225 58 272T107 350T174 402T244 433T307 442H310Q355 442 388 420T421 355Q421 265 310 237Q261 224 176 223Q139 223 138 221Q138 219 132 186T125 128Q125 81 146 54T209 26T302 45T394 111Q403 121 406 121Q410 121 419 112T429 98T420 82T390 55T344 24T281 -1T205 -11Q126 -11 83 42T39 168ZM373 353Q367 405 305 405Q272 405 244 391T199 357T170 316T154 280T149 261Q149 260 169 260Q282 260 327 284T373 353Z"></path> </g> <g data-mml-node="mi" transform="translate(5786.3, 0)"> <path data-c="6E" d="M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"></path> </g> <g data-mml-node="mi" transform="translate(6386.3, 0)"> <path data-c="63" d="M34 159Q34 268 120 355T306 442Q362 442 394 418T427 355Q427 326 408 306T360 285Q341 285 330 295T319 325T330 359T352 380T366 386H367Q367 388 361 392T340 400T306 404Q276 404 249 390Q228 381 206 359Q162 315 142 235T121 119Q121 73 147 50Q169 26 205 26H209Q321 26 394 111Q403 121 406 121Q410 121 419 112T429 98T420 83T391 55T346 25T282 0T202 -11Q127 -11 81 37T34 159Z"></path> </g> <g data-mml-node="mo" transform="translate(6819.3, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mi" transform="translate(7208.3, 0)"> <path data-c="78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path> </g> <g data-mml-node="mo" transform="translate(7780.3, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> <g data-mml-node="mo" transform="translate(8169.3, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> <g data-mml-node="mo" transform="translate(8558.3, 0)"> <path data-c="5D" d="M22 710V750H159V-250H22V-210H119V710H22Z"></path> </g> <g data-mml-node="mo" transform="translate(9058.5, 0)"> <path data-c="2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path> </g> <g data-mml-node="TeXAtom" data-mjx-texclass="ORD" transform="translate(10058.7, 0)"> <g data-mml-node="mi"> <path data-c="45" d="M12 666Q12 675 24 683H582Q590 680 593 672V588Q593 514 591 502T575 490Q567 490 563 495T555 517Q552 556 517 590Q486 623 445 634T340 648H282Q266 636 264 620T260 492V370H277Q329 375 358 391T404 439Q420 480 420 506Q420 529 436 529Q445 529 451 521Q455 517 455 361Q455 333 455 298T456 253Q456 217 453 207T437 197Q420 196 420 217Q420 240 406 270Q377 328 284 335H260V201Q261 174 261 134Q262 73 264 61T278 38Q281 36 282 35H331Q400 35 449 50Q571 93 602 179Q605 203 622 203Q629 203 634 197T640 183Q638 181 624 95T604 3L600 -1H24Q12 5 12 16Q12 35 51 35Q92 38 97 52Q102 60 102 341T97 632Q91 645 51 648Q12 648 12 666ZM137 341Q137 131 136 89T130 37Q129 36 129 35H235Q233 41 231 48L226 61V623L231 635L235 648H129Q132 641 133 638T135 603T137 517T137 341ZM557 603V648H504Q504 646 515 639Q527 634 542 619L557 603ZM420 317V397L406 383Q394 370 380 363L366 355Q373 350 382 346Q400 333 409 328L420 317ZM582 61L586 88Q585 88 582 83Q557 61 526 46L511 37L542 35H577Q577 36 578 39T580 49T582 61Z"></path> </g> </g> <g data-mml-node="mo" transform="translate(10725.7, 0)"> <path data-c="5B" d="M118 -250V750H255V710H158V-210H255V-250H118Z"></path> </g> <g data-mml-node="mn" transform="translate(11003.7, 0)"> <path data-c="31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path> </g> <g data-mml-node="mo" transform="translate(11725.9, 0)"> <path data-c="2212" d="M84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250Z"></path> </g> <g data-mml-node="mi" transform="translate(12726.1, 0)"> <path data-c="44" d="M287 628Q287 635 230 637Q207 637 200 638T193 647Q193 655 197 667T204 682Q206 683 403 683Q570 682 590 682T630 676Q702 659 752 597T803 431Q803 275 696 151T444 3L430 1L236 0H125H72Q48 0 41 2T33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM703 469Q703 507 692 537T666 584T629 613T590 629T555 636Q553 636 541 636T512 636T479 637H436Q392 637 386 627Q384 623 313 339T242 52Q242 48 253 48T330 47Q335 47 349 47T373 46Q499 46 581 128Q617 164 640 212T683 339T703 469Z"></path> </g> <g data-mml-node="mo" transform="translate(13554.1, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mi" transform="translate(13943.1, 0)"> <path data-c="65" d="M39 168Q39 225 58 272T107 350T174 402T244 433T307 442H310Q355 442 388 420T421 355Q421 265 310 237Q261 224 176 223Q139 223 138 221Q138 219 132 186T125 128Q125 81 146 54T209 26T302 45T394 111Q403 121 406 121Q410 121 419 112T429 98T420 82T390 55T344 24T281 -1T205 -11Q126 -11 83 42T39 168ZM373 353Q367 405 305 405Q272 405 244 391T199 357T170 316T154 280T149 261Q149 260 169 260Q282 260 327 284T373 353Z"></path> </g> <g data-mml-node="mi" transform="translate(14409.1, 0)"> <path data-c="6E" d="M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"></path> </g> <g data-mml-node="mi" transform="translate(15009.1, 0)"> <path data-c="63" d="M34 159Q34 268 120 355T306 442Q362 442 394 418T427 355Q427 326 408 306T360 285Q341 285 330 295T319 325T330 359T352 380T366 386H367Q367 388 361 392T340 400T306 404Q276 404 249 390Q228 381 206 359Q162 315 142 235T121 119Q121 73 147 50Q169 26 205 26H209Q321 26 394 111Q403 121 406 121Q410 121 419 112T429 98T420 83T391 55T346 25T282 0T202 -11Q127 -11 81 37T34 159Z"></path> </g> <g data-mml-node="mo" transform="translate(15442.1, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mi" transform="translate(15831.1, 0)"> <path data-c="70" d="M23 287Q24 290 25 295T30 317T40 348T55 381T75 411T101 433T134 442Q209 442 230 378L240 387Q302 442 358 442Q423 442 460 395T497 281Q497 173 421 82T249 -10Q227 -10 210 -4Q199 1 187 11T168 28L161 36Q160 35 139 -51T118 -138Q118 -144 126 -145T163 -148H188Q194 -155 194 -157T191 -175Q188 -187 185 -190T172 -194Q170 -194 161 -194T127 -193T65 -192Q-5 -192 -24 -194H-32Q-39 -187 -39 -183Q-37 -156 -26 -148H-6Q28 -147 33 -136Q36 -130 94 103T155 350Q156 355 156 364Q156 405 131 405Q109 405 94 377T71 316T59 280Q57 278 43 278H29Q23 284 23 287ZM178 102Q200 26 252 26Q282 26 310 49T356 107Q374 141 392 215T411 325V331Q411 405 350 405Q339 405 328 402T306 393T286 380T269 365T254 350T243 336T235 326L232 322Q232 321 229 308T218 264T204 212Q178 106 178 102Z"></path> </g> <g data-mml-node="mi" transform="translate(16334.1, 0)"> <path data-c="65" d="M39 168Q39 225 58 272T107 350T174 402T244 433T307 442H310Q355 442 388 420T421 355Q421 265 310 237Q261 224 176 223Q139 223 138 221Q138 219 132 186T125 128Q125 81 146 54T209 26T302 45T394 111Q403 121 406 121Q410 121 419 112T429 98T420 82T390 55T344 24T281 -1T205 -11Q126 -11 83 42T39 168ZM373 353Q367 405 305 405Q272 405 244 391T199 357T170 316T154 280T149 261Q149 260 169 260Q282 260 327 284T373 353Z"></path> </g> <g data-mml-node="mi" transform="translate(16800.1, 0)"> <path data-c="72" d="M21 287Q22 290 23 295T28 317T38 348T53 381T73 411T99 433T132 442Q161 442 183 430T214 408T225 388Q227 382 228 382T236 389Q284 441 347 441H350Q398 441 422 400Q430 381 430 363Q430 333 417 315T391 292T366 288Q346 288 334 299T322 328Q322 376 378 392Q356 405 342 405Q286 405 239 331Q229 315 224 298T190 165Q156 25 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 114 189T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287Z"></path> </g> <g data-mml-node="mi" transform="translate(17251.1, 0)"> <path data-c="6D" d="M21 287Q22 293 24 303T36 341T56 388T88 425T132 442T175 435T205 417T221 395T229 376L231 369Q231 367 232 367L243 378Q303 442 384 442Q401 442 415 440T441 433T460 423T475 411T485 398T493 385T497 373T500 364T502 357L510 367Q573 442 659 442Q713 442 746 415T780 336Q780 285 742 178T704 50Q705 36 709 31T724 26Q752 26 776 56T815 138Q818 149 821 151T837 153Q857 153 857 145Q857 144 853 130Q845 101 831 73T785 17T716 -10Q669 -10 648 17T627 73Q627 92 663 193T700 345Q700 404 656 404H651Q565 404 506 303L499 291L466 157Q433 26 428 16Q415 -11 385 -11Q372 -11 364 -4T353 8T350 18Q350 29 384 161L420 307Q423 322 423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 181Q151 335 151 342Q154 357 154 369Q154 405 129 405Q107 405 92 377T69 316T57 280Q55 278 41 278H27Q21 284 21 287Z"></path> </g> <g data-mml-node="mi" transform="translate(18129.1, 0)"> <path data-c="75" d="M21 287Q21 295 30 318T55 370T99 420T158 442Q204 442 227 417T250 358Q250 340 216 246T182 105Q182 62 196 45T238 27T291 44T328 78L339 95Q341 99 377 247Q407 367 413 387T427 416Q444 431 463 431Q480 431 488 421T496 402L420 84Q419 79 419 68Q419 43 426 35T447 26Q469 29 482 57T512 145Q514 153 532 153Q551 153 551 144Q550 139 549 130T540 98T523 55T498 17T462 -8Q454 -10 438 -10Q372 -10 347 46Q345 45 336 36T318 21T296 6T267 -6T233 -11Q189 -11 155 7Q103 38 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"></path> </g> <g data-mml-node="mi" transform="translate(18701.1, 0)"> <path data-c="74" d="M26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26Z"></path> </g> <g data-mml-node="mi" transform="translate(19062.1, 0)"> <path data-c="65" d="M39 168Q39 225 58 272T107 350T174 402T244 433T307 442H310Q355 442 388 420T421 355Q421 265 310 237Q261 224 176 223Q139 223 138 221Q138 219 132 186T125 128Q125 81 146 54T209 26T302 45T394 111Q403 121 406 121Q410 121 419 112T429 98T420 82T390 55T344 24T281 -1T205 -11Q126 -11 83 42T39 168ZM373 353Q367 405 305 405Q272 405 244 391T199 357T170 316T154 280T149 261Q149 260 169 260Q282 260 327 284T373 353Z"></path> </g> <g data-mml-node="mo" transform="translate(19528.1, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mi" transform="translate(19917.1, 0)"> <path data-c="78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path> </g> <g data-mml-node="mo" transform="translate(20489.1, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> <g data-mml-node="mo" transform="translate(20878.1, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> <g data-mml-node="mo" transform="translate(21267.1, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> <g data-mml-node="mo" transform="translate(21656.1, 0)"> <path data-c="5D" d="M22 710V750H159V-250H22V-210H119V710H22Z"></path> </g> </g> </g><g></g> </svg> </section></span> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">其中,</span><span style="cursor:pointer;" data-formula="permute(x)"><span data-formula="permute(x)"> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -750 5047 1000" aria-hidden="true" style="vertical-align: -0.566ex;width: 11.419ex;height: 2.262ex;"> <g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"> <g data-mml-node="math"> <g data-mml-node="mi"> <path data-c="70" d="M23 287Q24 290 25 295T30 317T40 348T55 381T75 411T101 433T134 442Q209 442 230 378L240 387Q302 442 358 442Q423 442 460 395T497 281Q497 173 421 82T249 -10Q227 -10 210 -4Q199 1 187 11T168 28L161 36Q160 35 139 -51T118 -138Q118 -144 126 -145T163 -148H188Q194 -155 194 -157T191 -175Q188 -187 185 -190T172 -194Q170 -194 161 -194T127 -193T65 -192Q-5 -192 -24 -194H-32Q-39 -187 -39 -183Q-37 -156 -26 -148H-6Q28 -147 33 -136Q36 -130 94 103T155 350Q156 355 156 364Q156 405 131 405Q109 405 94 377T71 316T59 280Q57 278 43 278H29Q23 284 23 287ZM178 102Q200 26 252 26Q282 26 310 49T356 107Q374 141 392 215T411 325V331Q411 405 350 405Q339 405 328 402T306 393T286 380T269 365T254 350T243 336T235 326L232 322Q232 321 229 308T218 264T204 212Q178 106 178 102Z"></path> </g> <g data-mml-node="mi" transform="translate(503, 0)"> <path data-c="65" d="M39 168Q39 225 58 272T107 350T174 402T244 433T307 442H310Q355 442 388 420T421 355Q421 265 310 237Q261 224 176 223Q139 223 138 221Q138 219 132 186T125 128Q125 81 146 54T209 26T302 45T394 111Q403 121 406 121Q410 121 419 112T429 98T420 82T390 55T344 24T281 -1T205 -11Q126 -11 83 42T39 168ZM373 353Q367 405 305 405Q272 405 244 391T199 357T170 316T154 280T149 261Q149 260 169 260Q282 260 327 284T373 353Z"></path> </g> <g data-mml-node="mi" transform="translate(969, 0)"> <path data-c="72" d="M21 287Q22 290 23 295T28 317T38 348T53 381T73 411T99 433T132 442Q161 442 183 430T214 408T225 388Q227 382 228 382T236 389Q284 441 347 441H350Q398 441 422 400Q430 381 430 363Q430 333 417 315T391 292T366 288Q346 288 334 299T322 328Q322 376 378 392Q356 405 342 405Q286 405 239 331Q229 315 224 298T190 165Q156 25 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 114 189T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287Z"></path> </g> <g data-mml-node="mi" transform="translate(1420, 0)"> <path data-c="6D" d="M21 287Q22 293 24 303T36 341T56 388T88 425T132 442T175 435T205 417T221 395T229 376L231 369Q231 367 232 367L243 378Q303 442 384 442Q401 442 415 440T441 433T460 423T475 411T485 398T493 385T497 373T500 364T502 357L510 367Q573 442 659 442Q713 442 746 415T780 336Q780 285 742 178T704 50Q705 36 709 31T724 26Q752 26 776 56T815 138Q818 149 821 151T837 153Q857 153 857 145Q857 144 853 130Q845 101 831 73T785 17T716 -10Q669 -10 648 17T627 73Q627 92 663 193T700 345Q700 404 656 404H651Q565 404 506 303L499 291L466 157Q433 26 428 16Q415 -11 385 -11Q372 -11 364 -4T353 8T350 18Q350 29 384 161L420 307Q423 322 423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 181Q151 335 151 342Q154 357 154 369Q154 405 129 405Q107 405 92 377T69 316T57 280Q55 278 41 278H27Q21 284 21 287Z"></path> </g> <g data-mml-node="mi" transform="translate(2298, 0)"> <path data-c="75" d="M21 287Q21 295 30 318T55 370T99 420T158 442Q204 442 227 417T250 358Q250 340 216 246T182 105Q182 62 196 45T238 27T291 44T328 78L339 95Q341 99 377 247Q407 367 413 387T427 416Q444 431 463 431Q480 431 488 421T496 402L420 84Q419 79 419 68Q419 43 426 35T447 26Q469 29 482 57T512 145Q514 153 532 153Q551 153 551 144Q550 139 549 130T540 98T523 55T498 17T462 -8Q454 -10 438 -10Q372 -10 347 46Q345 45 336 36T318 21T296 6T267 -6T233 -11Q189 -11 155 7Q103 38 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"></path> </g> <g data-mml-node="mi" transform="translate(2870, 0)"> <path data-c="74" d="M26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26Z"></path> </g> <g data-mml-node="mi" transform="translate(3231, 0)"> <path data-c="65" d="M39 168Q39 225 58 272T107 350T174 402T244 433T307 442H310Q355 442 388 420T421 355Q421 265 310 237Q261 224 176 223Q139 223 138 221Q138 219 132 186T125 128Q125 81 146 54T209 26T302 45T394 111Q403 121 406 121Q410 121 419 112T429 98T420 82T390 55T344 24T281 -1T205 -11Q126 -11 83 42T39 168ZM373 353Q367 405 305 405Q272 405 244 391T199 357T170 316T154 280T149 261Q149 260 169 260Q282 260 327 284T373 353Z"></path> </g> <g data-mml-node="mo" transform="translate(3697, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mi" transform="translate(4086, 0)"> <path data-c="78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path> </g> <g data-mml-node="mo" transform="translate(4658, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> </g> </g><g></g> </svg></span></span><span leaf="">对音频片段随机置换,强制编码器忽略时序内容,专注音色特征提取。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">实测数据</span></strong></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">音色相似度:92% MOS(对比HiFi-GAN的85%)</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">最小克隆时长:</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">3秒</span></strong><span leaf="">(业界SOTA为5秒)</span> </section></li> </ul> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">3.&nbsp;</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">自然语言指令控制</span></strong><span leaf="">:用文本标签操控情感与方言</span></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">多模态对齐技术</span></strong></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">情感标签嵌入</span></strong><span leaf="">:将文本描述(如“[happy]”)映射到32维情感向量,与声学模型隐状态拼接。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">方言发音规则库</span></strong><span leaf="">:内置20种方言的音素-音调转换矩阵,例如四川话的入声调值修正:</span> <pre style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 8h9qxaj70ibdkkzptsjic4c9j3bc3rscf5vebfqqbewbyxweua40icsqrb8l1byanyn2mfoeovxkr8rxsxbx4nbllqzemqqucvf 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;word-break: break-all;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 四川话声调转换规则</span></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">if</span></span><span leaf="">&nbsp;dialect ==&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"sichuan"</span></span><span leaf="">:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; tone_map = {</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1</span></span><span leaf="">:&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">55</span></span><span leaf="">,&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">2</span></span><span leaf="">:&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">21</span></span><span leaf="">,&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3</span></span><span leaf="">:&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">53</span></span><span leaf="">,&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">4</span></span><span leaf="">:&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">213</span></span><span leaf="">} &nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 普通话→四川话调值映射</span></span><span leaf=""><br></span></code></pre> </section></li> </ul> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">可控性验证</span></strong><span leaf=""><br></span><span leaf="">在LibriTTS测试集上,情感控制准确率达89%(F1-score),方言发音错误率低于3%。</span></p> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 20px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">二、核心技术解析:如何实现“类人”语音生成?</span></span><span style="display: none;"></span></h3> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">1. 双向流式一体化架构(HybridStream)</span></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">架构设计</span></strong></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">共享编码器</span></strong><span leaf="">:基于动态窗口机制的Transformer-XL,支持可变长度输入(离线模式最大1024 token,流式模式256 token)。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">双路解码器</span></strong><span leaf="">:</span> </section></li> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">离线分支</span></strong><span leaf="">:使用Non-Autoregressive结构,并行生成高保真语音。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">流式分支</span></strong><span leaf="">:采用CA-CFM技术,实现低延迟流式输出。</span> </section></li> </ul> </ul> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">训练策略</span></strong></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">课程学习(Curriculum Learning)</span></strong><span leaf="">:先训练离线模型确保音质,再逐步引入流式目标函数。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">蒸馏损失</span></strong><span leaf="">:强制流式分支输出与离线分支的梅尔谱对齐,缩小质量差距。</span> </section></li> </ul> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">2. 有限标量量化(FSQ)技术</span></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">算法细节</span></strong></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">分层量化</span></strong><span leaf="">:将256维语音标记拆分为32组,每组8维向量独立量化。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">码本优化</span></strong><span leaf="">:通过可微分量化器学习最优码本分布,最小化重构误差:</span><span style="cursor:pointer;"> <section data-formula="\mathcal{L}_{quant} = \|x - \text{Dequant}(FSQ(x))\|_2 + \lambda \cdot \text{KL}(FSQ(x) \| \mathcal{N}(0,1)) " style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;font-weight: normal;text-align: center;overflow-x: auto;overflow-y: auto;display: block;"> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -789 27050.4 1076.2" aria-hidden="true" style="vertical-align: -0.65ex;width: 61.2ex;height: 2.435ex;max-width: 300% !important;"> <g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"> <g data-mml-node="math"> <g data-mml-node="msub"> <g data-mml-node="TeXAtom" data-mjx-texclass="ORD"> <g data-mml-node="mi"> <path data-c="4C" d="M62 -22T47 -22T32 -11Q32 -1 56 24T83 55Q113 96 138 172T180 320T234 473T323 609Q364 649 419 677T531 705Q559 705 578 696T604 671T615 645T618 623V611Q618 582 615 571T598 548Q581 531 558 520T518 509Q503 509 503 520Q503 523 505 536T507 560Q507 590 494 610T452 630Q423 630 410 617Q367 578 333 492T271 301T233 170Q211 123 204 112L198 103L224 102Q281 102 369 79T509 52H523Q535 64 544 87T579 128Q616 152 641 152Q656 152 656 142Q656 101 588 40T433 -22Q381 -22 289 1T156 28L141 29L131 20Q111 0 87 -11Z"></path> </g> </g> <g data-mml-node="TeXAtom" transform="translate(690, -150) scale(0.707)" data-mjx-texclass="ORD"> <g data-mml-node="mi"> <path data-c="71" d="M33 157Q33 258 109 349T280 441Q340 441 372 389Q373 390 377 395T388 406T404 418Q438 442 450 442Q454 442 457 439T460 434Q460 425 391 149Q320 -135 320 -139Q320 -147 365 -148H390Q396 -156 396 -157T393 -175Q389 -188 383 -194H370Q339 -192 262 -192Q234 -192 211 -192T174 -192T157 -193Q143 -193 143 -185Q143 -182 145 -170Q149 -154 152 -151T172 -148Q220 -148 230 -141Q238 -136 258 -53T279 32Q279 33 272 29Q224 -10 172 -10Q117 -10 75 30T33 157ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path> </g> <g data-mml-node="mi" transform="translate(460, 0)"> <path data-c="75" d="M21 287Q21 295 30 318T55 370T99 420T158 442Q204 442 227 417T250 358Q250 340 216 246T182 105Q182 62 196 45T238 27T291 44T328 78L339 95Q341 99 377 247Q407 367 413 387T427 416Q444 431 463 431Q480 431 488 421T496 402L420 84Q419 79 419 68Q419 43 426 35T447 26Q469 29 482 57T512 145Q514 153 532 153Q551 153 551 144Q550 139 549 130T540 98T523 55T498 17T462 -8Q454 -10 438 -10Q372 -10 347 46Q345 45 336 36T318 21T296 6T267 -6T233 -11Q189 -11 155 7Q103 38 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"></path> </g> <g data-mml-node="mi" transform="translate(1032, 0)"> <path data-c="61" d="M33 157Q33 258 109 349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 254 59T298 110Q300 114 325 217T351 328Z"></path> </g> <g data-mml-node="mi" transform="translate(1561, 0)"> <path data-c="6E" d="M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"></path> </g> <g data-mml-node="mi" transform="translate(2161, 0)"> <path data-c="74" d="M26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26Z"></path> </g> </g> </g> <g data-mml-node="mo" transform="translate(2801.1, 0)"> <path data-c="3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path> </g> <g data-mml-node="mo" transform="translate(3856.9, 0)"> <path data-c="2225" d="M133 736Q138 750 153 750Q164 750 170 739Q172 735 172 250T170 -239Q164 -250 152 -250Q144 -250 138 -244L137 -243Q133 -241 133 -179T132 250Q132 731 133 736ZM329 739Q334 750 346 750Q353 750 361 744L362 743Q366 741 366 679T367 250T367 -178T362 -243L361 -244Q355 -250 347 -250Q335 -250 329 -239Q327 -235 327 250T329 739Z"></path> </g> <g data-mml-node="mi" transform="translate(4356.9, 0)"> <path data-c="78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path> </g> <g data-mml-node="mo" transform="translate(5151.1, 0)"> <path data-c="2212" d="M84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250Z"></path> </g> <g data-mml-node="mtext" transform="translate(6151.3, 0)"> <path data-c="44" d="M130 622Q123 629 119 631T103 634T60 637H27V683H228Q399 682 419 682T461 676Q504 667 546 641T626 573T685 470T708 336Q708 210 634 116T442 3Q429 1 228 0H27V46H60Q102 47 111 49T130 61V622ZM593 338Q593 439 571 501T493 602Q439 637 355 637H322H294Q238 637 234 628Q231 624 231 344Q231 62 232 59Q233 49 248 48T339 46H350Q456 46 515 95Q561 133 577 191T593 338Z"></path> <path data-c="65" d="M28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275Z" transform="translate(764, 0)"></path> <path data-c="71" d="M33 218Q33 308 95 374T236 441H246Q330 441 381 372L387 364Q388 364 404 403L420 442H457V156Q457 -132 458 -134Q462 -142 470 -145Q491 -148 519 -148H535V-194H527L504 -193Q480 -192 453 -192T415 -191Q312 -191 303 -194H295V-148H311Q339 -148 360 -145Q369 -141 371 -135T373 -106V-41V49Q313 -11 236 -11Q154 -11 94 53T33 218ZM376 300Q346 389 278 401Q275 401 269 401T261 402Q211 400 171 350T131 214Q131 137 165 82T253 27Q296 27 328 54T376 118V300Z" transform="translate(1208, 0)"></path> <path data-c="75" d="M383 58Q327 -10 256 -10H249Q124 -10 105 89Q104 96 103 226Q102 335 102 348T96 369Q86 385 36 385H25V408Q25 431 27 431L38 432Q48 433 67 434T105 436Q122 437 142 438T172 441T184 442H187V261Q188 77 190 64Q193 49 204 40Q224 26 264 26Q290 26 311 35T343 58T363 90T375 120T379 144Q379 145 379 161T380 201T380 248V315Q380 361 370 372T320 385H302V431Q304 431 378 436T457 442H464V264Q464 84 465 81Q468 61 479 55T524 46H542V0Q540 0 467 -5T390 -11H383V58Z" transform="translate(1736, 0)"></path> <path data-c="61" d="M137 305T115 305T78 320T63 359Q63 394 97 421T218 448Q291 448 336 416T396 340Q401 326 401 309T402 194V124Q402 76 407 58T428 40Q443 40 448 56T453 109V145H493V106Q492 66 490 59Q481 29 455 12T400 -6T353 12T329 54V58L327 55Q325 52 322 49T314 40T302 29T287 17T269 6T247 -2T221 -8T190 -11Q130 -11 82 20T34 107Q34 128 41 147T68 188T116 225T194 253T304 268H318V290Q318 324 312 340Q290 411 215 411Q197 411 181 410T156 406T148 403Q170 388 170 359Q170 334 154 320ZM126 106Q126 75 150 51T209 26Q247 26 276 49T315 109Q317 116 318 175Q318 233 317 233Q309 233 296 232T251 223T193 203T147 166T126 106Z" transform="translate(2292, 0)"></path> <path data-c="6E" d="M41 46H55Q94 46 102 60V68Q102 77 102 91T102 122T103 161T103 203Q103 234 103 269T102 328V351Q99 370 88 376T43 385H25V408Q25 431 27 431L37 432Q47 433 65 434T102 436Q119 437 138 438T167 441T178 442H181V402Q181 364 182 364T187 369T199 384T218 402T247 421T285 437Q305 442 336 442Q450 438 463 329Q464 322 464 190V104Q464 66 466 59T477 49Q498 46 526 46H542V0H534L510 1Q487 2 460 2T422 3Q319 3 310 0H302V46H318Q379 46 379 62Q380 64 380 200Q379 335 378 343Q372 371 358 385T334 402T308 404Q263 404 229 370Q202 343 195 315T187 232V168V108Q187 78 188 68T191 55T200 49Q221 46 249 46H265V0H257L234 1Q210 2 183 2T145 3Q42 3 33 0H25V46H41Z" transform="translate(2792, 0)"></path> <path data-c="74" d="M27 422Q80 426 109 478T141 600V615H181V431H316V385H181V241Q182 116 182 100T189 68Q203 29 238 29Q282 29 292 100Q293 108 293 146V181H333V146V134Q333 57 291 17Q264 -10 221 -10Q187 -10 162 2T124 33T105 68T98 100Q97 107 97 248V385H18V422H27Z" transform="translate(3348, 0)"></path> </g> <g data-mml-node="mo" transform="translate(9888.3, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mi" transform="translate(10277.3, 0)"> <path data-c="46" d="M48 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H742Q749 676 749 669Q749 664 736 557T722 447Q720 440 702 440H690Q683 445 683 453Q683 454 686 477T689 530Q689 560 682 579T663 610T626 626T575 633T503 634H480Q398 633 393 631Q388 629 386 623Q385 622 352 492L320 363H375Q378 363 398 363T426 364T448 367T472 374T489 386Q502 398 511 419T524 457T529 475Q532 480 548 480H560Q567 475 567 470Q567 467 536 339T502 207Q500 200 482 200H470Q463 206 463 212Q463 215 468 234T473 274Q473 303 453 310T364 317H309L277 190Q245 66 245 60Q245 46 334 46H359Q365 40 365 39T363 19Q359 6 353 0H336Q295 2 185 2Q120 2 86 2T48 1Z"></path> </g> <g data-mml-node="mi" transform="translate(11026.3, 0)"> <path data-c="53" d="M308 24Q367 24 416 76T466 197Q466 260 414 284Q308 311 278 321T236 341Q176 383 176 462Q176 523 208 573T273 648Q302 673 343 688T407 704H418H425Q521 704 564 640Q565 640 577 653T603 682T623 704Q624 704 627 704T632 705Q645 705 645 698T617 577T585 459T569 456Q549 456 549 465Q549 471 550 475Q550 478 551 494T553 520Q553 554 544 579T526 616T501 641Q465 662 419 662Q362 662 313 616T263 510Q263 480 278 458T319 427Q323 425 389 408T456 390Q490 379 522 342T554 242Q554 216 546 186Q541 164 528 137T492 78T426 18T332 -20Q320 -22 298 -22Q199 -22 144 33L134 44L106 13Q83 -14 78 -18T65 -22Q52 -22 52 -14Q52 -11 110 221Q112 227 130 227H143Q149 221 149 216Q149 214 148 207T144 186T142 153Q144 114 160 87T203 47T255 29T308 24Z"></path> </g> <g data-mml-node="mi" transform="translate(11671.3, 0)"> <path data-c="51" d="M399 -80Q399 -47 400 -30T402 -11V-7L387 -11Q341 -22 303 -22Q208 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435Q740 255 592 107Q529 47 461 16L444 8V3Q444 2 449 -24T470 -66T516 -82Q551 -82 583 -60T625 -3Q631 11 638 11Q647 11 649 2Q649 -6 639 -34T611 -100T557 -165T481 -194Q399 -194 399 -87V-80ZM636 468Q636 523 621 564T580 625T530 655T477 665Q429 665 379 640Q277 591 215 464T153 216Q153 110 207 59Q231 38 236 38V46Q236 86 269 120T347 155Q372 155 390 144T417 114T429 82T435 55L448 64Q512 108 557 185T619 334T636 468ZM314 18Q362 18 404 39L403 49Q399 104 366 115Q354 117 347 117Q344 117 341 117T337 118Q317 118 296 98T274 52Q274 18 314 18Z"></path> </g> <g data-mml-node="mo" transform="translate(12462.3, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mi" transform="translate(12851.3, 0)"> <path data-c="78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path> </g> <g data-mml-node="mo" transform="translate(13423.3, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> <g data-mml-node="mo" transform="translate(13812.3, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> <g data-mml-node="msub" transform="translate(14201.3, 0)"> <g data-mml-node="mo"> <path data-c="2225" d="M133 736Q138 750 153 750Q164 750 170 739Q172 735 172 250T170 -239Q164 -250 152 -250Q144 -250 138 -244L137 -243Q133 -241 133 -179T132 250Q132 731 133 736ZM329 739Q334 750 346 750Q353 750 361 744L362 743Q366 741 366 679T367 250T367 -178T362 -243L361 -244Q355 -250 347 -250Q335 -250 329 -239Q327 -235 327 250T329 739Z"></path> </g> <g data-mml-node="mn" transform="translate(500, -150) scale(0.707)"> <path data-c="32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path> </g> </g> <g data-mml-node="mo" transform="translate(15327.1, 0)"> <path data-c="2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path> </g> <g data-mml-node="mi" transform="translate(16327.3, 0)"> <path data-c="3BB" d="M166 673Q166 685 183 694H202Q292 691 316 644Q322 629 373 486T474 207T524 67Q531 47 537 34T546 15T551 6T555 2T556 -2T550 -11H482Q457 3 450 18T399 152L354 277L340 262Q327 246 293 207T236 141Q211 112 174 69Q123 9 111 -1T83 -12Q47 -12 47 20Q47 37 61 52T199 187Q229 216 266 252T321 306L338 322Q338 323 288 462T234 612Q214 657 183 657Q166 657 166 673Z"></path> </g> <g data-mml-node="mo" transform="translate(17132.5, 0)"> <path data-c="22C5" d="M78 250Q78 274 95 292T138 310Q162 310 180 294T199 251Q199 226 182 208T139 190T96 207T78 250Z"></path> </g> <g data-mml-node="mtext" transform="translate(17632.8, 0)"> <path data-c="4B" d="M128 622Q121 629 117 631T101 634T58 637H25V683H36Q57 680 180 680Q315 680 324 683H335V637H313Q235 637 233 620Q232 618 232 462L233 307L379 449Q425 494 479 546Q518 584 524 591T531 607V608Q531 630 503 636Q501 636 498 636T493 637H489V683H499Q517 680 630 680Q704 680 716 683H722V637H708Q633 633 589 597Q584 592 495 506T406 419T515 254T631 80Q644 60 662 54T715 46H736V0H728Q719 3 615 3Q493 3 472 0H461V46H469Q515 46 515 72Q515 78 512 84L336 351Q332 348 278 296L232 251V156Q232 62 235 58Q243 47 302 46H335V0H324Q303 3 180 3Q45 3 36 0H25V46H58Q100 47 109 49T128 61V622Z"></path> <path data-c="4C" d="M128 622Q121 629 117 631T101 634T58 637H25V683H36Q48 680 182 680Q324 680 348 683H360V637H333Q273 637 258 635T233 622L232 342V129Q232 57 237 52Q243 47 313 47Q384 47 410 53Q470 70 498 110T536 221Q536 226 537 238T540 261T542 272T562 273H582V268Q580 265 568 137T554 5V0H25V46H58Q100 47 109 49T128 61V622Z" transform="translate(778, 0)"></path> </g> <g data-mml-node="mo" transform="translate(19035.8, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mi" transform="translate(19424.8, 0)"> <path data-c="46" d="M48 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H742Q749 676 749 669Q749 664 736 557T722 447Q720 440 702 440H690Q683 445 683 453Q683 454 686 477T689 530Q689 560 682 579T663 610T626 626T575 633T503 634H480Q398 633 393 631Q388 629 386 623Q385 622 352 492L320 363H375Q378 363 398 363T426 364T448 367T472 374T489 386Q502 398 511 419T524 457T529 475Q532 480 548 480H560Q567 475 567 470Q567 467 536 339T502 207Q500 200 482 200H470Q463 206 463 212Q463 215 468 234T473 274Q473 303 453 310T364 317H309L277 190Q245 66 245 60Q245 46 334 46H359Q365 40 365 39T363 19Q359 6 353 0H336Q295 2 185 2Q120 2 86 2T48 1Z"></path> </g> <g data-mml-node="mi" transform="translate(20173.8, 0)"> <path data-c="53" d="M308 24Q367 24 416 76T466 197Q466 260 414 284Q308 311 278 321T236 341Q176 383 176 462Q176 523 208 573T273 648Q302 673 343 688T407 704H418H425Q521 704 564 640Q565 640 577 653T603 682T623 704Q624 704 627 704T632 705Q645 705 645 698T617 577T585 459T569 456Q549 456 549 465Q549 471 550 475Q550 478 551 494T553 520Q553 554 544 579T526 616T501 641Q465 662 419 662Q362 662 313 616T263 510Q263 480 278 458T319 427Q323 425 389 408T456 390Q490 379 522 342T554 242Q554 216 546 186Q541 164 528 137T492 78T426 18T332 -20Q320 -22 298 -22Q199 -22 144 33L134 44L106 13Q83 -14 78 -18T65 -22Q52 -22 52 -14Q52 -11 110 221Q112 227 130 227H143Q149 221 149 216Q149 214 148 207T144 186T142 153Q144 114 160 87T203 47T255 29T308 24Z"></path> </g> <g data-mml-node="mi" transform="translate(20818.8, 0)"> <path data-c="51" d="M399 -80Q399 -47 400 -30T402 -11V-7L387 -11Q341 -22 303 -22Q208 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435Q740 255 592 107Q529 47 461 16L444 8V3Q444 2 449 -24T470 -66T516 -82Q551 -82 583 -60T625 -3Q631 11 638 11Q647 11 649 2Q649 -6 639 -34T611 -100T557 -165T481 -194Q399 -194 399 -87V-80ZM636 468Q636 523 621 564T580 625T530 655T477 665Q429 665 379 640Q277 591 215 464T153 216Q153 110 207 59Q231 38 236 38V46Q236 86 269 120T347 155Q372 155 390 144T417 114T429 82T435 55L448 64Q512 108 557 185T619 334T636 468ZM314 18Q362 18 404 39L403 49Q399 104 366 115Q354 117 347 117Q344 117 341 117T337 118Q317 118 296 98T274 52Q274 18 314 18Z"></path> </g> <g data-mml-node="mo" transform="translate(21609.8, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mi" transform="translate(21998.8, 0)"> <path data-c="78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path> </g> <g data-mml-node="mo" transform="translate(22570.8, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> <g data-mml-node="mo" transform="translate(22959.8, 0)"> <path data-c="2225" d="M133 736Q138 750 153 750Q164 750 170 739Q172 735 172 250T170 -239Q164 -250 152 -250Q144 -250 138 -244L137 -243Q133 -241 133 -179T132 250Q132 731 133 736ZM329 739Q334 750 346 750Q353 750 361 744L362 743Q366 741 366 679T367 250T367 -178T362 -243L361 -244Q355 -250 347 -250Q335 -250 329 -239Q327 -235 327 250T329 739Z"></path> </g> <g data-mml-node="TeXAtom" data-mjx-texclass="ORD" transform="translate(23459.8, 0)"> <g data-mml-node="mi"> <path data-c="4E" d="M343 705Q358 705 358 698Q360 696 370 658T411 524T484 319Q536 174 590 82L595 73L615 152Q646 274 683 407Q729 571 752 637T799 727Q852 780 937 788Q939 788 947 788T958 789H962Q979 789 979 765Q979 722 951 692Q942 683 924 683Q888 681 859 672T818 654T803 639Q784 608 708 322T631 15Q631 14 630 15Q630 17 629 15Q628 14 628 12Q621 -4 601 -17T560 -31Q550 -31 546 -28T530 -7Q484 67 458 123T398 272Q352 392 314 514L306 535V534Q306 533 296 488T272 379T234 239T185 100T127 -7T61 -50Q34 -50 4 -34T-27 8Q-27 33 -12 61T18 90Q21 90 36 77T87 57H92Q109 57 123 78T162 173Q206 299 232 417T265 599T276 667Q284 681 304 693T343 705Z"></path> </g> </g> <g data-mml-node="mo" transform="translate(24438.8, 0)"> <path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path> </g> <g data-mml-node="mn" transform="translate(24827.8, 0)"> <path data-c="30" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"></path> </g> <g data-mml-node="mo" transform="translate(25327.8, 0)"> <path data-c="2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path> </g> <g data-mml-node="mn" transform="translate(25772.4, 0)"> <path data-c="31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path> </g> <g data-mml-node="mo" transform="translate(26272.4, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> <g data-mml-node="mo" transform="translate(26661.4, 0)"> <path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path> </g> </g> </g><g></g> </svg> </section></span> </section></li> </ul> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">跨语言优化</span></strong><span leaf=""><br></span><span leaf="">针对日语促音问题,在训练数据中插入10%的促音增强样本(如“いっぱい”→“いっっぱい”),使模型学习短时停顿的声学特征。</span></p> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 20px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">三、开发者必看:如何快速集成?</span></span><span style="display: none;"></span></h3> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">1. 多场景API调用示例</span></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">实时流式交互</span></strong></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 8h9qxaj70ibdkkzptsjic4c9j3bc3rscf5vebfqqbewbyxweua40icsqrb8l1byanyn2mfoeovxkr8rxsxbx4nbllqzemqqucvf 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;cosyvoice.streaming&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;StreamingClient</span><span leaf=""><br></span><span leaf="">client = StreamingClient(endpoint=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"wss://api.siliconflow.cn/tts/stream"</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 启动双向通信</span></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">async</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">for</span></span><span leaf="">&nbsp;text_chunk&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf="">&nbsp;microphone_stream:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; audio_chunk =&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">await</span></span><span leaf="">&nbsp;client.generate(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; text=text_chunk,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; voice_embedding=precomputed_embedding &nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 预计算音色向量</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; )</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; speaker.play(audio_chunk)</span><span leaf=""><br></span></code></pre> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">2. 企业级部署方案</span></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">硬件推荐配置</span></strong></p> <section data-tool="mdnice编辑器" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;overflow-x: auto;"> <table style="display: table;text-align: left;"> <thead> <tr> <th style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf="">并发路数</span> </section></th> <th style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf="">GPU型号</span> </section></th> <th style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf="">显存占用</span> </section></th> <th style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf="">实时性 (RTF)</span> </section></th> </tr> </thead> <tbody> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(255, 255, 255);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">50</span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">A10</span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">8GB</span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">0.3</span> </section></td> </tr> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 248, 248);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">200</span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">A100-40G</span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">32GB</span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf="">0.15</span> </section></td> </tr> </tbody> </table> </section> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">私有化部署包</span></strong></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">支持Kubernetes集群自动扩缩容</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">提供ARMv9指令集优化版本(延迟降低15%)</span> </section></li> </ul> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 20px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">四、应用场景全景图</span></span><span style="display: none;"></span></h3> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">1.&nbsp;</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">实时翻译会议系统</span></strong></span><span style="display: none;"></span></h4> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">技术实现</span></strong><span leaf="">:通过音色克隆保留发言人特征,结合Whisper实现端到端同声传译。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">延迟分解</span></strong><span leaf="">:</span> <pre style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 8h9qxaj70ibdkkzptsjic4c9j3bc3rscf5vebfqqbewbyxweua40icsqrb8l1byanyn2mfoeovxkr8rxsxbx4nbllqzemqqucvf 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;word-break: break-all;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">语音识别(80ms)→ 机器翻译(60ms)→ 语音合成(150ms) = 总延迟290ms</span><span leaf=""><br></span></code></pre> </section></li> </ul> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">2.&nbsp;</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">AI NPC情感交互</span></strong></span><span style="display: none;"></span></h4> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Unity插件</span></strong><span leaf="">:提供C# SDK,支持动态情感参数绑定:</span> <pre style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg 8h9qxaj70ibdkkzptsjic4c9j3bc3rscf5vebfqqbewbyxweua40icsqrb8l1byanyn2mfoeovxkr8rxsxbx4nbllqzemqqucvf 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;word-break: break-all;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">public</span></span><span leaf="">&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">void</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">OnPlayerAttack</span></span><span leaf="">(</span><span style="line-height: 26px;"></span><span leaf="">)</span></span><span leaf="">&nbsp;{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">var</span></span><span leaf="">&nbsp;audio = CosyVoice.Generate(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; text:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"你竟敢伤害我![angry]"</span></span><span leaf="">,&nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; style:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"intensity=0.8, pitch_shift=+2st"</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; );</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; audioSource.Play(audio);</span><span leaf=""><br></span><span leaf="">}</span><span leaf=""><br></span></code></pre> </section></li> </ul> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">3.&nbsp;</span><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">无障碍方言服务</span></strong></span><span style="display: none;"></span></h4> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">方言覆盖</span></strong><span leaf="">:支持粤语、闽南语、吴语等6大方言区20种变体。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">医疗场景优化</span></strong><span leaf="">:针对医疗术语优化发音规则(如“龋齿”在粤语中的特殊读法)。</span> </section></li> </ul> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 20px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">五、未来展望</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">通义实验室透露,下一代CosyVoice3.0将实现:</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">歌声合成</span></strong><span leaf="">:支持流行/美声唱法切换</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">口型同步</span></strong><span leaf="">:生成匹配语音的3D人脸动画</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">脑电波控制</span></strong><span leaf="">:通过EEG信号直接生成语音(实验阶段)</span> </section></li> </ul> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(130, 127, 196);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">#语音生成 #AI开源 #人机交互</span></strong><span leaf=""><br></span><span leaf="">从算法创新到产业落地,CosyVoice2-0.5B正在重塑语音交互的技术边界!🚀</span></p> </section> <section> <span leaf=""><br></span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>