文章列表

字节超快超强声音克隆 MegaTTS3, 声音克隆几乎一模一样, 可跨语言克隆.

作者:微信小助手

<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;" data-pm-slice="0 0 []"> <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;display: block;"><span style="display: none;"></span><span style="font-size: 24px;color: rgb(63, 63, 63);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf=""><span textstyle="" style="font-size: 17px;">ComfyUI 的 MegaTTS3 声音克隆节点</span></span></span><span style="display: none;"></span></h1><span leaf="">https://github.com/billwuhao/ComfyUI_MegaTTS3</span> <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: 18px;padding-bottom: 18px;padding-left: 0px;padding-right: 0px;"><span leaf="">声音克隆质量非常高, 支持中英文, 并可跨语言克隆.</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/8c77d8a984d0750346b325b226992892.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.27037037037037037" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="347580330"> </section> <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: 18px;padding-bottom: 18px;padding-left: 0px;padding-right: 0px;"><span leaf="">📣 更新</span><span style="display: none;"></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: 18px;padding-bottom: 18px;padding-left: 0px;padding-right: 0px;"><span leaf="">[2025-04-06]⚒️: 发布 v1.0.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: 18px;padding-bottom: 18px;padding-left: 0px;padding-right: 0px;"><span leaf="">安装</span><span style="display: none;"></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 8h9qxaj70ibd8mclurpdsmlhlesnf2gve3jh1cia9tugtmfit8bbkpt26iacpgiz68eiczvliapfukabnki9uexcuicku7ueyudtu 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="">cd</span></span><span leaf="">&nbsp;ComfyUI/custom_nodes</span><span leaf=""><br></span><span leaf="">git&nbsp;</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">clone</span></span><span leaf="">&nbsp;https://github.com/billwuhao/ComfyUI_MegaTTS3.git</span><span leaf=""><br></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">cd</span></span><span leaf="">&nbsp;ComfyUI_MegaTTS3</span><span leaf=""><br></span><span leaf="">pip install -r requirements.txt</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># python_embeded</span></span><span leaf=""><br></span><span leaf="">./python_embeded/python.exe -m pip install -r requirements.txt</span><span leaf=""><br></span></code></pre> <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;display: block;"><span style="display: none;"></span><span style="font-size: 22px;color: rgb(63, 63, 63);line-height: 1.5em;letter-spacing: 0em;text-align: center;font-weight: normal;display: block;"><span leaf="">模型下载</span></span><span style="display: none;"></span></h2> <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="">模型和音色需要手动下载放到&nbsp;</span><code style="background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 245, 236);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-top: 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;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">ComfyUI\models\TTS</span></code><span leaf="">&nbsp;路径下:</span> </section> <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: 18px;padding-bottom: 18px;padding-left: 0px;padding-right: 0px;"><span leaf="">[MegaTTS3]</span><code style="color: rgb(255, 53, 2);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 245, 236);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: 2px;margin-right: 2px;padding-top: 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;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">(https://huggingface.co/ByteDance/MegaTTS3/tree/main)</span></code><span leaf="">&nbsp; 整个文件夹全部下载放到&nbsp;</span><code style="color: rgb(255, 53, 2);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 245, 236);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: 2px;margin-right: 2px;padding-top: 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;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">TTS</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: 18px;padding-bottom: 18px;padding-left: 0px;padding-right: 0px;"><code style="color: rgb(255, 53, 2);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 245, 236);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: 2px;margin-right: 2px;padding-top: 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;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">MegaTTS3</span></code><span leaf="">&nbsp;文件夹中新建&nbsp;</span><code style="color: rgb(255, 53, 2);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 245, 236);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: 2px;margin-right: 2px;padding-top: 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;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">speakers</span></code><span leaf="">&nbsp;文件夹, 从 [Google drive]</span><code style="color: rgb(255, 53, 2);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 245, 236);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: 2px;margin-right: 2px;padding-top: 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;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">(https://drive.google.com/drive/folders/1QhcHWcy20JfqWjgqZX1YM3I6i9u4oNlr)</span></code><span leaf="">&nbsp;下载所有&nbsp;</span><code style="color: rgb(255, 53, 2);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 245, 236);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: 2px;margin-right: 2px;padding-top: 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;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">.wav</span></code><span leaf="">&nbsp;和&nbsp;</span><code style="color: rgb(255, 53, 2);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 245, 236);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: 2px;margin-right: 2px;padding-top: 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;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">.npy</span></code><span leaf="">&nbsp;文件, 放到&nbsp;</span><code style="color: rgb(255, 53, 2);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 245, 236);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: 2px;margin-right: 2px;padding-top: 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;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">speakers</span></code><span leaf="">&nbsp;文件夹下.</span></p> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="347580331" data-ratio="0.7454844006568144" data-s="300,640" src="/upload/764eb48e4663ec96561efabb959c11f8.png" data-type="png" data-w="609" type="block"> </section> <section> <span leaf="">唯一的遗憾是不能自定义克隆声音, 因为克隆质量太好了, 出于安全考虑, 官方未发布自定义克隆的参数, 但是你可以上传要克隆的声音申请(长度 24s 内), 申请地址:</span> </section> <section> <span leaf=""><span textstyle="" style="font-size: 14px;">https://drive.google.com/drive/folders/1gCWL1y_2xu9nIFhUX_OW5MbcFuB7J5Cl&nbsp;</span></span> </section> <section> <span leaf=""><span textstyle="" style="font-size: 17px;">目前已经有近 300 种音色了. 我已经打包上传到云盘, 文末获取.</span></span> </section> <section> <span leaf=""><span textstyle="" style="font-weight: bold;">鸣谢</span></span> <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;display: block;"><span style="display: none;"></span></h2> <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="">[MegaTTS3]</span><code style="background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 245, 236);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-top: 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;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">(https://github.com/bytedance/MegaTTS3)</span></code> </section></li> </ul> <p style="cursor: pointer;line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><span leaf=""><br></span></p> <p style="cursor: pointer;line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><span leaf="">- 效果演示. 前面是原声, 后面是克隆:</span></p> <p style="cursor: pointer;line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><span leaf="">01</span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="周杰伦1" author="明文视界" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E5%91%A8%E6%9D%B0%E4%BC%A61&amp;play_length=7%E7%A7%92" isaac2="1" low_size="14.33" source_size="14.3" high_size="28.36" play_length="7000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA5MzA3NTQwOV8yNDk1MDYzOTk3" cover="http://wx.qlogo.cn/mmopen/zFb8Du9G7Liczc04WEhOEHG07X4txGnwIjmic3r6Cr02aJRxQnkPBCVcyQcwaCQlWoepxnF8fxLiaxf5tjMRsA4hp5PZDKh7yJaI2lwtNiahWmI7cG6VkA3W1FAFJOlMQw9g/0"></mp-common-mpaudio> </section> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="周杰伦" author="明文视界" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E5%91%A8%E6%9D%B0%E4%BC%A6&amp;play_length=7%E7%A7%92" isaac2="1" low_size="15.14" source_size="15.1" high_size="33.77" play_length="7000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA5MzA3NTQwOV8yNDk1MDYzOTk5" cover="http://wx.qlogo.cn/mmopen/zFb8Du9G7Liczc04WEhOEHG07X4txGnwIjmic3r6Cr02aJRxQnkPBCVcyQcwaCQlWoepxnF8fxLiaxf5tjMRsA4hp5PZDKh7yJaI2lwtNiahWmI7cG6VkA3W1FAFJOlMQw9g/0"></mp-common-mpaudio> </section> <p style="cursor: pointer;line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><span leaf="">02</span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="蔡徐坤1" author="明文视界" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E8%94%A1%E5%BE%90%E5%9D%A41&amp;play_length=8%E7%A7%92" isaac2="1" low_size="15.73" source_size="15.7" high_size="31.54" play_length="8000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA5MzA3NTQwOV8yNDk1MDYzOTk4" cover="http://wx.qlogo.cn/mmopen/zFb8Du9G7Liczc04WEhOEHG07X4txGnwIjmic3r6Cr02aJRxQnkPBCVcyQcwaCQlWoepxnF8fxLiaxf5tjMRsA4hp5PZDKh7yJaI2lwtNiahWmI7cG6VkA3W1FAFJOlMQw9g/0"></mp-common-mpaudio> </section> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="蔡徐坤" author="明文视界" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E8%94%A1%E5%BE%90%E5%9D%A4&amp;play_length=7%E7%A7%92" isaac2="1" low_size="14.09" source_size="14.1" high_size="30.76" play_length="7000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA5MzA3NTQwOV8yNDk1MDY0MDAy" cover="http://wx.qlogo.cn/mmopen/zFb8Du9G7Liczc04WEhOEHG07X4txGnwIjmic3r6Cr02aJRxQnkPBCVcyQcwaCQlWoepxnF8fxLiaxf5tjMRsA4hp5PZDKh7yJaI2lwtNiahWmI7cG6VkA3W1FAFJOlMQw9g/0"></mp-common-mpaudio> </section> <p style="cursor: pointer;line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><span leaf="">03</span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="撒娇" author="明文视界" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E6%92%92%E5%A8%87&amp;play_length=10%E7%A7%92" isaac2="1" low_size="19.49" source_size="19.5" high_size="80.45" play_length="10000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA5MzA3NTQwOV8yNDk1MDY0MDAw" cover="http://wx.qlogo.cn/mmopen/zFb8Du9G7Liczc04WEhOEHG07X4txGnwIjmic3r6Cr02aJRxQnkPBCVcyQcwaCQlWoepxnF8fxLiaxf5tjMRsA4hp5PZDKh7yJaI2lwtNiahWmI7cG6VkA3W1FAFJOlMQw9g/0"></mp-common-mpaudio> </section> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="撒娇" author="明文视界" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E6%92%92%E5%A8%87&amp;play_length=9%E7%A7%92" isaac2="1" low_size="17.16" source_size="17.2" high_size="38.43" play_length="9000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA5MzA3NTQwOV8yNDk1MDY0MDAx" cover="http://wx.qlogo.cn/mmopen/zFb8Du9G7Liczc04WEhOEHG07X4txGnwIjmic3r6Cr02aJRxQnkPBCVcyQcwaCQlWoepxnF8fxLiaxf5tjMRsA4hp5PZDKh7yJaI2lwtNiahWmI7cG6VkA3W1FAFJOlMQw9g/0"></mp-common-mpaudio> </section> <p style="cursor: pointer;line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><span leaf="">04</span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="00010" author="明文视界" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=00010&amp;play_length=3%E7%A7%92" isaac2="1" low_size="5.77" source_size="5.8" high_size="9.22" play_length="3000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA5MzA3NTQwOV8yNDk1MDY0MDAz" cover="http://wx.qlogo.cn/mmopen/zFb8Du9G7Liczc04WEhOEHG07X4txGnwIjmic3r6Cr02aJRxQnkPBCVcyQcwaCQlWoepxnF8fxLiaxf5tjMRsA4hp5PZDKh7yJaI2lwtNiahWmI7cG6VkA3W1FAFJOlMQw9g/0"></mp-common-mpaudio> </section> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="英文女" author="明文视界" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E8%8B%B1%E6%96%87%E5%A5%B3&amp;play_length=7%E7%A7%92" isaac2="1" low_size="13.98" source_size="14" high_size="32.52" play_length="7000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA5MzA3NTQwOV8yNDk1MDY0MDA0" cover="http://wx.qlogo.cn/mmopen/zFb8Du9G7Liczc04WEhOEHG07X4txGnwIjmic3r6Cr02aJRxQnkPBCVcyQcwaCQlWoepxnF8fxLiaxf5tjMRsA4hp5PZDKh7yJaI2lwtNiahWmI7cG6VkA3W1FAFJOlMQw9g/0"></mp-common-mpaudio> </section> <p style="cursor: pointer;line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><span leaf="">05</span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="snoopdog_rap" author="明文视界" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=snoopdog_rap&amp;play_length=10%E7%A7%92" isaac2="1" low_size="21.92" source_size="21.9" high_size="31.37" play_length="10000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA5MzA3NTQwOV8yNDk1MDY0MDA1" cover="http://wx.qlogo.cn/mmopen/zFb8Du9G7Liczc04WEhOEHG07X4txGnwIjmic3r6Cr02aJRxQnkPBCVcyQcwaCQlWoepxnF8fxLiaxf5tjMRsA4hp5PZDKh7yJaI2lwtNiahWmI7cG6VkA3W1FAFJOlMQw9g/0"></mp-common-mpaudio> </section> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="英文rap" author="明文视界" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E8%8B%B1%E6%96%87rap&amp;play_length=5%E7%A7%92" isaac2="1" low_size="10.66" source_size="10.7" high_size="24.38" play_length="5000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA5MzA3NTQwOV8yNDk1MDY0MDA2" cover="http://wx.qlogo.cn/mmopen/zFb8Du9G7Liczc04WEhOEHG07X4txGnwIjmic3r6Cr02aJRxQnkPBCVcyQcwaCQlWoepxnF8fxLiaxf5tjMRsA4hp5PZDKh7yJaI2lwtNiahWmI7cG6VkA3W1FAFJOlMQw9g/0"></mp-common-mpaudio> </section> <p style="cursor: pointer;line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><span leaf=""><br></span></p> <p style="cursor: pointer;line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><span leaf="">公众号后台聊天窗口回复&nbsp;<span textstyle="" style="background-color: rgb(255, 104, 39);">250406</span>&nbsp;获取.</span></p> </section> <hr style="border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);"> <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;" data-pm-slice="0 0 []"> <p style="cursor: pointer;line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><span leaf=""><br></span></p> <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-regular, 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;"> <ul style="list-style-type: circle;margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <p style="line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><span leaf="">明文视界 AI 资源站:</span></p> <p style="line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><span leaf="">https://aiart.website/</span></p> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <p style="line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><span leaf="">明文视界 GitHub ComfyUI 节点项目:</span></p> </section></li> </ul> <ul style="list-style-type: circle;margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <ul style="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(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_MegaTTS3: 字节超快超强声音克隆, 可跨语言克隆.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_Prompt-All-In-One: 为所有影,音,图,文创作生成提示的 ComfyUI 节点.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_OneButtonPrompt: 在 comfyui 中一键辅助生成提示 (用于图像和视频生成等) 的节点.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_AudioTools: 音频处理等相关的 ComfyUI 节点. 包括 视频自动添加字幕; 音频任意时间刻度裁剪; 音频音量, 速度, 音高, 回音处理等; 去除音频中无声部分; 录音; 音频水印嵌入等.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_StepAudioTTS: Step-Audio-TTS 的 ComfyUI 节点, 文本转语音, 可说话, 唱歌, RAP, 或者克隆声音.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_SparkTTS: 在 Comfyui 中使用 Spark-TTS. Spark-TTS: 一种基于 LLM 的高效文本到语音模型,能克隆各种语言的声音.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_NotaGen: NotaGen 的 ComfyUI 节点. 可以同时生成古典音乐和曲谱.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_KokoroTTS_MW: Kokoro-TTS 的快速文本转语音节点. 支持 8 种语言和 150 种音色.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_gemmax: 小米 GemmaX 翻译, 支持 28 种语言的 ComfyUI 节点.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_EraX-WoW-Turbo: 超快速多语言语音识别的 ComfyUI 节点. 可带时间戳.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_DiffRhythm: 快速而简单的歌曲生成 ComfyUI 节点.</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <span leaf="">ComfyUI_CSM: 声音克隆, 多轮对话节点, 可根据对话情绪变化情绪, 只支持英文.</span> </section></li> </ul> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <p style="line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><span leaf="">明文视界仙宫云镜像:</span></p> <p style="line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><span leaf="">无需本地部署, 和高显卡要求, 直接云端玩 AI.</span></p> <p style="line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><span leaf="">https://www.xiangongyun.com/image/detail/a1cb959b-a750-4ce6-9418-3659906955d2?r=I9YXP1</span></p> <p style="line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><span leaf="">使用教程:&nbsp;</span><a href="https://mp.weixin.qq.com/s?__biz=MzA5MzA3NTQwOQ==&amp;mid=2495063817&amp;idx=2&amp;sn=062bda736fccfd22fd7fc42f404664bb&amp;scene=21#wechat_redirect" style="color: rgb(57, 144, 3);font-weight: bold;border-style: none none solid;border-width: 1px;border-color: rgb(30, 107, 184) rgb(30, 107, 184) rgb(57, 144, 3);border-radius: 0px;" data-linktype="2"><span leaf="">明文视界仙宫云镜像使用教程</span></a></p> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(43, 43, 43);line-height: 1.8em;letter-spacing: 0.02em;"> <p style="line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><span leaf="">LIBLIB AI:</span></p> <p style="line-height: 1.8em;letter-spacing: 0.02em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;"><span leaf="">https://www.liblib.art/userpage/53a1edbdf5394aaba7028eff2aaec867</span></p> </section></li> </ul> </section> </section>

斩获 3W 星!最近爆火的 MCP 一网打尽。

作者:微信小助手

<section class="mp_profile_iframe_wrp" nodeleaf=""> <mp-common-profile class="custom_select_card mp_profile_iframe mp_common_widget" data-pluginname="mpprofile" data-nickname="逛逛GitHub" data-alias="ggGithub" data-from="0" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/ePw3ZeGRruyXo8VzACicO8MVibibicuJUQ8Vzghx6WF8F51breYjBIuYd4cj6wp26BYrg850bNuA20rdic9UyKIUhpg/0?wx_fmt=png" data-signature="每天为你节省 1 小时,热门「开源项目」推送到眼前。 给我发消息「查询搜索」各种开源项目,专注 AI、硬科技开源领域。" data-id="MzUxNjg4NDEzNA==" data-service_type="1"></mp-common-profile> </section> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32mrno">如果你关注 AI 领域,最近肯定经常听到&nbsp;<span textstyle="" style="color: rgb(13, 13, 13);font-weight: bold;">MCP</span>&nbsp;这个词。</span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32mrno">这是个啥呢?</span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32m352"><span textstyle="" style="color: rgb(255, 104, 39);font-weight: bold;">照本宣科:</span></span><span leaf="" data-pm-slice="1 1 [" para,{tagname:p,attributes:{data-pm-slice:0 0 []},namespaceuri:http: www.w3.org 1999 xhtml}] style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32mend">MCP 是&nbsp;</span><span leaf="" data-pm-slice="1 1 [" para,{tagname:p,attributes:{data-pm-slice:0 0 []},namespaceuri:http: www.w3.org 1999 xhtml}] style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32mzfc">Model Context Protocol 的缩写,也就是</span><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32m1fuq">模型上下文协议。</span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32miz1">这是 Anthropic 所推动的一项开放标准,<span textstyle="" style="font-weight: bold;">为大语言模型(LLMs)应用提供一个标准化的接口,使其能够连接和交互外部数据源和工具。</span></span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32m4zo">它是为了克服 LLMs 应用仅依赖其训练数据的局限性,使其能够访问所需的上下文信息,并执行更广泛的任务。</span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32m23do">该协议通过定义一套通用的规则和格式,使得 LLMs 应用可以在需要时动态地获取相关信息和执行操作,从而增强其功能和应用范围。</span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32mh49"><img class="rich_pages wxw-img" data-ratio="0.562962962962963" data-type="png" data-w="1080" data-imgfileid="100039525" style="height: auto !important;" src="/upload/6c8631a0f17001891e9ce30d61c6614d.png"></span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;" data-mpa-action-id="m93003o81zbx"><span mpa-font-style="m93003o2x2q" style="font-size: 10px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="color: rgb(136, 136, 136);">图片来源:</span></span><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="color: rgb(136, 136, 136);">https://norahsakal.com/blog/mcp-vs-api-model-context-protocol-explained/</span></span></span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32m1syp"><span textstyle="" style="color: rgb(255, 104, 39);font-weight: bold;">说人话:</span>就是一个让 AI&nbsp;</span><span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32mix4"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;>大模型连接万物,理解和使用外部信息和工具的统一标准。</span></span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32moje"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;>就好比你的电脑连接外部设备,一般通过 USB 接口这个标准一样。<span textstyle="" style="font-weight: bold;">&nbsp;AI 大模型想连接其它软件、工具,可以使用 MCP 这个标准。</span></span></span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32m1say"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="font-weight: bold;">举个例子吧。</span></span></span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32m1n5k"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;>比如</span></span><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32my7b">你有一个很厉害的大模型,比如 ChatGPT,但它只能回答基于自己学过的知识(比如 2023 年之前的酒店和航班信息)。现在你想让它帮你规划</span><strong style="font-size: 14px;" mpa-font-style="m92zz32m1g5e"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;>下周去巴黎的行程</span></strong><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32m17y7">,但它不知道最新的机票价格、酒店空房情况,也无法直接帮你订票。</span></p> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32mhx4">这时候,可以<span textstyle="" style="font-weight: bold;">通过 MCP 这个规范让</span></span><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32m1iqu"><span textstyle="" style="font-weight: bold;">&nbsp;AI 大模型接入携程、高德地图等等软件</span>(前提是这个软件支持通过 MCP 规范调用,有 MCP Server),这样它就能查实时数据,拉取最新的酒店价格和空房信息。</span></p> <section style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 32px;"> <strong style="font-size: 14px;" mpa-font-style="m92zz32m13lk"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;>调用支付接口订票,最后把结果整理成你能看懂的回答。</span></strong> </section> <h1 class="js_darkmode__0" data-pm-slice="0 0 []" style="-webkit-tap-highlight-color: transparent;margin: 8px 8px -2px;padding: 0px;outline: 0px;font-weight: 700;font-size: 32px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-family: Futura-Medium;color: rgb(255, 104, 39);background-color: rgb(255, 255, 255);letter-spacing: 1px;visibility: visible;"><span leaf="" style="-webkit-tap-highlight-color: transparent;margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;visibility: visible;">3万人 Star!</span></h1> <p class="js_darkmode__1" style="-webkit-tap-highlight-color: transparent;margin: 0px 8px 24px;padding: 0px;outline: 0px;max-width: 100%;clear: both;min-height: 1em;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, " system-ui, helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;background-color: rgb(255, 255, 255);visibility: visible;box-sizing: border-box !important;overflow-wrap: break-word !important;><span style="-webkit-tap-highlight-color: transparent;margin-top: 0px;margin-right: 0px;margin-left: 0px;padding: 0px;outline: 0px;max-width: 100%;color: black;font-family: Futura-Medium;font-size: 17px;font-weight: bolder;letter-spacing: 0.544px;visibility: visible;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf="" style="-webkit-tap-highlight-color: transparent;margin-top: 0px;margin-right: 0px;margin-left: 0px;padding: 0px;outline: 0px;max-width: 100%;visibility: visible;box-sizing: border-box !important;overflow-wrap: break-word !important;">超火的 MCP Server 列表</span></span></p> <p data-pm-slice="0 0 []" style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32mpc6">在逛 GitHub 的时候,发现了一个<span textstyle="" style="font-weight: bold;">超过 3W 人 Star 的开源项目,这是一个 MCP Server 盘点列表,</span></span><span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32m1uu5"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="font-weight: bold;">热度还在极速攀升。</span></span></span></p> <section style="color: rgba(0, 0, 0, 0.9);font-size: 17px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;line-height: 2em;letter-spacing: 0.034em;font-style: normal;font-weight: normal;margin-left: 8px;margin-right: 8px;margin-bottom: 16px; nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="0.562962962962963" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="100039523" style="height: auto !important;" src="/upload/fcf36ecce98d307e246f7b91bafb2e47.png"> </section> <section> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="javascript"><code><span leaf="">开源地址:<span class="code-snippet__attr">https</span>:<span class="code-snippet__comment">//github.com/punkpeye/awesome-mcp-servers</span></span></code></pre> </section> </section> <section style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"> <span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32mq6e"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;>这个开源项目<span textstyle="" style="font-weight: bold;">系统整理了 30</span></span></span><strong style="font-size: 14px;" mpa-font-style="m92zz32m9f1"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="font-weight: bold;">00+ 可以接入使用的 MCP Server,覆盖浏览器自动化、搜索、金融、游戏、安全、科研等&nbsp;</span></span></strong><strong style="font-size: 14px;" mpa-font-style="m92zz32m90n"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="font-weight: bold;">20+ 垂直领域,</span>包括本地和基于云服务的。</span></strong> </section> <section style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"> <strong style="font-size: 14px;" mpa-font-style="m92zz32m90n"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-size: 14px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; mpa-font-style="m92zz32mosm" data-pm-slice="1 1 [" para,{tagname:p,attributes:{style:margin-left: 8px; margin-right: line-height: 2em; margin-bottom: 16px;},namespaceuri:http: www.w3.org 1999 xhtml}]>我挑几个介绍一下。</span></strong> </section> <section style="color: rgba(0, 0, 0, 0.9);font-size: 17px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;line-height: 2em;letter-spacing: 0.034em;font-style: normal;font-weight: normal;margin-left: 8px;margin-right: 8px;margin-bottom: 16px;text-align: center; nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="3.2186234817813766" data-s="300,640" data-type="png" data-w="494" style="width: 320px;height: auto !important;" type="block" data-imgfileid="100039532" src="/upload/03f010f0187ea5c60f21ffff269cb367.png"> </section> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;font-size: 17px;" mpa-font-style="m9302kxwmnt" data-mpa-action-id="m9302ky61l0r" data-pm-slice="0 0 []"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="color: rgb(255, 104, 39);font-weight: bold;">① 浏览器自动化</span></span></p> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32m13bn"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;>MCP-Playwright &nbsp;这个 MCP 服务器,通过<span textstyle="" style="font-weight: bold;">提供浏览器自动化能力</span>,使 AI 大模型能够在真实浏览器环境中导航网页、执行点击/输入操作、截取屏幕截图以及运行 JavaScript</span></span></p> <section style="color: rgba(0, 0, 0, 0.9);font-size: 17px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;line-height: 2em;letter-spacing: 0.034em;font-style: normal;font-weight: normal;margin-left: 8px;margin-right: 8px;margin-bottom: 16px; nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="0.9916666666666667" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="100039527" style="height: auto !important;" src="/upload/ae1015c0970e1d7671ed0a416ea93e0f.png"> </section> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="javascript"><code><span leaf="">开源地址:<span class="code-snippet__attr">https</span>:<span class="code-snippet__comment">//github.com/executeautomation/mcp-playwright</span></span></code></pre> </section> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;font-size: 17px;" mpa-font-style="m9303040rma" data-mpa-action-id="m9303048222h" data-pm-slice="0 0 []"><span data-pm-slice="0 0 []" style=""><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="color: rgb(255, 104, 39);font-weight: bold;">② AI 解析内容生成摘要</span></span></span></p> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32n1kp1"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;>AI摘要生成MCP服务器,支持多种内容类型:纯文本、网页、PDF文档、EPUB电子书、HTML内容。</span></span></p> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32n1kp1"><span leaf=""><img class="rich_pages wxw-img" data-ratio="0.7" data-s="300,640" data-type="jpeg" data-w="1080" type="block" data-imgfileid="100039529" style="height: auto !important;" src="/upload/2e7fb3b64258456d313755289fd95679.png"></span></span></p> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="bash"><code><span leaf="">开源地址:https://github.com/0xshellming/mcp-summarizer</span></code></pre> </section> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;font-size: 17px;" mpa-font-style="m9303cyrqxk" data-mpa-action-id="m9303cyzxl5" data-pm-slice="0 0 []"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="color: rgb(255, 104, 39);font-weight: bold;">③ 管理 Notion</span></span></p> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32nu3u"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;>notion_mcp 这个 MCP Server, 可以链接 AI 大模型与 Notion 平台,支持自动化页面管理、内容同步、模板生成等等。</span></span></p> <section style="color: rgba(0, 0, 0, 0.9);font-size: 17px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;line-height: 2em;letter-spacing: 0.034em;font-style: normal;font-weight: normal;margin-left: 8px;margin-right: 8px;margin-bottom: 16px; nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="0.6287037037037037" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="100039531" style="height: auto !important;" src="/upload/c9a518ec613a1537950c6573c96f2b95.png"> </section> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="javascript"><code><span leaf="">开源地址:<span class="code-snippet__attr">https</span>:<span class="code-snippet__comment">//github.com/danhilse/notion_mcp</span></span></code><code><span leaf="">开源地址:<span class="code-snippet__attr">https</span>:<span class="code-snippet__comment">//github.com/suekou/mcp-notion-server</span></span></code></pre> </section> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;font-size: 17px;" mpa-font-style="m9303plf1bh8" data-mpa-action-id="m9303ploi36" data-pm-slice="0 0 []"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="color: rgb(255, 104, 39);font-weight: bold;">④ 地图 MCP Server</span></span></p> <section style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 8px;" data-mpa-action-id="m9306n1h1cis" data-pm-slice="0 0 []"> <span leaf="" mpa-font-style="m9306n1212lj" style="font-size: 14px;">高德、腾讯、百度地图,三家地图服务商都已经布局MCP Server,为AI大模型与地图服务的结合提供了便捷的接口。这个不在这个开源项目的列表中,是我觉得比较重要,列出来了。</span><span leaf=""><br></span> </section> <section style="text-align: center;margin-left: 8px;margin-right: 8px;" nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="0.35185185185185186" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="100039533" style="height: auto !important;" src="/upload/def622d440f69f08db1ab53e629d1859.png"> </section> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;font-size: 17px;" mpa-font-style="m9303plf1bh8" data-mpa-action-id="m9303ploi36" data-pm-slice="0 0 []"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;><span textstyle="" style="color: rgb(255, 104, 39);font-weight: bold;">⑤ 搜索 ArXiv 研究论文</span></span></p> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span data-pm-slice="0 0 []" style="font-size: 14px;" mpa-font-style="m92zz32n1i1f"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal;>arxiv-mcp-server 这个 MCP Server,专为 arXiv 学术论文库设计,允许 AI 模型通过编程接口搜索论文、下载内容并进行深度分析(如摘要提炼、方法评估和结果解读),同时支持本地存储以加速访问</span></span></p> <section style="color: rgba(0, 0, 0, 0.9);font-size: 17px;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;line-height: 2em;letter-spacing: 0.034em;font-style: normal;font-weight: normal;margin-left: 8px;margin-right: 8px;margin-bottom: 16px; nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="0.5444444444444444" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="100039530" style="height: auto !important;" src="/upload/86a118730a866511a0572d220a143e5a.png"> </section> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="javascript"><code><span leaf="">开源地址:<span class="code-snippet__attr">https</span>:<span class="code-snippet__comment">//github.com/blazickjp/arxiv-mcp-server</span></span></code></pre> </section> <p style="margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;"><span leaf="" style="color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.034em;font-style: normal;font-weight: normal; data-pm-slice="1 1 [" para,{tagname:p,attributes:{style:margin-left: 8px;margin-right: 8px;line-height: 2em;margin-bottom: 16px;font-size: 17px;,mpa-font-style:m9303plf1bh8,data-mpa-action-id:m9303ploi36,data-pm-slice:0 0 []},namespaceuri:http: www.w3.org 1999 xhtml}]><span textstyle="" style="color: rgb(255, 104, 39);font-weight: bold;">⑥ 更多</span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="0.6685185185185185" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="100039535" style="height: auto !important;" src="/upload/8b4d814cc61690e014c23cb2f319ad94.png"> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="0.6435185185185185" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="100039536" style="height: auto !important;" src="/upload/e67d02ae2b3f39d2efb603b57bb56591.png"> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="0.5203703703703704" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="100039537" style="height: auto !important;" src="/upload/fae811cb8ae721b5920fc70bf2c1b27a.png"> </section> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="javascript"><code><span leaf=""><span class="code-snippet__attr">https</span>:<span class="code-snippet__comment">//mcp.so/</span></span></code></pre> </section>

vivo Trace 监控追求极致的建设历程

作者:微信小助手

<section style="font-size: 15px;color: rgb(62, 62, 62);"> <section style="margin: 10px 0% 8px;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;width: 100%;border-left: 3px solid rgb(219, 219, 219);border-bottom-left-radius: 0px;padding-left: 8px;align-self: flex-start;"> <section style="color: rgba(0, 0, 0, 0.5);font-size: 14px;text-align: justify;width: 100%;"> <p>作者:vivo 互联网服务器团队- Zhang Yi</p> </section> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: left;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;color: rgb(160, 160, 160);"> <p>当前vivo的应用监控产品Vtrace经常遇到用户反馈某个Trace链路信息没法给他们提供到实质的帮肋,对此团队一直在持续完善JavaAgent的采集。经过不断增加各类插件的支持,同时想方设法去补全链路信息,但一直还是无法让用户满意。面对这样的困境,需要改变思路,从用户角度思考,在产品中找灵感。同时产品重新思考在应用监控中一条完整的Trace应该展现给用户哪些信息?业界其它产品对Trace的监控可以观测到什么程度?带着这些问题,Vtrace通过全面的同类产品对比分析,结合vivo实际情况自研Profile采集,从而开启涅槃之路。</p> </section> </section> </section> </section> <p><br></p> <p><strong>专业术语</strong></p> <section style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin-bottom: 10px;width: 100%;align-self: flex-start;background-color: rgb(250, 250, 250);border-style: solid;border-width: 0px 0px 0px 4px;border-color: rgb(48, 97, 207) rgb(48, 97, 207) rgb(48, 97, 207) rgb(65, 94, 255);padding: 19px;"> <section style="text-align: justify;font-size: 14px;width: 100%;"> <p>【Vtrace】:vivo应用监控系统,是一款vivo自研应用性能监控产品。</p> <p><br></p> <p>【Trace】:通常用于表示一系列相关的操作或事件,这些操作或事件通常跨越多个组件或服务,一个Trace可能由多个Span组成。</p> <p><br></p> <p>【Span】:属于Trace中的一个小部分,表示某个特定操作的时间跨度,比如执行一次查询SQL的记录。</p> <p><br></p> <p>【APM】:APM为Application Performance Monitoring 的缩写,意为应用性能监控。</p> <p><br></p> <p>【POC】:通常指的是 "Proof of Concept",即概念验证。在软件开发和信息技术领域,POC 是指为了验证某项技术、方法或想法的可行性而进行的实验或测试。在监控领域,一个监控POC通常指的是为了验证某个监控方案、工具或系统的可行性而进行的验证。</p> <p><br></p> <p>【Continuous Profiling】:持续剖析,有些厂商叫Continuing Profile或Profiler,也有人将Continuous Profiling和Trace、Metric、Log放在同一位置。总之是一种持续性的性能分析技术,它可以实时监测和记录程序的性能数据,以便开发人员可以随时了解程序的性能状况。这种技术可以帮助开发人员发现程序中的性能瓶颈和优化机会,从而改进程序的性能。通过持续性地监测程序的性能数据,开发人员可以更好地了解程序的行为和性能特征,从而更好地优化程序的性能。本文中Profile一般指持续剖析。</p> </section> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>一、背景</p> </section> </section> <p><br></p> <p>当前应用监控产品Vtrace中的Trace链路数据只串联了服务与服务,服务与组件之间的Span信息,但对于发生于服务内部方法具体执行耗时是无法监控的,即所谓监控盲区。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016801" data-ratio="0.22870370370370371" data-s="300,640" src="/upload/79b23861c5949518e5079f6bcfb3eb80.jpg" data-type="jpeg" data-w="1080" style=""></p> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;letter-spacing: 0.034em;">图1</span></p> <p><br></p> <p>图1为当前Vtrace系统的一个Trace信息,这个Trace显示内部没有任何其它组件,事实上真的如此么?先看看下面实际代码:</p> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="java"><code><span class="code-snippet_outer"><span class="code-snippet__meta">@GetMapping</span>(<span class="code-snippet__string">"/profile/test"</span>)</span></code><code><span class="code-snippet_outer"><span class="code-snippet__function"><span class="code-snippet__keyword">public</span> String <span class="code-snippet__title">testProfile</span><span class="code-snippet__params">()</span> </span>{</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__keyword">try</span> {</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__comment">//执行sleep方法</span></span></code><code><span class="code-snippet_outer"> doSleep();</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__comment">//执行查询MySQL,但方法使用synchronized修饰,多线程的时候会塞阻,同时查询SQL时一般会先获取数据库链接池</span></span></code><code><span class="code-snippet_outer"> synchronizedBlockBySelectMysql();</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__comment">//读取文件数据,并且将数据序列化转JSON</span></span></code><code><span class="code-snippet_outer"> readFileAndToJson();</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__comment">//发送数据到kafka</span></span></code><code><span class="code-snippet_outer"> sendKafka();</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__keyword">return</span> InetAddress.getLocalHost().getHostAddress();</span></code><code><span class="code-snippet_outer"> } <span class="code-snippet__keyword">catch</span> (Exception e) {</span></code><code><span class="code-snippet_outer"> log.error(<span class="code-snippet__string">"testProfile {}"</span>, e.getStackTrace());</span></code><code><span class="code-snippet_outer"> }</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__keyword">return</span> <span class="code-snippet__string">""</span>;</span></code><code><span class="code-snippet_outer"> }</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__function"><span class="code-snippet__keyword">private</span> <span class="code-snippet__keyword">void</span> <span class="code-snippet__title">doSleep</span><span class="code-snippet__params">()</span> <span class="code-snippet__keyword">throws</span> InterruptedException </span>{</span></code><code><span class="code-snippet_outer"> Thread.sleep(<span class="code-snippet__number">1000</span>);</span></code><code><span class="code-snippet_outer"> }</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__function"><span class="code-snippet__keyword">private</span> <span class="code-snippet__keyword">synchronized</span> <span class="code-snippet__keyword">void</span> <span class="code-snippet__title">synchronizedBlockBySelectMysql</span><span class="code-snippet__params">()</span> </span>{</span></code><code><span class="code-snippet_outer"> profileMapper.selectProfile();</span></code><code><span class="code-snippet_outer"> }</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__function"><span class="code-snippet__keyword">private</span> <span class="code-snippet__keyword">void</span> <span class="code-snippet__title">readFileAndToJson</span><span class="code-snippet__params">()</span> <span class="code-snippet__keyword">throws</span> InterruptedException </span>{</span></code><code><span class="code-snippet_outer"> String fileName = VivoConfigManager.getString(<span class="code-snippet__string">"profile.test.doc.path"</span>,<span class="code-snippet__string">"D:\\json1.json"</span>);</span></code><code><span class="code-snippet_outer"> StringBuilder builder = <span class="code-snippet__keyword">new</span> StringBuilder();</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__keyword">try</span> (BufferedReader br = <span class="code-snippet__keyword">new</span> BufferedReader(<span class="code-snippet__keyword">new</span> InputStreamReader(<span class="code-snippet__keyword">new</span> FileInputStream(fileName), <span class="code-snippet__string">"UTF-8"</span>))) {</span></code><code><span class="code-snippet_outer"> String line;</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__keyword">while</span> ((line = br.readLine()) != <span class="code-snippet__keyword">null</span>) {</span></code><code><span class="code-snippet_outer"> builder.append(line);</span></code><code><span class="code-snippet_outer"> }</span></code><code><span class="code-snippet_outer"> br.close();</span></code><code><span class="code-snippet_outer"> JSONArray jsonArray = JSON.parseArray(builder.toString());</span></code><code><span class="code-snippet_outer"> } <span class="code-snippet__keyword">catch</span> (Exception e) {</span></code><code><span class="code-snippet_outer"> log.error(<span class="code-snippet__string">"testProfile {}"</span>, e.getStackTrace());</span></code><code><span class="code-snippet_outer"> }</span></code><code><span class="code-snippet_outer"> }</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__function"><span class="code-snippet__keyword">private</span> <span class="code-snippet__keyword">void</span> <span class="code-snippet__title">sendKafka</span><span class="code-snippet__params">()</span> </span>{</span></code><code><span class="code-snippet_outer"> <span class="code-snippet__keyword">for</span> (<span class="code-snippet__keyword">int</span> i = <span class="code-snippet__number">0</span>; i &lt; <span class="code-snippet__number">5</span>; i++) {</span></code><code><span class="code-snippet_outer"> kafkaTemplate.send(topic, <span class="code-snippet__string">"{\"metricName\":\"java.profile.test\",\"id\":1,\"isCollect\":false}"</span>);</span></code><code><span class="code-snippet_outer"> }</span></code><code><span class="code-snippet_outer"> }</span></code></pre> </section> <p><br></p> <p>从上面的代码可以看出接口/profile/test的profileTest方法实际执行了四个私有方法:<span style="letter-spacing: 0.034em;"></span></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p>doSleep()方法,让程序休眠1秒</p></li> <li><p>synchronizedBlockBySelectMysql方法查询MySQL,但这个方法使用了synchronized修饰,多线程同时执行这个方法时会塞阻。另外查询MYSQL一般会使用连接池,这次测试的代码使用Hikari连接池</p></li> <li><p>readFileAndToJson方法读取文件数据并且将数据转JSON为JSONArray</p></li> <li><p>sendKafka方法主要是发送数据到Kafka</p></li> </ul> </section> </section> </section> <p><br></p> <p>但这四个方法在Vtrace系统中的Trace信息中什么都体现不了,JavaAgent并没有采集到相关信息。这恰好说明了这里存在监控盲区,并且盲区远比想象中的要大,某些场景中连最基本的MySQL执行的信息都看不到。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016802" data-ratio="0.1" data-s="300,640" src="/upload/df7b53893298c7933804533cae20279b.png" data-type="png" data-w="1080" style=""></p> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">图2</span></p> <p><br></p> <p>对于图1那种情况在实际中会经常遇到,用户会发现Trace中没有他想要的信息。有时会像图2中那样有几个组件的Span,但整个Trace中依然存在一大片空白的地方,不知道具体的代码执行情况。</p> <p><br></p> <p>针对上述的场景,为了让用户通过Trace获取更多有用信息,后续需要做的有两件事:</p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p>支持对更多组件的埋点采集</p></li> <li><p>针对Trace进行方法调用栈的采集</p></li> </ul> </section> </section> </section> <p><br></p> <p>而本文主要从下面几个角度论述我们如何改变当前Vtrace的<strong>现状</strong>:</p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p><strong>同类产品对比分析</strong>:通过SkyWalking、DataDog和Dynatrace三款产品的Trace观测程度对比分析,从产品的视角去获得Vtrace的优化思路。</p><p><br></p></li> <li><p><strong>程序设计</strong>:通过同类的产品功能引入行业中Continuous Profiling概念,结合同类产品的技术实现情况设计Vtrace JavaAgent对方法调用栈采集的技术方案。</p><p><br></p></li> <li><p><strong>压测分析</strong>:针对在JavaAgent增加方法调用栈采集之后进行压测,评估出JavaAgent改进后的资源影响,并且分析出资源消耗增加的根因与确定后续持续优化的方向。</p><p><br></p></li> <li><p><strong>落地评估</strong>:通过当前已经接入Vtrace产品的服务情况与JavaAgent压测结果去分析Vtrace的方法调用栈采集功能如何落地。</p></li> </ul> </section> </section> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="padding-right: 1em;padding-left: 1em;display: inline-block;text-align: center;"> <span title="" style="padding: 0.3em 0.5em;display: inline-block;border-radius: 0.5em;font-size: 13px;text-shadow: rgb(204, 204, 204) 4px 3px;color: rgb(65, 95, 255);"><p>彩蛋提醒</p></span> </section> <section style="margin-top: -1em;padding: 20px 10px 10px;border-width: 1px;border-style: solid;border-color: rgb(192, 200, 209);background-color: rgb(239, 239, 239);text-align: center;"> <p>我们为大家准备了抽奖福利,请继续阅读下去。</p> </section> </section> <p style="margin-bottom: 0px;"><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>二、同类产品对比分析</p> </section> </section> <p><br></p> <p>在设计JavaAgent方法调用栈监控采集前,先看看业界的监控同类产品对Trace的分析能够做到何种程度。</p> <p><br></p> <p>下面我们使用SkyWalking、DataDag和Dynatrace三款同类产品,对上面/profile/test接口进行监控分析。通过对同类产品监控情况的分析会给我们带来一些启发,同类产品的一些优秀设计思路也会有助于我们完善的Vtrace产品。</p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">2.1 Apache SkyWalking</span></p> <p><br></p> <p>Apache SkyWalking是一款优秀的开源应用性能监控产品,Vtrace的JavaAgent就是基于早期的SkyWalking 3.X版本开发的。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016803" data-ratio="0.4527777777777778" data-s="300,640" src="/upload/eeeebb922aed097f9f193984c3246f08.png" data-type="png" data-w="1080" style=""></p> <section> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">图3</span></p> <p><br></p> <p>上图为/profile/test接口在SkyWalking的trace信息,显然可以看出请求中访问MySQL与Kafka,其中SQL的执行时间大约为2秒(图3中的MySQL/JDBC/PrepardStatement/execute为实际执行SQL的Span)。同时使用Hikari链接池工具获取数据库链接的信息也记录了,这个记录很有用,如果数据库链接池满了,一些线程可能一直在等待数据库链接池释放,在某些情况下很可能是用户数据库链接池配置少了。</p> <p><br></p> <p>相对于Vtrace系统的trace信息,显然SkyWalking观测能力强了不少,但依然存在doSleep与readFileAndToJson这两个方法没有观测到。</p> <p><br></p> <p>对于这种情况,想到了SkyWalking的性能剖析功能,那再利用性能剖析看看能不能分析出doSleep与readFileAndToJson这两个方法。</p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016804" data-ratio="1.3185840707964602" data-s="300,640" src="/upload/a5a5afd6abba81ccff862916476b7fb5.png" data-type="png" data-w="452" style=""></p> <section> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">图4</span></p> <p><br></p> <p>图4是SkyWalking对/profile/test接口配置性能剖析的交互,这里可以配置端点名称、监控的持续时间,监控间隔以及采集的最大样本数。而监控间隔配置的越小采集到的数据会越精确,同时对服务端的性能影响则越大。</p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016805" data-ratio="0.9277777777777778" data-s="300,640" src="/upload/592523e571714c37457823590a4d6915.png" data-type="png" data-w="1080" style=""></p> <section> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">图5</span></p> <p><br></p> <p>配置好性能剖析规则后,再次发出/profile/test请求。等待了一段时间,从图5中可以看到doSleep和synchronizedBlockBySelectMysql方法的执行情况。</p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016806" data-ratio="0.26296296296296295" data-s="300,640" src="/upload/2c85e60666b544722beb263dba8c19bc.png" data-type="png" data-w="1080" style=""></p> <section> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">图6</span></p> <p><br></p> <p>关于synchronizedBlockBySelectMysql方法的,如果是执行sql耗时,采集到的应该如图6左侧那样看到的是正在执行SQL的socketRead0方法,而这里显示的是synchronizedBlockBySelectMysql这个代码块,即性能剖析时SkyWalking采集到的数据方法栈的栈项为</p> <p>synchronizedBlockBySelectMysql,这里由于synchronized的修饰在执行SQL前需要等待别的线程释放整个方法块。</p> <p><br></p> <p>从上述可以看出SkyWalking显然对profileTest方法能很有效地分析,但存在一个问题就是性能剖析不能自动持续分析,需要用户手动开启,遇到难以复现的情况时不好回溯分析。</p> <p><br></p> <p>虽然SkyWalking持续剖析存在这一点小瑕疵,但我们不得不承认Skywalking对Trace的分析还是挺强大的。Vtrace的JavaAgent是在SkyWalking3.X版本的基础上实现的,而SkyWalking成为Apache项目后经过这几年的持续迭代已经发展到10.X版本了。对比我们Vtrace JavaAgent,显然SkyWalking的进步巨大。</p> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">2.2 DataDog</span></p> <p><br></p> <p>与开源的SkyWalking不同,DataDog是一款商用可观测软件,在Gartner可观测排名靠前。接下来我们使用DataDog去分析刚才的/profile/test接口。</p> <p><br></p> <section> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016807" data-ratio="0.5601851851851852" data-s="300,640" src="/upload/4a4d54d56faf8f58eaaca9b02c94ad8c.png" data-type="png" data-w="1080" style=""></p> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">图7</span></p> <p><br></p> <p>图7是使用DataDog采集到/profile/test接口Trace数据,明显可以看出:<span style="letter-spacing: 0.034em;"></span></p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p>MySQL组件与Kafka组件的执行耗时</p></li> <li><p>整个Trace的Safepoint和GC占用时间</p></li> </ul> </section> </section> </section> <p><br></p> <section> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016808" data-ratio="0.6259259259259259" data-s="300,640" src="/upload/2f126800771b5cf2f16ce2502462b057.png" data-type="png" data-w="1080" style=""></p> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">图8</span></p> <p><br></p> <p>图8为本次trace的火焰图,从图中可以看到readFileAndTojson这个方法热点。</p> <p><br></p> <p>从DataDog的Trace信息中我们可以看出DataDog也能直接发现MySQL与kafka组件,同时提供这次trace的火焰图,从火焰图中能够看出readFileAndTojson方法执行。但doSleep方法与synchronizedBlockBySelectMysql方法关键字synchronized同步等待的时间没被观测到。</p> <p><br></p> <p>不过感觉到意外的是可以在DataDog中看到这次trace的Safepoint和GC占用时间,这样用户可以分析出该Trace是否受到Safepoint和GC影响。</p> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">2.3 Dynatrace</span></p> <p><br></p> <p>Dynatrace也是一款商用可观测产品,Gartner可观测排名常年第一,技术上遥遥领先。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016809" data-ratio="0.4546296296296296" data-s="300,640" src="/upload/5a93ca57bf03198d1a79a18aea5f24bd.png" data-type="png" data-w="1080" style=""></p> <section> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">图9</span></p> <p><br></p> <p>图9为/profile/test接口在Dyantrace中的一个Trace信息,图中左侧红框可以直接看到MySQL和Kafka组件,中间红框是这次trace的线程整体时间分布情况,包括CPU时间,Suspension挂起时间,还有Waiting、Locking、Disk I/O和网络I/O ,为了方便大家理解深层的性能特征他们用不同的颜色区分,具体说明如下:</p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016810" data-ratio="0.4645161290322581" data-s="300,640" src="/upload/15b82bb65a4e2b7308c5afd012d487f3.jpg" data-type="jpeg" data-w="930" style=""></p> <section> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">表1</span></p> <p><br></p> <p>从图9右边红色框框的可以看到这个Trace整个生命周期的线程各个阶段的分布,再点击“View method hotspots”,则本次trace的方法热点如下图图10所示:</p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016811" data-ratio="0.4861111111111111" data-s="300,640" src="/upload/54ce17deeda6e5a3b69c950c6aeed356.png" data-type="png" data-w="1080" style=""></p> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">图10</span></p> <p><br></p> <p>看到图10的内容非常惊讶,源代码中的四个私有方法全部被观测到,四个方法底层的实质也显露出来,具体如下:</p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p>发现doSleep与sendKafka这两个方法,并且他们的操作主要是在Waiting。</p></li> <li><p>synchronizedBlockBySelectMysql方法图中浅蓝色部分显示他在Locking,等待着别的线程执行完synchronized修饰的方法;后半段粉色部分为查询MySQL的IO操作,细分为Network I/O。</p></li> <li><p>readFileAndToJson方法中有一段紫色的部分 ,那是在读取文件的IO操作,分类为Disk I/O,而同时读取文件与将文件中的内容转换为JSON也是这次Trace消耗CPU的主要代码。</p></li> </ul> </section> </section> </section> <p><br></p> <p>上面除了整个Trace的方法热点的总览信息,还可以下钻进入每个方法再深度分析。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016812" data-ratio="0.412962962962963" data-s="300,640" src="/upload/bd4f49e7b77c1e54ce98a0f55296681e.png" data-type="png" data-w="1080" style=""></p> <section> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">图11</span></p> <p><br></p> <p>图11是展开doSleep与sendKafka两个Waiting方法分析,可以明显看出doSleep方法实际上底层耗费在Thread.sleep,而sendKafka方法的Waiting是Kafka底层工具类SystimeTime.waitObject中执行更底层的Object.wait。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016813" data-ratio="0.48333333333333334" data-s="300,640" src="/upload/7f8774b8e385287873740b32feb421ff.png" data-type="png" data-w="1080" style=""></p> </section> <section> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">图12</span></p> <p><br></p> <p>图12为选定”Code execution“后再展开readFileAndToJson方法,这里两处主要耗费CPU的操作,一个是JSON.parseArray,一个是BufferedReader.readLine。</p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016814" data-ratio="0.4685185185185185" data-s="300,640" src="/upload/e5863d44a1c9804baa0be3ae706b3fb9.png" data-type="png" data-w="1080" style=""></p> <section> <p style="text-align: center;"><span style="font-size: 14px;">图13</span></p> <p><br></p> <p>除了方法热点分析,Dynatrace还提供了”Code level“的分析,从图13中可看到Hikari链接池的获取情况。</p> <p><br></p> <p>从结果上来看,Dynatrace的观测能力果然遥遥领先,他的观测能力不是仅仅简单告诉用户每个地方的执行耗时,他告诉用户代码执行情况的同时让用户更好地了解程序每个行为的底层原理和性能特征。</p> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">2.4 分析总结</span></p> <p><br></p> <p>在完成上述三个产品的Trace分析后,结合当前Vtrace产品,做了一些对比:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016815" data-ratio="0.4792671166827387" data-s="300,640" src="/upload/4a9b8b90a26c8955f19d2adb1d027c6c.jpg" data-type="jpeg" data-w="1037" style=""></p> <section> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">表2</span></p> <p><br></p> <p>通过同类产品对比分析发现当前Vtrace整体功能与业界领先的产品比较显得相对落后。另外,业界优秀的产品还有很多,而我们选择SkyWalking、DataDog和Dynatrace因为他们具有一定的典型性和代表性。而对于上述的三款产品,本文产品分析只是针对Trace链路的观测能力来测试来比较。</p> <p><br></p> <p>最初在考虑如何完善我们的Trace链路,我们的计划是参考新版SkyWalking的Profile功能,所以当时的同类产品分析只选SkyWalking,而/profile/test接口的四个私有方法也是提前就设计好的。</p> <p><br></p> <p>但在做设计评审时,发现只基于一个开源产品的能力去设计,最后可能得出的方案会是片面的。考虑到不同产品的Trace信息呈现会有所不同,于是我们决定再找一些同类的商用产品来对比分析。而同类产品Trace呈现出来的信息涉及数据采集,我们需要分析产品能力的同时也要去了解同行的采集技术方案。</p> <p><br></p> <p>因为曾经主导过一个可观测项目,邀请了国内外的主要APM厂商来企业内部私有化部署产品,用了长达半年多的时间对大概10款产品进行POC测试,大部分产品的Trace信息展示是差不多的,而当时很多产品的Trace观测能力并不比现在的SkyWalking会好。同时,简单看了当前一些国内大厂可观测产品Trace的交互后,为了避免同质化,便选择了当时POC没法私有化部署的DataDog与POC测试时效果远超同行的Dynatrace。</p> <p><br></p> <p>由于/profile/test接口的四个私有方法是在SkyWalking测试前就已经设计好的,所以在要把DataDog和Dynatrace加入测试时并不知道这两款产品会呈现出什么样的实际效果。现在都知道DataDog和Dynatrace的测试结果,这两个产品的Trace中都有出乎意料的重要信息,这带给我们不少启发。</p> <p><br></p> <p>本节最后说些题外话,相信国内很多大厂都有自己的可观测产品或者正在使用一些其它厂商可观测产品,你们可以将/profile/test接口的代码用你们现在使用的监控产品测试一下,看看你们的Trace能观测到什么,如果有一些意外的发现,不防联系我们,大家一起相互学习学习。</p> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>三、程序设计</p> </section> </section> <p><br></p> <section> <p>通过同类产品的对比分析,为了让我们的Trace信息更完整,第一件事是需要完善组件。同时同类产品可以观测到更多有用的信息,所以第二件事我们需要知道这些信息同类产品是如何采集的。另外也不能只顾着单一完善Trace信息而设计 ,设计上需要考虑后续的整体规划。</p> <p><br></p> <p>随着对同类产品的深入了解知道同类产品使用了一种叫Continuous Profiling技术手段,通过这种手段他们才有如此丰富Trace信息。比如DataDog的火焰图和Dynatrace的方法热点正是这技术手段的体现。同时在他们产品中Continuous Profiling有明确的定位,常见有下面四个功能:</p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p><strong>CPU Profiling</strong>:深入了解进程的方法热点,按代码执行、网络 I/O、磁盘 I/O、锁定时间和等待时间分解和过滤数据,常见的火焰图正是CPU Profiling的产品体现。</p><p><br></p></li> <li><p><strong>Memory Profiling</strong>:内存分析可以了解应用程序随时间变化的内存分配和垃圾回收行为,识别分配了最多内存的上下文中的方法调用,并将此信息与分配的对象数量相结合。</p><p><br></p></li> <li><p><strong>Memory Dump Aalysis</strong>:通过进程的内存使用进行dump并分析。</p></li> </ul> <p><br></p> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p><strong>Continuous Thread Analysis</strong>:对线程持续分析,主要是后台线程组,记录每个线程各个时间段的线程状态以及资源使用情况。</p></li> </ul> </section> </section> </section> <p><br></p> <p>不难看出上述功能在很多同类产品都有,比如Vtrace现在利用Vivo运维工具实现了CPU Profiling、Memory Profiling以及Memory Dump Analysis。但是Vtrace的CPU Profiling与Memory Profiling并不是持续的,需要用户手动触发,每次最多只能剖析5分钟。后续我们会慢慢实现或优化Continuous Profiling的各个功能,而现在Vtrace系统是借助CPU Profiling的技术手段去完善每个Trace的方法调用栈信息。</p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">3.1 方案选择</span></p> <p><br></p> <p>在分析SkyWalking、DataDog和Dynatrace是如何实现他们的Profile信息采集前,我们先看看Java应用在业界主流实现CPU profling的技术方案:<strong>JMX 、JFR 和 JVMTI AsyncGetCallTrace。</strong></p> <p><br></p> <p><strong>(1)JMX</strong></p> <p>Java Management Extensions(JMX)是Java平台上的一种管理和监控技术,它允许开发人员在运行时监视和管理Java应用程序,一般使用ThreadMXBean中的dumpAllThreads可以获取当前线程执行的方法栈情况,利用每次获得的线程调用栈栈帧信息,可以实现方法热点的监测。</p> <p><br></p> <p><strong>(2)JFR</strong></p> <p>Java Flight Recorder(JFR)是Java平台上的一种性能监控和故障诊断工具,JFR的特点包括低性能开销、低停顿、持续监控、动态配置和丰富的数据。它可以在应用程序运行时收集性能数据,而几乎不会对应用程序的性能产生影响。但JFR的支持对Java版本有一定的要求。</p> <p><br></p> <p><strong>(3)&nbsp;JVMTI AsyncGetCallTrace</strong></p> <p>AsyncGetCallTrace是JVMTI中的一个非标函数,用于异步获取线程的调用堆栈信息。使用AsyncGetCallTrace,开发人员可以在应用程序运行时异步去获取线程的调用堆栈信息,且不会阻塞线程的执行。这对于性能分析和故障诊断非常有用,因为它允许开发人员在不影响应用程序性能的情况下获取线程的调用堆栈信息,从而更好地了解应用程序的执行情况和性能特征。</p> <p><br></p> <p>上述三种方案便是实现CPU Profiling的主流方案,这三个方案在我们之前分析的三个产品中使用情况如下:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016816" data-ratio="0.4934823091247672" data-s="300,640" src="/upload/76620d24d735125cb43ec4ba913ae7bc.png" data-type="png" data-w="537" style=""></p> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">表3</span></p> <p><br></p> <section> <p>SkyWalking使用JMX实现性能剖析。他的实现是通过将采集到的Trace在JVM内部开启线程任务,线程任务通过segmentId绑定当前segmentId所在的线程,按照采集频率定时使用getStackTrace获取各个时段的调用栈信息。但它的设计并不是为了实现CPU Profiling,他只是一个补全Trace的链路分析快速实现,针对一些已知问题,常复现的问题,可以快速定位到根因。后续SkyWalking也不一定会使用上述三种方法实现Java语言的CPU profling。</p> <p><br></p> <p>DataDog最开始是用JFR实现CPU Profiling,后来结合开源工具Async-profiler,完善整个Continuous Profiling功能。Async-profiler实现完全基于JVMTI,其中它的CPU热力图就是得益于AsyncGetCallTrace接口。</p> <p><br></p> <p>Dynatrace是个异类,它做分布式Trace链路监控的时候,谷歌Dapper论文还要几年才出世,谷歌Dapper流行后,它已放弃了通过“-javaagent”指令的方式实现字节码增强,在java,.net,go,python等众多语言实现无需引用相应的agent即可深入监控代码级别的内部链路。它早期使用JavaAgent实现的产品AppMon可能使用过JMX实现CPU Profiling,10年前它改版后便完全基于JVMTI的AsyncGetCallTrace实现。</p> <p><br></p> <p>基于JFR或AsyncGetCallTrace实现CPU Profiling性能开销会低很多。我们vivo的每个人都追求极致的性能,在技术选型上更偏向性能好的方案。而从厂商DataDog已经从JFR转向通过结合Async-profile来实现整个Continuous Profiling,JFR可能并不是一个好选择,所以剩下AsyncGetCallTrace的实现方式。或许最终我们也会利用Async-profiler。</p> <p><br></p> <p>但是无论利用Async-profiler或者像Dynatrace一样独自去实现基于AsyncGetCallTrace采集,这对于我们监控团队来说都存在困难,因为我们团队缺少这方面的人力储备。如果我们选择基于AsyncGetCallTrace实现,要从零开始,需要学习c++与Async-profiler。这样整个研发周期会被拉得很长,短则至少三个月长则半年,同时有较大的不确定性,交付存在风险。</p> <p><br></p> <p>另外基于JMX实现的采集方案被认为性能不够好,但真正的性能损耗情况需要实践去检验。如果10ms和20ms的采集频率消耗资源太高,可以尝试降低采集频率。为了快速解决用户痛点,现阶段我们先选择基于JMX在Vtrace的JavaAgent中实现,在JavaAgent中实现后再基于压测情况决定后续落地方案。</p> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">3.2 基于JMX Profile采集设计</span></p> <p><br></p> <section> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016817" data-ratio="0.3398148148148148" data-s="300,640" src="/upload/8a80db0c0153de3ae65aa1fdb22bf5f7.png" data-type="png" data-w="1080" style=""></p> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">图14</span></p> <p><br></p> <p>事实上我们这次的设计并不是为了实现CPU Profiling,更多是为了补全Trace的信息。而对Trace的方法堆调用栈情况采集,我们基于JMX Profile设计如下:</p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ol class="list-paddingleft-1" style="list-style-type: decimal;"> <li><p>JavaAgent启动时,如图14所示开启一个采集频率 50ms Profile采集线程,当然这里采集频率用户是可以自行配置的。</p><p><br></p></li> <li><p>Trace进入时将traceId与当前trace线程id合并成一个traceSegmentId(基于SkyWalking 6以上实现的JavaAgent可以直接使用他们自身的traceSegmentId),同时将这traceSegmentId与当前线程Id绑定放到一个叫TRACE_PROFILE_MAP(Map)的集合中。TRACE_PROFILE_MAP除了记录traceSegmentId和线程id,同时会记录后续被Profile线程采集到的快照。</p><p><br></p></li> <li><p>Profile数据采集的线程会定时将TRACE_PROFILE_MAP集合当前的所有线程id通过ThreadMXBean.getThreadInfo获得每个线程当前栈帧信息。记录当前栈帧顶部信息并按照我们设置的深度保留栈帧的一些信息当作本次快照。如果这个trace线程下一次被采集的栈帧顶部信息与栈深度与这次一样,我们不需要记录本次快照,只需将上次快照出现的次数+1,如图14中栈顶为Thread.sleep的快照被我们记录了4次。如果相邻的两次采集栈帧顶部信息不一样,我们则记录两次快照信息,如图14对于这个trace我们最后记录了栈顶为Object.wait的快照3次。</p><p><br></p></li> <li><p>trace结束时,先根据traceSegmentId获取到本次trace采集到的Profile快照数据,然后交给后续Profile数据上报线程异步处理,同时将TRACE_PROFILE集合记录当前trace线程的相关数据从集合中移除。</p><p><br></p></li> <li><p>如果这个trace是使用到多线程会整个trace会多个不同的traceSegmentId,每个异步线程的相关Profile数据也会被采集到。</p></li> </ol> </section> </section> </section> <p><br></p> <p>从流程上来看,基于JMX实现CPU profiling采集确实简单,但也可以看出定时采样的方式本身的缺陷,如图11中readFileToJson方法中显示的采集频率太大两次采样会中间的读取文件的Disk I/O会被忽略,但这也是无法避免的,用其它技术方案来实现也一样会有这种问题。因此在实现Profile采集后,后续需要测试不同场景下不用采集频率对资源的利用情况,然后结合当前vivo服务的整体情况,再最终决定这个方案是否用于生产。</p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">3.3 基于AsyncGetCallTrace Profile采集设计</span></p> <p><br></p> <section> <p>虽然我们先尝试基于JMX的方式实现Profile采集,但不妨碍我们探讨别的实现方案,很可能后续团队能力起来后再转向基于AsyncGetCallTrace实现。</p> <p><br></p> <p>通过分析AsyncGetCallTrace源码与Async-Profiler的实现,发现基于AsyncGetCallTrace Profile的采集流程和上述流程相差不大,无非就是怎么触发采集,在Liunx系统一般使用信号量来触发,这也会大大地降低采集时的性能损耗。</p> <p><br></p> <p>有些操作系统不支持使用信号量来调用AsyncGetCallTrace函数,可能需要用c++实现一个不受JVM管理的线程,避免采集时受JVM SavePiont或GC的影响。</p> <p><br></p> <p>另外并不是所有操作系统的JVM中都提供AsyncGetCallTrace这个函数。</p> <p><br></p> <p>上述基于AsyncGetCallTrace的采集设计只是通过简单的一些了解而设想的,并不一定正确,欢迎指正。</p> <p><br></p> <p>后续如果我们完全实现了基于AsyncGetCallTrace Profile采集我们再向大家介绍实现的细节。</p> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">3.4 存储设计</span></p> <p><br></p> <section> <p>介绍了Profile数据的采集设计,接下来聊一下存储设计。</p> <p><br></p> <p>一个时间跨度为1秒的Trace,在采集频率为50ms时最多可能会被采集到10个副本。假设Profile采集记录stack深度为20,一份快照信息大约1KB,这样的话每个Trace最多可能需要增加10KB的存储。如果记录stack深度为100时快照信息大小则6KB左右。</p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016818" data-ratio="0.36147186147186144" data-s="300,640" src="/upload/79fb012010547141386d1874c805ef7b.png" data-type="png" data-w="924" style=""></p> <section> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">图15</span></p> <p><br></p> <p>上图为我们Prfoile采集的一个快照文本内容,这个数据大约1kb。如果每个快照数据都这样存储,则会占用大量的存储。同一个接口不同Trace的Profile数据会存在大量相同的快照文本,相同的快照文本用同一个UID来保存。UID可以为快照文体的MD5值,每个UID只占16字节。后续在分析Trace信息时再将UID对应快照文本显示给用户,这样会节省大量的存储成本 。</p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016819" data-ratio="0.3074074074074074" data-s="300,640" src="/upload/fd8e75040ebd02d61ce771b5eef4d9a9.jpg" data-type="jpeg" data-w="1080" style=""></p> <section> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">图16</span></p> <p><br></p> <p>图16为Vtrace基于JMX实现Profile采集到数据,为了快速验采集的效果直接让采集到的快照数据作为Span存储。图中第一行数据为整个请求的trace耗时,而红色框中的则为这个在trace我们Profile采集线程采集到的调用栈信息,从结果来看把我们原先的一些监控盲区补上来了。这图的数据只是临时处理,实际后续产品交互并不会这样展示。</p> <p><br></p> <p>现在存在的问题就是Vtrace JavaAgent对所有Trace采集会整个服务的性能有哪些影响,而这些影响,是否在我们的接受范围内。我们需要对增加Profile采集后对JavaAgent进行压力测试,需要对比开启Profile采集与未开启Profile采集的性能指标差异。</p> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="padding-left: 1em;padding-right: 1em;display: inline-block;text-align: center;"> <span style="display: inline-block;padding: 0.3em 0.5em;border-radius: 0.5em;font-size: 13px;text-shadow: rgb(204, 204, 204) 4px 3px;color: rgb(65, 95, 255);" title=""><p>彩蛋提醒</p></span> </section> <section style="border-width: 1px;border-style: solid;border-color: rgb(192, 200, 209);margin-top: -1em;padding: 20px 10px 10px;background-color: rgb(239, 239, 239);text-align: center;"> <p>我们为大家准备了抽奖福利,请继续阅读下去。</p> </section> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>四、压测分析</p> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.1 测试设计</span></p> <p><br></p> <p>测试时需要考虑很多因素,因此在测试前先对测试做好设计,有以下的测试要点:</p> <section style="margin-top: 10px;margin-bottom: 10px;display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="width: 100%;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p>测试需要考虑环境,比如cpu核心数,容器或虚机,有条件最好使用物理机测试</p></li> <li><p>测试考虑不同采集频率时对性能的影响</p></li> <li><p>需要在不同TPS的情况下对比资源的消耗</p></li> <li><p>要考虑同一TPS下,IO不同的密集程度下资源消耗差异</p></li> </ul> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.2 测试结果</span></p> <p><br></p> <section> <p>测试的时候我们记录了很多指标,有很多数据,本文中就不一一展示了。Vtrace的Profile采集对应用性能的产生实质影响在这里我们只需考虑CPU使用和GC情况,因为采集增加的内存会侧面反映在GC情况中。</p> <p><br></p> <p>下面为不同场景下开启与不开启Profile持续剖析时的资源利用情况对比:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016820" data-ratio="0.487962962962963" data-s="300,640" src="/upload/6974f5badb2b82a618e75f3f1e33e4b6.png" data-type="png" data-w="1080" style=""></p> <p style="text-align: center;"><span style="letter-spacing: 0.034em;font-size: 14px;color: rgb(136, 136, 136);">表4</span></p> </section> <section> <p><br></p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p>上述场景中TPS小于等50时,GC次数很少,开启Profile采集对GC的影响相差不多。而开启Profile采集后对内存的影响主机体现在GC上。</p><p><br></p></li> <li><p>场景1与场景2、场景3与场景4、场景5与场景6三组采集频率不同的对比测试,可以看出Profile采集频率直接影响服务的资源消耗。</p><p><br></p></li> <li><p>随着测试TPS的上升,Profile采集消耗的资源也相应的增加,1000 TPS内,从容器与虚机,CPU 4核心时,开启Profile采集CPU消耗整体增加不高于5%; CPU 2核心时100 TPS内开启Profile采集CPU消耗整体增加不高于4%。</p></li> </ul> </section> </section> </section> <p><br></p> <section> <p>对于这个结果并不能说很理想,但又比预期要好一些,后续我们再结合我们当前应用的情况再分析是我们基于JMX实现的Profile是否可以投入生产使用。</p> <p><br></p> <p>而从上面的性能压测结果可以看出通过降低采集频率,CPU资源消耗有明显减少。但采集频率不宜过低,50ms对于大部分应用来说可以采集到很多有效的信息,这是我们的一个推荐值。</p> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.3 资源消耗增加原因</span></p> <p><br></p> <section> <p>在压力测试后我们知道开启Profile采集后CPU资源会有所增加,接下来需要确定导致资源消耗增加的地方有哪些。</p> <p><br></p> <p>为了找出根因,最初我们想使用Arthas来生成火焰图来分析,虽然这个场景应该也能分析出根因,但并不是很直观,分析过程不会很流畅。Arthas分析这个场景大概是这样的,在开启Profile采集前后分别生成火焰图,但这样没法直观地去对比出开启采集后额外增量的热点。同样针对线程分析,Arthas并没有将线程归类分组,显示了大量的http-nio-?-exec线程(?为线程ID)。后来我们再次想起了前提到的Dynatrace中的Cpu Profiling与Continuous thread analysis功能,后续可能我们也会去实现类似的功能,抱着学习下商业化产品的Continuous thread analysis功能,于是便使用Dynatrace来分析。</p> <p><br></p> <p>虽然这个场景可以直接使用Dynatrace的方法热点分析,但从进程到线程对比开启Profile采集前后指标,整个流程会更加顺畅,同时这样的排查思路与产品呈现会带来一些设计上的启发。</p> <p><br></p> </section> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016821" data-ratio="0.412962962962963" data-s="300,640" src="/upload/0760399f676062466c9480d71d358375.png" data-type="png" data-w="1080" style=""></p> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">图17</span></p> <p><br></p> <p>图17是流量相同的情况下,开启Profile采集前后指标的变化,从中可以看出:</p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p>整个java进程CPU变化从8.51%增加到12%</p></li> <li><p>后台线程CPU变化从4.81%增加到8.4%</p></li> <li><p>GC线程CPU变化从0.15%增加0.3%</p></li> </ul> </section> </section> </section> <p><br></p> <p>上述结论我们知道开启采集后导致进程CPU使用率增加的主要有后台线程和GC线程,GC线程略有增加主要还是采集时额外使用的内存增加导致,所以下面我们重点对后台线程分析,这里用到的便是Continuous thread analysis功能。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016822" data-ratio="0.5064814814814815" data-s="300,640" src="/upload/a53aa2226cec2d9acfcd7642aba69915.png" data-type="png" data-w="1080" style=""></p> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">图18</span></p> <p><br></p> <p>图18为开启Profile采集后的后台线程分析,展示了某段时间内主要所有后台线程组的运行情况,我们可以看出增加的两个进程组正好是我们的Profile采集线程与Profile数据发送线程,而Profile采集线程的奉献度占比远大于Profile数据发送线程。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016823" data-ratio="0.34444444444444444" data-s="300,640" src="/upload/fb6e64fb2cea120544fa018c6b59662e.png" data-type="png" data-w="1080" style=""></p> <section> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">图19</span></p> <p><br></p> <p>针对Profile采集线程我们再深入这个线程一段时间内的方法热点去看,从图19的结果上看Profile采集线程消耗CPU主要在调用JVMTI方法(ThreadImpl.getThreadInfo1)获取当前线程的信息。</p> <p><br></p> <p>对这个判断有点怀疑,认为线程信息采集到后处理调用栈的逻辑会有所消耗资源。对这个疑问,简单的方法可以先将Profile采集线程中调用ThreadImpl.getThreadInfo1方法之后的所有代码注释然后压力测试。接着加上线程栈数据处理的代码同时注释Profile采集发送的代码,然后再在同样的条件下压测,之后再对比两次压测的性能差异。当然也可以使用Arthas来生成火焰图分析,但我们并不是这样做的,明显有更加直观的办法,可以看看下面的Profile采集伪代码:</p> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="cs"><code><span class="code-snippet_outer"><span class="code-snippet__comment">//第1步,记录当前Profile采线程cpu使用时间。getCpuTime实际是直接调用ThreadMXBean的getCurrentThreadCpuTime</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">long</span> cpuTime = ThreadProvider.INSTANCE.getCurrentThreadCpuTime();</span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment">//第2步,获取线程集合的stackTrace信息。ids为当前正在执行的trace的线程ID集合,MAX_TACK_DEPTH为采集stackTrace的最大深度</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment">//ThreadProvider.INSTANCE.getThreadInfos实际是直接调用ThreadMXBean的getThreadInfos,底层最终是调ThreadImpl.getThreadInfo1</span></span></code><code><span class="code-snippet_outer">ThreadInfo[] threadInfos = ThreadProvider.INSTANCE.getThreadInfos(ids, MAX_TACK_DEPTH);</span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment">//第3步,计算第2步的程序执行CPU使用时间</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">long</span> threadDumpCpuTime = ThreadProvider.INSTANCE.getCurrentThreadCpuTime() - cpuTime;</span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment">//第4步,线程数据threadInfos的处理逻辑</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">for</span> (ThreadInfo threadInfo : threadInfos) {</span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment">//获得单个线程StackTrace信息,后续处理代码省略</span></span></code><code><span class="code-snippet_outer">StackTraceElement[] stackTrace = threadInfo.getStackTrace();</span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">int</span> stackDepth = Math.min(stackTrace.length, MAX_TACK_DEPTH);</span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">for</span> (<span class="code-snippet__keyword">int</span> i = stackDepth - <span class="code-snippet__number">1</span>; i &gt; <span class="code-snippet__number">0</span>; i--) {</span></code><code><span class="code-snippet_outer"> StackTraceElement element = stackTrace[i];</span></code><code><span class="code-snippet_outer">}</span></code><code><span class="code-snippet_outer">……</span></code><code><span class="code-snippet_outer">}</span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment">//第5步,计算整个采集线程结束时CPU的使用时间以及ThreadMXBean的getThreadInfos消耗CPU的时间占比。之后我们对比threadDumpCpuTime与processCpuTime便可知道整个线程CPU消耗在哪里</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">long</span> processCpuTime = ThreadProvider.INSTANCE.getCurrentThreadCpuTime() - cpuTime;</span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">float</span> threadDumpCost = threadDumpCpuTime * <span class="code-snippet__number">1.0f</span> / processCpuTime * <span class="code-snippet__number">100</span></span></code></pre> </section> <p><br></p> </section> <section> <p>通过上述代码测试后发现第4步的代码确实上也会有一些消耗,但几乎99%以上都是消耗在第2步中。而Dynatrace显示ThreadImpl.getThreadInfo1占比为100%,这是因为Dynatrace的Profiiling功能一样也是有采样频率的,只是时间段内采集到的样本全部显示Profile采集线程获得CPU时间片的方法是ThreadImpl.getThreadInfo1,而这个测试恰好印证了Dynatrace方法热点的准确性。</p> <p><br></p> <p>而对于JMX中的ThreadImpl.getThreadInfo1,这是一个native方法,是无法直接优化的,只能等后续我们有能力基于AsyncGetCallTrace去实现Profile采集再解决。</p> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.4 压测小结</span></p> <p><br></p> <p>通过本次压力测试,我们清楚了基于JMX实现的Profile采集的性能消耗大致情况,也知道了性能瓶颈在哪里以及后续的优化方向。</p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>五、落地评估</p> </section> </section> <p><br></p> <p>接下来我们需要分析当前接入Vtrace产品vivo服务的情况,后面基于上面的测试结果与现状去评估我们Profile采集能否最终落地。</p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.1 当前vivo服务情况</span></p> <p><br></p> <p>目前接入Vtrace的2500+个服务中有200多个服务他们实例的平均TPS大于100 ,而单实例平均TPS小于100的服务占91.2%。下面表格中的数据是基于工作日某一分钟统计得出的当前Vtrace所有服务实例平均TPS值的分布情况:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016824" data-ratio="0.08484162895927602" data-s="300,640" src="/upload/b1acd3b2a3d536920dc9d97fa833833f.png" data-type="png" data-w="884" style=""></p> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">表5</span></p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.2 落地分析</span></p> <p><br></p> <section> <p>通过上表可以看出vivo当前服务的情况,我们之前的测试结果表明在2c4g和4c8g的机器上服务TPS为20时 Profile采集频率设置50ms,cpu消耗增加1%不到。而我们约75%的服务TPS小于20,也就是说这些服务如果愿意接受1%的CPU资源消耗,基于JMX的Profile采集也能服务到大量的用户。</p> <p><br></p> <p>对于TPS大于100的服务,如果只是某些固定接口需要排查,可以通过配置对需要Profile采集的接口进行过滤,这样可以扩大落地的范围。</p> <p><br></p> <p>因为考虑压力测试的测试场景覆盖场景有限,我们会更谨慎一些,先完善一下Profile采集保护机制,后面一些服务中试点再逐步铺开。如果TPS小于20的服务顺利展开,之后再考虑覆盖TPS在20以上到100之间的服务。TPS超100的服务可以针对需要分析的接口开启Profile采集。至于所有服务全量采集覆盖可能需要等于我们攻克基于AsyncGetCallTrace的采集设计之后。</p> <p><br></p> <p>很多大型企业可能和vivo差不多,大部分90%以上的服务单个实例TPS在100之内。而传统企业TPS小于100的占比则更高,如果是制造业的话可能90%的服务TPS不到20。不过很多企业部署方式与vivo不同,他们可能在一个8c16g的机器上部署好几个服务实例,这样的话每个实例增加1%的资源消耗对于单个机器可能就显得多了。还好vivo基本上都是单机单实例部署或者容器部署,所以避免了上服务混合部署的情况。</p> <p><br></p> <p>最后,我们基于JMX的Profile设计虽然不是业界内的最优解,但却是当前快速解决vivo Vtrace监控的一个痛点的最优解。</p> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>六、未来展望</p> </section> </section> <p><br></p> <p>面对着困境我们努力优化却回报不高,在同类产品的分析后我们探索出改进方向,而在技术选型上我们做了一些妥协,最后随着对压测结果与vivo的实际情况分析发现我们还算交了一份不错的答卷。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016825" data-ratio="0.5675925925925925" data-s="300,640" src="/upload/af612e4ae2d0d864a2a6b701042ef938.png" data-type="png" data-w="1080" style=""></p> <section> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">图20</span></p> <p><br></p> <p>上图展示了Profile采集的最终效果,与图1相比,我们取得了巨大的进步。在优化了MySQL与Kafka的插件支持后,我们再次将Vtrace与同类产品进行对比:</p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016826" data-ratio="0.48940269749518306" data-s="300,640" src="/upload/cc9a4d3b2756f493244c09cb62d9f8ad.png" data-type="png" data-w="1038" style=""></p> <section> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">表6</span></p> <p><br></p> <p>重新对比,可以看出Vtrace的Trace分析能力有了显著的变化,从最初无法识别基本组件,提升到与头部同类产品不相上下。这样的Trace分析能力在国内可观测领域属于顶尖水准,全球范围内也达到一流水平。</p> <p><br></p> <p>后续我们会重新整体去规划Continuous Profiling的相关设计,同时团队慢慢学习提升技术让团队能够基于AsyncGetCallTrace将Profile采集的性能优化到最低。这并不只是为了优化Profile采集的性能,而是考虑到实现整个Continuous Profiling团队也必须提升相关的技术能力。强大齐全的Continuous Profiling能力可观测系统根因分析的关键,采集端消耗资源越小观测能力的上限才会越高。</p> <p><br></p> <p>涅槃之路已经开启,涅槃之路就在脚下,但这也只是刚刚开始。未来Vtrace不需要用户配置任何的检测规则,服务出现异常时Vtrace能够自动检测出问题。自动检测出来的问题会自动定位出异常的的根因及异常影响业务的范围,比如受到影响的接口上下文、接口请求量与用户数量。而告警通知用户可以按照自己的团队要求去分派告警或者按照个人需求去订阅告警,告警按照着每个团队或个人的喜好方式流转。</p> </section> </section>

基于扣子平台创建地图 AI 智能体

作者:微信小助手

<p data-pm-slice="0 0 []" style="margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 16px;">一.什么是扣子?</span></span></p> <p data-pm-slice="0 0 []" style="text-indent: 2em;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 16px;">扣子是新一代 AI 应用开发平台。无论你是否有编程基础,都可以在扣子上快速搭建基于大模型的各类 AI 应用,并将 AI 应用发布到各个社交平台、通讯软件,也可以通过 API 或 SDK 将 AI 应用集成到你的业务系统中。</span></span></p> <p data-pm-slice="0 0 []" style="text-indent: 2em;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 16px;">这次我们来创建一个地图小精灵智能体。</span></span></p> <p data-pm-slice="0 0 []"><span leaf=""><span textstyle="" style="font-size: 16px;">二.如何创建智能体?</span></span></p> <p data-pm-slice="0 0 []" style="text-indent: 2em;"><span leaf=""><span textstyle="" style="font-size: 16px;">登录扣子平台。扣子网址:</span></span><span leaf="" data-pm-slice="1 1 [" para,{tagname:p,attributes:{data-pm-slice:0 0 []},namespaceuri:http: www.w3.org 1999 xhtml}]><span textstyle="" style="font-size: 16px;">https://www.coze.cn/</span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100000820" data-ratio="0.525" data-s="300,640" src="/upload/6d8b4bc219dfeae7f62aeff4cf423d82.png" data-type="png" data-w="1080" type="block"> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100000821" data-ratio="1.0407407407407407" data-s="300,640" src="/upload/1f45cfd3ce9c345aa2ab51cd3e68adc9.png" data-type="png" data-w="1080" type="block"> </section> <p data-pm-slice="0 0 []" style="text-indent: 2em;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 16px;">如图所示,选择创建智能体,可选择标准创建跟 AI创建。想偷懒的我,选择了 AI创建。智能体描述。“</span><span textstyle="" style="font-size: 16px;background-color: rgb(255, 251, 0);">创建</span></span><span leaf=""><span textstyle="" style="font-size: 16px;background-color: rgb(255, 251, 0);">一个基于Cesium三维地图开发,为用户提供便捷地图操作与信息查询等帮助的智能体。</span><span textstyle="" style="font-size: 16px;">”</span></span></p> <p data-pm-slice="0 0 []" style="text-indent: 2em;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 16px;">一个 Cesium的地图助手就创建完成了。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100000822" data-ratio="0.5407407407407407" data-s="300,640" src="/upload/69935172f5cf860ad6f3d45795d899ce.png" data-type="png" data-w="1080" type="block"> </section> <p data-pm-slice="0 0 []" style="text-indent: 2em;"><span leaf=""><span textstyle="" style="font-size: 16px;">创建好地图精灵后,可以进行模型的选择。扣子提供了一些模型。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100000823" data-ratio="0.7611111111111111" data-s="300,640" src="/upload/e5e390af017706293bf1dfcb376445d6.png" data-type="png" data-w="1080" type="block"> </section> <p data-pm-slice="0 0 []" style="text-indent: 2em;"><span leaf=""><span textstyle="" style="font-size: 16px;">还可以配置插件,提升智能体的能力。查找了一下地图插件,不过没有 Cesium的。百度跟高德的倒是蛮多的。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100000824" data-ratio="0.5546296296296296" data-s="300,640" src="/upload/150373c0730b07d9c36e9d1626742f53.png" data-type="png" data-w="1080" type="block"> </section> <p data-pm-slice="0 0 []" style="text-indent: 2em;"><span leaf=""><span textstyle="" style="font-size: 16px;">到此,智能体创建完成。可以向智能体发问了。</span></span></p>

数字人低延迟语音对话的解决方案

作者:微信小助手

<section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.5em;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span leaf="">最近在重点攻克本地部署的数字人项目中的</span><span leaf="">低延迟语音对话。HTTP的集联方案(ASR+LLM+TTS)方案已经完全解决。现在主要集中研究websocket和webrtc。</span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="502850843" data-ratio="0.44351851851851853" data-s="300,640" src="/upload/4809259880df391e8bba3b9dbe2b56b3.png" data-type="png" data-w="1080" type="block"> </section> <section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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: center;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.5em;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span leaf="">目前语言对话的几种方案</span> </section> <section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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: center;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.5em;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span leaf=""><br></span> </section> <section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.5em;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span leaf="">把之前整理的资料让AI帮我分析一下。</span> </section> <section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.5em;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span leaf="">先看看几个代表框架:</span> </section> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="color: rgb(0, 209, 0);font-weight: bold;">1. PipeCat</span></span> </section> <section style="text-align: left;"> <span data-pm-slice="0 0 []"><span leaf="">https://github.com/pipecat-ai/pipecat</span></span> </section> <section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span data-pm-slice="0 0 []"><span leaf=""><span textstyle="" style="color: rgb(255, 0, 0);">它是一个构建语音和多模态 AI 应用的框架。</span></span></span> </section> <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: left;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; data-pm-slice="0 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-size: 14px;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: center;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.5em;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf="">PipeCat 的核心设计理念是构建一个灵活的、基于事件驱动的管道(Pipeline)。这个管道由不同的服务(Services)和处理器(Processors)组成。这意味着你可以自由选择和替换处理流程中的各个组件。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf="">PipeCat 明确地支持多种可以在本地运行的服务:</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf=""><span textstyle="" style="font-weight: bold;">语音转文本</span>&nbsp;(STT - Speech-to-Text): 支持 本地&nbsp;<span textstyle="" style="color: rgb(255, 0, 0);">Whisper</span>。你可以使用 whisper.cpp 或其他本地部署的 Whisper 模型来进行离线语音识别。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf=""><span textstyle="" style="font-weight: bold;">大型语言模型</span>&nbsp;(LLM - Large Language Model): 支持&nbsp;<span textstyle="" style="color: rgb(255, 0, 0);">Ollama</span>。Ollama 是一个非常流行的工具,可以让你在本地轻松运行各种开源的 LLM(如 Llama 3, Mistral, Phi 等)。PipeCat 可以直接与本地运行的 Ollama 服务交互。它也支持 LiteLLM,可以配置 LiteLLM 来代理本地模型。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf=""><span textstyle="" style="font-weight: bold;">文本转语音</span>&nbsp;(TTS - Text-to-Speech): 支持<span textstyle="" style="color: rgb(255, 0, 0);">&nbsp;Piper TTS</span>。Piper 是一个快速、高质量的本地神经网络 TTS 系统,非常适合离线应用。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf=""><span textstyle="" style="font-weight: bold;">视觉模型</span>&nbsp;(Vision): 支持通过 Ollama 运行本地多模态模型(如 Llava)。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf=""><span textstyle="" style="font-weight: bold;">图像生成</span>&nbsp;(Image Generation): 支持 本地 ComfyUI。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf=""><span textstyle="" style="font-weight: bold;">向量数据库</span>&nbsp;(Vector Database): 支持 Qdrant,而 Qdrant 是可以本地部署和自托管的。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf=""><span textstyle="" style="font-weight: bold;">灵活性</span>: 你可以将 PipeCat 配置为完全使用上述本地服务,从而实现一个完全离线的语音对话系统。数据不需要离开你的本地环境或私有网络。</span></p> <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-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;text-align: left; data-pm-slice="0 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-size: 14px;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;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.5em;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf=""><span textstyle="" style="font-weight: bold;">WebSocket 的使用:</span></span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf="">作为传输层 (Transport): PipeCat 设计了 Transport 抽象层来处理输入和输出。它内置了对 WebSocket 的支持 (pipecat.transports.websocket)。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf="">典型场景: 当你需要构建一个 Web 客户端(例如浏览器中的语音助手界面)与 PipeCat 后端进行实时双向通信时,WebSocket 是一个非常自然和常见的选择。<span textstyle="" style="color: rgb(255, 0, 0);">客户端可以通过 WebSocket 将麦克风的音频流发送到 PipeCat 后端,PipeCat 处理后(STT -&gt; LLM -&gt; TTS),再通过 WebSocket 将生成的音频流发送回客户端播放。</span></span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf="">所以,你可以基于 PipeCat 框架构建一个使用 WebSocket 进行通信的服务。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf=""><span textstyle="" style="font-weight: bold;">RTC (WebRTC) 的集成:</span></span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf="">不是核心:&nbsp;<span textstyle="" style="color: rgb(255, 0, 0);">WebRTC 主要用于浏览器之间或浏览器与服务器之间的点对点实时音视频通信</span>,包含了复杂的网络穿透(NAT traversal)、编解码协商等机制。PipeCat 的核心不是提供这些 WebRTC 底层功能。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf="">可以集成: PipeCat 可以集成到使用 WebRTC 的系统中。例如,PipeCat 提供了一个与 Daily(一个 WebRTC 平台)集成的 Transport (pipecat.transports.daily)。在这种情况下,Daily 处理 WebRTC 的连接和媒体流,而 PipeCat 则作为 Daily 的一个 "机器人" 参与者,接收音频流进行处理,并将生成的语音流发送回去。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);text-align: left;><span leaf="">这意味着 PipeCat 可以作为 WebRTC 通话中的一个 AI 代理或参与者,但它本身不是实现 WebRTC 协议栈的服务。</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><br></span></p> </section> <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-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><span leaf="" data-pm-slice="1 1 [" para,{tagname:section,attributes:{style:text-align: center;},namespaceuri:}] style=""><span textstyle="" style="font-size: 17px;color: rgb(0, 209, 0);font-weight: bold;">2. Livekit</span></span> </section> <p style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">https://docs.livekit.io/home/&nbsp;</span></p> <p style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">实时音视频通信基础设施 (WebRTC)</span></p> <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: left;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; data-pm-slice="0 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-size: 14px;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;> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">核心目标:&nbsp;</span>提供一个开源、可扩展、自托管 (Self-hostable) 或云托管 (Cloud-based) 的 WebRTC 基础设施。它的<span textstyle="" style="color: rgb(255, 0, 0);">主要目的是让你能够轻松构建具有实时音频、视频和数据功能的应用程序。</span></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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">解决的问题:&nbsp;</span>简化构建复杂实时通信应用(如视频会议、在线教室、互动直播、游戏内语音聊天、远程协作工具等)的难度。它处理了 WebRTC 底层的复杂性,如:</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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">信令 (Signaling):&nbsp;</span>建立连接所需的消息交换。</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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">媒体路由 (Media Routing):</span>&nbsp;使用 SFU (Selective Forwarding Unit) 高效地将音视频流转发给房间内的其他参与者。</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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">NAT 穿透 (NAT Traversal):&nbsp;</span>通过 STUN/TURN 确保在各种网络环境下都能建立连接。</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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">客户端 SDK:&nbsp;</span>提供多种语言和平台的 SDK (JavaScript, Swift, Kotlin, Flutter, Unity, React Native, Python, Go 等),简化客户端开发。</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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">可扩展性和可靠性:&nbsp;</span>设计用于支持大规模并发用户。</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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">关键概念:&nbsp;</span>Room (房间), Participant (参与者), Track (音轨/视轨/数据轨), SFU, Client SDKs, Server API.</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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">与 AI 的关系:&nbsp;</span>LiveKit 本身不是 AI 框架。但是,它最新推出了 Agents Framework,允许开发者构建可以加入 LiveKit 房间并与人类参与者互动的 AI 代理 (Agents)。这些代理可以接收房间的音视频流,进行处理(可能调用外部 AI 服务,甚至集成像 PipeCat 这样的框架),然后将结果(如生成的语音或视频)发送回房间。所以,LiveKit 可以作为 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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">离线能力:</span>&nbsp;LiveKit 可以完全自托管在你的服务器或私有云上,不依赖 LiveKit Cloud。从这个意义上说,它是 "离线" (不依赖外部 SaaS) 的。但它仍然是一个网络服务,需要参与者能够连接到你部署的 LiveKit 服务器。它本身不处理 AI 模型的离线运行。</span></p> </section> <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-size: 14px;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: center;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;> <span data-pm-slice="0 0 []"><span leaf="" data-pm-slice="1 1 [" para,{tagname:section,attributes:{style:box-sizing: border-box; border-width: 0px; border-style: solid; border-color: hsl(var(--border)); color: rgb(10, 10, 10); font-size: 14px; font-style: normal; font-variant-ligatures: font-variant-caps: font-weight: 400; letter-spacing: orphans: 2; text-indent: text-transform: none; widows: word-spacing: -webkit-text-stroke-width: white-space: background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: text-decoration-color: text-align: center; line-height: 1.75; font-family: -apple-system-font, blinkmacsystemfont, \helvetica neue\, \pingfang sc\, \hiragino sans gb\, \microsoft yahei ui\, yahei\, arial, sans-serif;},namespaceuri:http: www.w3.org 1999 xhtml}]><br></span></span> </section> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;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: center;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;> <span data-pm-slice="0 0 []"><span leaf="" data-pm-slice="1 1 [" para,{tagname:section,attributes:{style:box-sizing: border-box; border-width: 0px; border-style: solid; border-color: hsl(var(--border)); color: rgb(10, 10, 10); font-size: 14px; font-style: normal; font-variant-ligatures: font-variant-caps: font-weight: 400; letter-spacing: orphans: 2; text-indent: text-transform: none; widows: word-spacing: -webkit-text-stroke-width: white-space: background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: text-decoration-color: text-align: center; line-height: 1.75; font-family: -apple-system-font, blinkmacsystemfont, \helvetica neue\, \pingfang sc\, \hiragino sans gb\, \microsoft yahei ui\, yahei\, arial, sans-serif;},namespaceuri:http: www.w3.org 1999 xhtml}]><span textstyle="" style="font-size: 17px;color: rgb(0, 209, 0);font-weight: bold;">3. Groq Cloud&nbsp;</span></span></span> </section> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;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: center;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;> <span data-pm-slice="0 0 []"><span leaf="" data-pm-slice="1 1 [" para,{tagname:section,attributes:{style:box-sizing: border-box; border-width: 0px; border-style: solid; border-color: hsl(var(--border)); color: rgb(10, 10, 10); font-size: 14px; font-style: normal; font-variant-ligatures: font-variant-caps: font-weight: 400; letter-spacing: orphans: 2; text-indent: text-transform: none; widows: word-spacing: -webkit-text-stroke-width: white-space: background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: text-decoration-color: text-align: center; line-height: 1.75; font-family: -apple-system-font, blinkmacsystemfont, \helvetica neue\, \pingfang sc\, \hiragino sans gb\, \microsoft yahei ui\, yahei\, arial, sans-serif;},namespaceuri:http: www.w3.org 1999 xhtml}]>https://elevenlabs.io/docs/conversational-ai/customization/custom-llm/groq-cloud</span></span> </section> <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; data-pm-slice="0 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-size: 14px;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;> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">ElevenLabs:</span>&nbsp;主要以其高质量的 Text-to-Speech (TTS) 和声音克隆技术而闻名。它们现在也提供更完整的对话式 AI 解决方案,这通常意味着将 STT (语音转文本)、LLM (语言模型) 和 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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">Conversational AI Feature:&nbsp;</span>这是 ElevenLabs 提供的一个功能或服务,旨在帮助开发者构建能够进行语音对话的 AI 应用(比如 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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">Custom LLM:&nbsp;</span>在构建对话式 AI 时,LLM 是负责理解用户意图并生成文本回复的“大脑”。ElevenLabs 允许用户自定义或选择使用非默认的 LLM 提供商。</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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">Groq (Groq Cloud):&nbsp;</span>Groq 是一家硬件公司,开发了专门用于加速 AI 推理(特别是 LLM)的 LPU (Language Processing Unit) 芯片。Groq Cloud 是他们提供的云服务,允许开发者通过 API 访问在这些 LPU 上运行的、速度极快的 LLM(例如 Llama 3, Mistral 等)。Groq 的主要卖点是极低的延迟。</span></p> <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; data-pm-slice="0 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-size: 14px;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;> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;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: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">极低延迟: 对话式 AI 的流畅度很大程度上取决于响应速度。LLM 的推理速度通常是瓶颈。使用 Groq Cloud 的超快 LLM 可以显著减少从用户说完话到 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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">高质量语音: 结合 ElevenLabs 自己的高质量、低延迟 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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">灵活性: 表明 ElevenLabs 的平台并非完全绑定特定的 LLM,而是允许用户根据需求(例如对速度的极致追求)选择不同的后端。</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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><br></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: 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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">几个好用的语音助手案例:目前英文效果好,可以用来练习自己的口语。</span></p> </section> <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> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;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: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">1. Groq部署在livekit.io的语音对话助手,代码开源</span></p><span leaf="">https://groq.livekit.io/</span> </section> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;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;> <span leaf="">https://github.com/livekit-examples/groq-voice-assistant</span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="502850832" data-ratio="0.6627318718381113" data-s="300,640" src="/upload/367c2df9f07af0cb07b7c2c269ea93b2.png" data-type="png" data-w="2372" type="block"> </section> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;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;> <span leaf=""><br></span> </section> <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-size: 14px;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;> <span data-pm-slice="0 0 []"><span leaf="" data-pm-slice="1 1 [" para,{tagname:section,attributes:{style:box-sizing: border-box; border-width: 0px; border-style: solid; border-color: hsl(var(--border)); color: rgb(10, 10, 10); font-size: 14px; font-style: normal; font-variant-ligatures: font-variant-caps: font-weight: 400; letter-spacing: orphans: 2; text-indent: text-transform: none; widows: word-spacing: -webkit-text-stroke-width: white-space: background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: text-decoration-color: text-align: center; line-height: 1.75; font-family: -apple-system-font, blinkmacsystemfont, \helvetica neue\, \pingfang sc\, \hiragino sans gb\, \microsoft yahei ui\, yahei\, arial, sans-serif;},namespaceuri:http: www.w3.org 1999 xhtml}]>2. &nbsp;</span><span leaf="">ElevenLabs ConversationalAI</span><span leaf="">&nbsp;开发的语音对话助手</span></span> </section> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;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;> <span data-pm-slice="0 0 []"><span leaf="">Llama 4 开箱即用,支持 12 种不同语言,让您的语音助手成为强大的大脑!@GroqInc云并集成@ElevenLabsDevs对话式人工智能,它能创建出色的多语言代理设置。</span></span> </section> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;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;> <span data-pm-slice="0 0 []"><span leaf="">https://elevenlabs.io/app/talk-to?agent_id=TWdv6hzLGJPyG0dhxzdV</span></span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="502850833" data-ratio="0.95" data-s="300,640" src="/upload/19266a61d15ea2dd5354aa424e03ab25.png" data-type="png" data-w="1360" type="block"> </section> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;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;> <span data-pm-slice="0 0 []"><span leaf="">3. &nbsp;</span><span style="color: rgb(15, 20, 25);font-family: TwitterChirp, -apple-system, " system-ui, segoe ui, roboto, helvetica, arial, sans-serif;font-size: 17px;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: pre-wrap;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none; data-pm-slice="0 0 []"><span leaf="">Llama 4 语音助手(Groq+Pipecat)</span></span></span> </section> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;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;> <span data-pm-slice="0 0 []"><span style="color: rgb(15, 20, 25);font-family: TwitterChirp, -apple-system, " system-ui, segoe ui, roboto, helvetica, arial, sans-serif;font-size: 17px;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: pre-wrap;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none; data-pm-slice="0 0 []"><span leaf="">https://github.com/daily-co/pcc-groq-llama/tree/main</span></span></span> </section> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;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;> <span data-pm-slice="0 0 []"><span style="color: rgb(15, 20, 25);font-family: TwitterChirp, -apple-system, " system-ui, segoe ui, roboto, helvetica, arial, sans-serif;font-size: 17px;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: pre-wrap;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none; data-pm-slice="0 0 []"><span style="color: rgb(10, 10, 10);font-family: -apple-system-font, " system-ui, helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 1.4px;orphans: 2;text-align: left;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; data-pm-slice="0 0 []"><span leaf="">Groq STT (distil-whisper-large-v3)</span></span><span leaf=""><br></span><span style="color: rgb(10, 10, 10);font-family: -apple-system-font, " system-ui, helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 1.4px;orphans: 2;text-align: left;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="">➡️ Groq Llama 4 (llama-4-scout-17b-16e-instruct)</span></span><span leaf=""><br></span><span style="color: rgb(10, 10, 10);font-family: -apple-system-font, " system-ui, helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 1.4px;orphans: 2;text-align: left;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="">➡️ Groq TTS (playai-tts)</span></span><span leaf=""><br></span><span style="color: rgb(10, 10, 10);font-family: -apple-system-font, " system-ui, helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 1.4px;orphans: 2;text-align: left;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="">➡️ Function calling</span></span><span leaf=""><br></span><span style="color: rgb(10, 10, 10);font-family: -apple-system-font, " system-ui, helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 1.4px;orphans: 2;text-align: left;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="">➡️ Deploy to Pipecat Cloud for production</span></span><span leaf=""><br></span><span style="color: rgb(10, 10, 10);font-family: -apple-system-font, " system-ui, helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 1.4px;orphans: 2;text-align: left;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="">➡️ Optionally add a</span></span><span leaf=""><br></span><span style="color: rgb(10, 10, 10);font-family: -apple-system-font, " system-ui, helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 1.4px;orphans: 2;text-align: left;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="">@twilio</span></span><span leaf=""><br></span><span style="color: rgb(10, 10, 10);font-family: -apple-system-font, " system-ui, helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 1.4px;orphans: 2;text-align: left;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="">phone number for telephone voice AI</span></span></span></span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="502850840" data-ratio="0.7206366630076838" data-s="300,640" src="/upload/2871afdae27016cf6cf11fc78f692ebc.png" data-type="png" data-w="3644" type="block"> </section> <section style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;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;> <span data-pm-slice="0 0 []"><span style="color: rgb(15, 20, 25);font-family: TwitterChirp, -apple-system, " system-ui, segoe ui, roboto, helvetica, arial, sans-serif;font-size: 17px;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: pre-wrap;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none; data-pm-slice="0 0 []"><span style="color: rgb(10, 10, 10);font-family: -apple-system-font, " system-ui, helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 1.4px;orphans: 2;text-align: left;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=""><br></span></span></span></span> </section> <section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span data-pm-slice="0 0 []"><span leaf="">4.</span><span data-pm-slice="0 0 []"><span leaf="" data-pm-slice="1 1 [" para,{tagname:section,attributes:{style:font-style: normal; font-variant-ligatures: font-variant-caps: font-weight: 400; orphans: 2; text-indent: 0px; text-transform: none; widows: word-spacing: -webkit-text-stroke-width: white-space: background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: text-decoration-color: box-sizing: border-box; border-width: border-style: solid; border-color: hsl(var(--border)); margin: 0px 8px 1.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; font-size: 14px; letter-spacing: 0.1em; color: rgb(63, 63, 63);},namespaceuri:http: www.w3.org 1999 xhtml},node,{tagname:span,attributes:{style:null,data-pm-slice:0 0 []},namespaceuri:http: xhtml}]>hume AI</span></span></span> </section> <section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span data-pm-slice="0 0 []"><span data-pm-slice="0 0 []"><span leaf=""><br></span><span leaf="">https://www.hume.ai/</span></span></span> </section> <section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span data-pm-slice="0 0 []"><span data-pm-slice="0 0 []"><span leaf=""><br></span> <section> <span leaf="">可分析人的情感进行语言对话。</span> </section></span></span> </section> <section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span leaf="">提供AI可二次开发:</span> </section> <section style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;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;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px 8px 1.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;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);> <span data-pm-slice="0 0 []"><span leaf="">https://hume-evi-next-js-starter.vercel.app/</span></span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="502850842" data-ratio="0.774074074074074" data-s="300,640" src="/upload/0af0146a928cb1fb98d4fde3f7c6aa7f.png" data-type="png" data-w="1080" type="block"> </section> <section> <span leaf=""><br></span> </section> <section> <span leaf=""><br></span> </section> <section style="-webkit-tap-highlight-color: transparent;margin: 0px 8px;padding: 0px;outline: 0px;max-width: 100%;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);color: rgb(62, 62, 62);text-align: left;font-size: 16px;font-family: -apple-system, system-ui, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;visibility: visible;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;> <span leaf="" style="font-size: 15px;visibility: visible;-webkit-tap-highlight-color: transparent;margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span textstyle="" style="font-size: 16px;font-weight: normal;">这里还有一个TTS评测平台:</span></span> </section> <section style="-webkit-tap-highlight-color: transparent;margin: 0px 8px;padding: 0px;outline: 0px;max-width: 100%;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);color: rgb(62, 62, 62);text-align: left;font-size: 16px;font-family: -apple-system, system-ui, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;visibility: visible;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;> <span leaf="" style="font-size: 15px;visibility: visible;-webkit-tap-highlight-color: transparent;margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br></span> </section> <section style="-webkit-tap-highlight-color: transparent;margin: 0px 8px;padding: 0px;outline: 0px;max-width: 100%;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);color: rgb(62, 62, 62);text-align: left;font-size: 16px;font-family: -apple-system, system-ui, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;visibility: visible;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;> <span leaf="" style="font-size: 15px;visibility: visible;-webkit-tap-highlight-color: transparent;margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span textstyle="" style="font-size: 16px;font-weight: normal;">https://app.coval.dev/the-ultimate-voice-ai-stack#components</span></span> </section> <section style="-webkit-tap-highlight-color: transparent;margin: 0px 8px;padding: 0px;outline: 0px;max-width: 100%;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);color: rgb(62, 62, 62);text-align: left;font-size: 16px;font-family: -apple-system, system-ui, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;visibility: visible;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;> <span leaf="" style="font-size: 15px;visibility: visible;-webkit-tap-highlight-color: transparent;margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br></span> </section> <section style="-webkit-tap-highlight-color: transparent;margin: 0px 8px;padding: 0px;outline: 0px;max-width: 100%;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);color: rgb(62, 62, 62);text-align: left;font-size: 16px;font-family: -apple-system, system-ui, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;visibility: visible;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;> <span leaf="" style="font-size: 15px;visibility: visible;-webkit-tap-highlight-color: transparent;margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span textstyle="" style="font-size: 16px;font-weight: normal;">通过模拟对话评测哪个性能好。</span></span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="502850844" data-ratio="0.462037037037037" data-s="300,640" src="/upload/666e4ed0e0c24a898b1802ab29671db7.png" data-type="png" data-w="1080" type="block"> </section> <section style="text-align: center;" nodeleaf=""> <img src="/upload/980c9cd9a0fc3dc7f4f3019d477f9fce.png" class="rich_pages wxw-img" data-ratio="0.47129629629629627" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502850845"> </section> <section style="text-align: center;" nodeleaf=""> <img src="/upload/cba5e141371168095a0094c475ef96ce.png" class="rich_pages wxw-img" data-ratio="0.5768518518518518" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502850846"> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="502850847" data-ratio="0.8740740740740741" data-s="300,640" src="/upload/30e584d0e33879816f2afa28dc596326.png" data-type="png" data-w="1080" type="block"> </section> <section style="-webkit-tap-highlight-color: transparent;margin: 0px 8px;padding: 0px;outline: 0px;max-width: 100%;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);color: rgb(62, 62, 62);text-align: left;font-size: 16px;font-family: -apple-system, system-ui, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;visibility: visible;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;> <span leaf="" style="font-size: 15px;visibility: visible;-webkit-tap-highlight-color: transparent;margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span textstyle="" style="font-size: 16px;font-weight: normal;">它这个平台列举了常见的几大模型和框架,作为汇总集合网站感觉不错。目前正在花大量时间搞一个集合体,可以让客户自由选择各大模型,包括在线和离线版本。</span></span> </section>

SQLite + Redis = Redka

作者:微信小助手

<p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;" data-pm-slice="0 0 []"><span leaf="">Redka</span><span leaf="">&nbsp;是一个基于 SQLite 实现的 Redis 替代产品,实现了 Redis 的核心功能,并且完全兼容 Redis API。它可以用于轻量级缓存、嵌入式系统、快速原型开发以及需要事务 ACID 特性的键值操作等场景。</span></p> <section style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;" nodeleaf=""> <img src="/upload/50bbe544f7fba53179c59ec826e2a298.png" alt="在这里插入图片描述" class="rich_pages wxw-img" data-ratio="0.562962962962963" data-type="png" data-w="1080" style="box-sizing: border-box;border-style: none;margin: 0px;max-width: 100%;" data-imgfileid="100003436"> </section> <h2 style="box-sizing: border-box;margin: 24px 0px;line-height: 30px;color: rgb(79, 79, 79);font-weight: 600;font-size: 20px;text-align: center;"><span leaf=""><span textstyle="" style="color: rgb(255, 104, 39);">功能特性</span></span></h2> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">Redka 的主要特点包括:</span></p> <ul style="box-sizing: border-box;margin: 0px 0px 24px;padding: 0px;font-size: 16px;overflow: auto hidden;list-style-type: disc;" class="list-paddingleft-1"> <li style="box-sizing: border-box;margin: 8px 0px 0px 32px;list-style-type: disc;"> <section> <span leaf="">使用 SQLite 作为存储,数据大小不必受到内存大小限制。</span> </section></li> <li style="box-sizing: border-box;margin: 8px 0px 0px 32px;list-style-type: disc;"> <section> <span leaf="">支持 ACID 事务,支持原子性操作和复杂事务。</span> </section></li> <li style="box-sizing: border-box;margin: 8px 0px 0px 32px;list-style-type: disc;"> <section> <span leaf="">提供 SQL 视图,方便数据访问和查询。</span> </section></li> <li style="box-sizing: border-box;margin: 8px 0px 0px 32px;list-style-type: disc;"> <section> <span leaf="">支持进程内(Go API)运行和独立服务器部署(RESP)。</span> </section></li> <li style="box-sizing: border-box;margin: 8px 0px 0px 32px;list-style-type: disc;"> <section> <span leaf="">兼容 Redis 命令和通信协议。</span> </section></li> </ul> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">Redka 目前已经实现了以下五种 Redis 数据类型:</span></p> <ul style="box-sizing: border-box;margin: 0px 0px 24px;padding: 0px;font-size: 16px;overflow: auto hidden;list-style-type: disc;" class="list-paddingleft-1"> <li style="box-sizing: border-box;margin: 8px 0px 0px 32px;list-style-type: disc;"> <section> <span leaf="">字符串(Strings),这是最基本的 Redis 类型,表示一个字节序列。</span> </section></li> <li style="box-sizing: border-box;margin: 8px 0px 0px 32px;list-style-type: disc;"> <section> <span leaf="">列表(Lists),按插入顺序排序的字符串序列。</span> </section></li> <li style="box-sizing: border-box;margin: 8px 0px 0px 32px;list-style-type: disc;"> <section> <span leaf="">集合(Sets),唯一字符串的无序集合。</span> </section></li> <li style="box-sizing: border-box;margin: 8px 0px 0px 32px;list-style-type: disc;"> <section> <span leaf="">哈希(Hashes),字段-值的(哈希)映射。</span> </section></li> <li style="box-sizing: border-box;margin: 8px 0px 0px 32px;list-style-type: disc;"> <section> <span leaf="">有序集合(Sorted Sets),按照每个字符串的关联分数排序的唯一字符串集合。</span> </section></li> </ul> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">除此之外,Redka 还提供了键管理、服务器/连接管理以及事务命令。</span></p> <h2 style="box-sizing: border-box;margin: 24px 0px;line-height: 30px;color: rgb(79, 79, 79);font-weight: 600;font-size: 20px;text-align: center;"><span leaf=""><span textstyle="" style="color: rgb(255, 104, 39);">安装使用</span></span></h2> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">Redka 支持两种部署方式:独立服务器或者进程内 Go 语言模块。</span></p> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">对于独立服务器部署,可以在</span><span leaf="">发布页面</span><span leaf="">下载并解压,例如 Linux 版本:</span></p> <pre style="box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;margin: 1.2em 0px 24px;line-height: 22px;color: rgb(0, 0, 0);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;background: rgb(45, 45, 45);border-radius: 2px;padding: 0.5em;line-height: 22px;color: rgb(204, 204, 204);display: block;text-size-adjust: none;overflow-x: auto;><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">curl</span></span><span leaf="">&nbsp;-L -O&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"https://github.com/nalgeon/redka/releases/download/v0.5.3/redka_linux_amd64.zip"</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">unzip</span></span><span leaf="">&nbsp;redka_linux_amd64.zip</span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">chmod</span></span><span leaf="">&nbsp;+x redka</span><span leaf=""><br></span></code></pre> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">执行 redka 文件运行服务,语法如下:</span></p> <pre style="box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;margin: 1.2em 0px 24px;line-height: 22px;color: rgb(0, 0, 0);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;background: rgb(45, 45, 45);border-radius: 2px;padding: 0.5em;line-height: 22px;color: rgb(204, 204, 204);display: block;text-size-adjust: none;overflow-x: auto;><span leaf="">redka&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">[</span></span><span leaf="">-h host</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">]</span></span><span leaf="">&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">[</span></span><span leaf="">-p port</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">]</span></span><span leaf="">&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">[</span></span><span leaf="">-s unix-socket</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">]</span></span><span leaf="">&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">[</span></span><span leaf="">db-path</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">]</span></span><span leaf=""><br></span></code></pre> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">例如:</span></p> <pre style="box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;margin: 1.2em 0px 24px;line-height: 22px;color: rgb(0, 0, 0);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;background: rgb(45, 45, 45);border-radius: 2px;padding: 0.5em;line-height: 22px;color: rgb(204, 204, 204);display: block;text-size-adjust: none;overflow-x: auto;><span leaf="">./redka</span><span leaf=""><br></span><span leaf="">./redka data.db</span><span leaf=""><br></span><span leaf="">./redka -h&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">0.0</span></span><span leaf="">.0.0 -p&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">6379</span></span><span leaf="">&nbsp;data.db</span><span leaf=""><br></span><span leaf="">./redka -s /tmp/redka.sock data.db</span><span leaf=""><br></span></code></pre> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">默认主机为 localhost,端口为 6379,数据库路径为空表示使用内存存储;如果指定了 unix 套接字,将会覆盖主机/端口。</span></p> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">启动服务之后,我们可以使用任何 Redis 客户端工具或者驱动进行连接,例如 redis-cli:</span></p> <pre style="box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;margin: 1.2em 0px 24px;line-height: 22px;color: rgb(0, 0, 0);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;background: rgb(45, 45, 45);border-radius: 2px;padding: 0.5em;line-height: 22px;color: rgb(204, 204, 204);display: block;text-size-adjust: none;overflow-x: auto;><span leaf="">redis-cli -h localhost -p&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">6379</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">127.0</span></span><span leaf="">.0.1:637</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span style="box-sizing: border-box;font-size: 14px !important;font-style: normal !important;font-variant: normal !important;font-size-adjust: none !important;font-kerning: auto !important;font-optical-sizing: auto !important;font-feature-settings: normal !important;font-variation-settings: normal !important;font-weight: 500;font-stretch: normal !important;line-height: normal !important;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(238, 153, 0);><span leaf="">9</span></span><span leaf="">&gt;</span></span><span leaf="">&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">echo</span></span><span leaf="">&nbsp;hello</span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"hello"</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">127.0</span></span><span leaf="">.0.1:637</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span style="box-sizing: border-box;font-size: 14px !important;font-style: normal !important;font-variant: normal !important;font-size-adjust: none !important;font-kerning: auto !important;font-optical-sizing: auto !important;font-feature-settings: normal !important;font-variation-settings: normal !important;font-weight: 500;font-stretch: normal !important;line-height: normal !important;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(238, 153, 0);><span leaf="">9</span></span><span leaf="">&gt;</span></span><span leaf="">&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">set</span></span><span leaf="">&nbsp;name alice</span><span leaf=""><br></span><span leaf="">OK</span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">127.0</span></span><span leaf="">.0.1:637</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span style="box-sizing: border-box;font-size: 14px !important;font-style: normal !important;font-variant: normal !important;font-size-adjust: none !important;font-kerning: auto !important;font-optical-sizing: auto !important;font-feature-settings: normal !important;font-variation-settings: normal !important;font-weight: 500;font-stretch: normal !important;line-height: normal !important;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(238, 153, 0);><span leaf="">9</span></span><span leaf="">&gt;</span></span><span leaf="">&nbsp;get name</span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"alice"</span></span><span leaf=""><br></span></code></pre> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">如果使用 Go 语言,可以直接使用 redka 模块在进程中运行。首先,安装模块和 SQLite 驱动:</span></p> <pre style="box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;margin: 1.2em 0px 24px;line-height: 22px;color: rgb(0, 0, 0);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;background: rgb(45, 45, 45);border-radius: 2px;padding: 0.5em;line-height: 22px;color: rgb(204, 204, 204);display: block;text-size-adjust: none;overflow-x: auto;><span leaf="">go get github.com/nalgeon/redka</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">go get github.com/mattn/go-sqlite3</span><span leaf=""><br></span></code></pre> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">然后就可以在 Go 程序中创建数据库:</span></p> <pre style="box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;margin: 1.2em 0px 24px;line-height: 22px;color: rgb(0, 0, 0);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;background: rgb(45, 45, 45);border-radius: 2px;padding: 0.5em;line-height: 22px;color: rgb(204, 204, 204);display: block;text-size-adjust: none;overflow-x: auto;><span style="box-sizing: border-box;font: italic 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">// A basic example of using Redka</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: italic 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">// with github.com/mattn/go-sqlite3 driver.</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(204, 153, 204);><span leaf="">package</span></span><span leaf="">&nbsp;main</span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(204, 153, 204);><span leaf="">import</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"log"</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"log/slog"</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">_</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"github.com/mattn/go-sqlite3"</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"github.com/nalgeon/redka"</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(204, 153, 204);><span leaf="">func</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">main</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">{</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: italic 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">// Open a database.</span></span><span leaf=""><br></span><span leaf=""> db</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span leaf="">&nbsp;err&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">:=</span></span><span leaf="">&nbsp;redka</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Open</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"data.db"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">nil</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(204, 153, 204);><span leaf="">if</span></span><span leaf="">&nbsp;err&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">!=</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">nil</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">{</span></span><span leaf=""><br></span><span leaf=""> log</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Fatal</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span leaf="">err</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">}</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(204, 153, 204);><span leaf="">defer</span></span><span leaf="">&nbsp;db</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Close</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;font: italic 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">// Set some string keys.</span></span><span leaf=""><br></span><span leaf=""> err&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">=</span></span><span leaf="">&nbsp;db</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Str</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Set</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"name"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"alice"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span leaf=""> slog</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Info</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"set"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"err"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span leaf="">&nbsp;err</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span leaf=""> err&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">=</span></span><span leaf="">&nbsp;db</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Str</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Set</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"age"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">25</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span leaf=""> slog</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Info</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"set"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"err"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span leaf="">&nbsp;err</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;font: italic 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">// Check if the keys exist.</span></span><span leaf=""><br></span><span leaf=""> count</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span leaf="">&nbsp;err&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">:=</span></span><span leaf="">&nbsp;db</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Key</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Count</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"name"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"age"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"city"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span leaf=""> slog</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Info</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"count"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"count"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span leaf="">&nbsp;count</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"err"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span leaf="">&nbsp;err</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;font: italic 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">// Get a key.</span></span><span leaf=""><br></span><span leaf=""> name</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span leaf="">&nbsp;err&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">:=</span></span><span leaf="">&nbsp;db</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Str</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Get</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"name"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span leaf=""> slog</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">.</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(102, 153, 204);><span leaf="">Info</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">(</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"get"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"name"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span leaf="">&nbsp;name</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"err"</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">,</span></span><span leaf="">&nbsp;err</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">)</span></span><span leaf=""><br></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 153, 153);><span leaf="">}</span></span><span leaf=""><br></span></code></pre> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">以上程序的输出结果:</span></p> <pre style="box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;margin: 1.2em 0px 24px;line-height: 22px;color: rgb(0, 0, 0);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif;font-size: 14px;background: rgb(45, 45, 45);border-radius: 2px;padding: 0.5em;line-height: 22px;color: rgb(204, 204, 204);display: block;text-size-adjust: none;overflow-x: auto;><span leaf="">count&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(238, 153, 0);><span leaf="">count</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">=</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(249, 145, 87);><span leaf="">2</span></span><span leaf="">&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(238, 153, 0);><span leaf="">err</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">=</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">&lt;</span></span><span leaf="">nil</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">&gt;</span></span><span leaf=""><br></span><span leaf="">get&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(238, 153, 0);><span leaf="">name</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">=</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">"alice"</span></span><span leaf="">&nbsp;</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(238, 153, 0);><span leaf="">err</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">=</span></span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">&lt;</span></span><span leaf="">nil</span><span style="box-sizing: border-box;font: 14px " source code pro, dejavu sans mono, ubuntu anonymous droid menlo, monaco, consolas, inconsolata, courier, monospace, pingfang sc, microsoft yahei, sans-serif !important;color: rgb(153, 204, 153);><span leaf="">&gt;</span></span><span leaf=""><br></span></code></pre> <h2 style="box-sizing: border-box;margin: 24px 0px;line-height: 30px;color: rgb(79, 79, 79);font-weight: 600;font-size: 20px;text-align: center;"><span leaf=""><span textstyle="" style="color: rgb(255, 104, 39);">性能测试</span></span></h2> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">Redka 作者在一台 Macbook Air 笔记本中使用&nbsp;</span><span leaf="">redis-benchmark</span><span leaf="">&nbsp;工具比较了 两者的性能,结果显示 Redka 相比 Redis 慢了 2 - 5 倍,考虑到前者使用关系型数据库作为存储,这个结果在意料之中。即便如此,测试中的 Redka 写入性能达到了 26000/s,读取性能达到了 100000/s,已经可以满足大多数应用程序了。</span></p> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">具体测试方法和硬件配置可以参考下面这篇文档:</span></p> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf="">https://github.com/nalgeon/redka/blob/main/docs/performance.md</span></p> <p style="box-sizing: border-box;margin: 24px 0px;line-height: 30px;color: rgb(79, 79, 79);font-weight: 600;font-size: 20px;text-align: center;"><span leaf=""><span textstyle="" style="color: rgb(255, 104, 39);">我的著作</span></span></p> <section nodeleaf=""> <mp-common-cpsad data-pluginname="mpcps" data-templateid="list" data-cpsversion="v120" data-goodssouce="1" data-traceid="2a851e4b-11c3-4d51-aa89-9f303ac1cdcf" data-pid="101_12973637"></mp-common-cpsad> </section> <p style="box-sizing: border-box;margin: 0px 0px 16px;font-size: 16px;color: rgb(77, 77, 77);font-weight: 400;line-height: 26px;overflow: auto hidden;"><span leaf=""><br></span></p> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

“最强 AI 声优”驾到!10秒复刻声音,连本人都分不出来!

作者:微信小助手

<section data-mpa-template="t" mpa-from-tpl="t"> <section mpa-from-tpl="t"> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="0.15384615384615385" data-s="300,640" data-type="png" data-w="650" style="height: auto !important;" type="block" data-imgfileid="100148500" src="/upload/0459be68807dedba546778bb41eb63f7.png"> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m82wnyx319cp"> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m8fmxzpc1kkf" style="margin: 0px;padding: 0px;user-select: initial !important;display: block;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgba(0, 0, 0, 0.9);font-family: mp-quote, " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: none;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.578px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: break-spaces;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;> <section mpa-from-tpl="t" style="margin: 0px;padding: 0px;user-select: initial !important;display: block;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m8li5rts1ve6"> <section mpa-from-tpl="t"> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gibljwrw2"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">之前我不是做 B 站吗?录视频解说的时候真的挺麻烦,老是读错字,还费时间。</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">所以我一直对语音克隆工具关注有加,最近又发现一个新升级的克隆利器,让它帮我念台词,大家听听效果怎么样?</span></span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card mp_common_widget" data-pluginname="insertaudio" name="黑哥AI声音B站解说" author="网罗灯下黑" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E9%BB%91%E5%93%A5AI%E5%A3%B0%E9%9F%B3B%E7%AB%99%E8%A7%A3%E8%AF%B4&amp;play_length=1%E5%88%86%E9%92%9F" isaac2="1" low_size="151.02" source_size="151" high_size="471.7" play_length="80000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzU2NTAzNzYzMl8yMjQ3NjMyNjAz" cover="http://wx.qlogo.cn/mmopen/4QK9bGpA4NiciaENfYo0Rn4DM1vrR5lQlicLJndwLjhfY0p2rD8AJTBGa9kjO72fdW5znk849NusbMicibQyicXsXbjtOF9OkxPoKe/0" duration="80" err_tips=""></mp-common-mpaudio> </section> </section> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gibljwrw2" style="margin: 0px;padding: 0px;user-select: initial !important;display: block;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgba(0, 0, 0, 0.9);font-family: mp-quote, " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: none;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.578px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: break-spaces;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial; data-pm-slice="0 0 []"> <section mpa-from-tpl="t" style="margin: 0px;padding: 0px;user-select: initial !important;display: block;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gii5tl582"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">我去,我自己听了都愣住了。也太像了吧。。。</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">我让媳妇听了之后,一开始她还真没听出来,不仅音色一致,语调有抑扬顿挫,停顿也都非常自然。</span></span></p> </section> </section> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;padding: 0px;user-select: initial !important;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;clear: both;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);"><span mpa-is-content="t" style="margin: 0px;padding: 0px;user-select: initial !important;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;"><span leaf="" style="margin: 0px;padding: 0px;user-select: initial !important;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">再对比一下原视频解说声音,</span></span><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;"><span leaf="">怎么样,这个 AI 帮忙念的解说词和原声相比,也许最大的差别就是没有背景音乐了吧。</span></span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card mp_common_widget" data-pluginname="insertaudio" name="没有这个网站,iPhone&nbsp;在中国火不起来" author="网罗灯下黑" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E6%B2%A1%E6%9C%89%E8%BF%99%E4%B8%AA%E7%BD%91%E7%AB%99%EF%BC%8CiPhone%26nbsp%3B%E5%9C%A8%E4%B8%AD%E5%9B%BD%E7%81%AB%E4%B8%8D%E8%B5%B7%E6%9D%A5&amp;play_length=9%E5%88%86%E9%92%9F" isaac2="1" low_size="1106.47" source_size="1126.4" high_size="4338.76" play_length="555000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzU2NTAzNzYzMl8yMjQ3NjMyNjA0" cover="http://wx.qlogo.cn/mmopen/4QK9bGpA4NiciaENfYo0Rn4DM1vrR5lQlicLJndwLjhfY0p2rD8AJTBGa9kjO72fdW5znk849NusbMicibQyicXsXbjtOF9OkxPoKe/0" duration="555" err_tips=""></mp-common-mpaudio> </section> </section> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gihkndft8"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">AI 克隆了我的声音后,还能用来说粤语、英语。生成的其它方言和语言不仅完全保持了原有的音色,说的也非常自然、流畅。</span></span><span leaf=""><br></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">比之前体验过的,包括目前市面不少声音克隆 AI 工具效果不要好太多。</span></span></p> </section> </section> <section mpa-from-tpl="t"> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9giwibr1qku"> <section mpa-from-tpl="t"> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">好了,该引出正主了,我用的是 MiniMax Audio 刚上新的 Speech-02 模型克隆的。</span></span></p> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9gr8y54y6k" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img" data-imgfileid="100148936" data-ratio="0.7624565469293163" data-s="300,640" data-type="png" data-w="863" style="box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;height: auto !important;" type="block" src="/upload/eed12faacf8e3afb354ad3ba422ed0e5.png"> </section> </section> </section> </section> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9fl6puum0j"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">说起来 MiniMax,也是国内 AI 六小龙之一的实力选手。</span><span leaf="">海螺 AI 就是</span><span style="color: rgb(85, 85, 85);font-family: mp-quote, " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;font-style: normal;font-variant-ligatures: none;font-variant-caps: normal;font-weight: 400;letter-spacing: 1px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: break-spaces;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none; data-pm-slice="0 0 []"><span leaf="">&nbsp;MiniMax 公司的产品之一。</span></span></span></p> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9goi3j7h4q"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">不过这次国内版的 Speech-02 模型还没有上线,也不支持声音克隆,所以大家只能先用海外版了,官网「需魔法」:</span></span></p> </section> </section> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;"><span leaf="">https://www.minimax.io/audio</span></span></p> </section> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9g9p5h5247"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong mpa-from-tpl="t" mpa-is-content="t" style="color: rgb(217, 33, 66);font-size: 19px;letter-spacing: 1px;"><span leaf="">内置语音库、克隆声音快</span></strong></p> </section> </section> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9goj1asza2"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">MiniMax Audio 内置了丰富的语音库,差不多有 300 多种,各种语言和各种年龄、风格的都有,质量非常高,都可以直接拿来用。</span></span></p> </section> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m8li5rts1ve6"> <section mpa-from-tpl="t"> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9fjxe0rj3c"> <section mpa-from-tpl="t"> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">这么多,都够给一部电视剧所有演员配音了吧。</span></span></p> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span style="color: rgb(85, 85, 85);font-family: mp-quote, " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 15px;font-style: normal;font-variant-ligatures: none;font-variant-caps: normal;font-weight: 400;letter-spacing: 1px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: break-spaces;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none; data-pm-slice="0 0 []"><span leaf="">英文咱就不听了,听几个中文的。</span></span></span></p> <section nodeleaf=""> <iframe class="video_iframe rich_pages" src="https://mp.weixin.qq.com/mp/readtemplate?t=pages/video_player_tmpl&amp;action=mpvideo&amp;auto=0&amp;vid=wxv_3942779552291569684" data-mpvid="wxv_3942779552291569684" data-vidtype="2" data-cover="http%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FncicWtGoBHtJg3WB5VQK16ntkoKn0famnP9aiamiaaEOgCc3CuVM02D4ib0XVYxPvsBpMxHMByZb5T8JdQkoJNztaQ%2F0%3Fwx_fmt%3Djpeg" style=""></iframe> </section> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">如果需要克隆新的声音,就要点击「Create your Voice Clone」,也就是创建克隆声音。</span></span></p> </section> </section> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9fjxisv1pxe" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img" data-ratio="0.36363636363636365" data-s="300,640" data-type="png" data-w="605" style="box-shadow: rgb(180, 180, 180) 0px 0px 0.5em 0px;height: auto !important;" type="block" data-imgfileid="100148911" src="/upload/56b341d69e49edec8f3409bb90cd07c1.png"> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9fjxn40208s"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">然后上传一段音频或者自己录音。至少 10 秒以上吧,也不需要太长,一二十 秒就差不多了。</span></span></p> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">如果上传的声音有背景音乐,这肯定会影响克隆声音效果的。</span></span></p> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">而 MiniMax Audio 还支持上传声音的同时去除背景音,勾选那个「去除背景音」就行。</span></span></p> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">这点真的很赞,不然还得另外找工具把背景音乐和人声分离。</span></span></p> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">最后选择需要生成的语音种类,再点击「Convert」就开始克隆了。</span></span></p> </section> </section> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9fjxtfu3qs" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100148912" data-ratio="0.9602780536246276" data-s="300,640" data-type="jpeg" data-w="1007" style="box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;height: auto !important;" type="block" src="/upload/86198bafb62d13669f482145df0ff15c.jpg"> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9fjxzehqj5"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">我从点击开始到生成克隆的声音真的快,大概也就 10 秒时间。</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">真的挺快!不禁感叹,语音克隆这个玩法现在是真的有手就会,完全是 0 门槛了。</span></span></p> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9g9qy99vzq"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong mpa-from-tpl="t" mpa-is-content="t" style="color: rgb(217, 33, 66);font-size: 19px;letter-spacing: 1px;"><span leaf="">支持生成 30多种语言,可调节音色</span></strong></p> </section> </section> <section mpa-from-tpl="t"> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9fo001h1wmf"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">这还只是第一步,声音克隆之后,它会存到语音库。</span></span><span leaf=""><br></span></p> </section> </section> </section> </section> <section mpa-from-tpl="t" data-mpa-action-id="m9fjy7za15uj" data-pm-slice="0 0 []"> <section mpa-from-tpl="t"> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">如果想要克隆出的声音说出其他话,还得再输入文本,然后在语音库里选择刚才克隆的声音就可以了。</span></span></p> </section> </section> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9fjybmf17nu" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img" data-ratio="0.3962962962962963" data-s="300,640" data-type="png" data-w="1080" style="box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;height: auto !important;" type="block" data-imgfileid="100148913" src="/upload/a5746062d905a20d2687ebaeaa39e819.png"> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9fjyhqcsjk"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">在文本生成声音的时候,还可以对生成的声音效果进行调节,比如速度、音量等等。</span></span></p> </section> </section> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9fjypl81cic" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img" data-ratio="1.511173184357542" data-s="300,640" data-type="png" data-w="358" style="border-radius: 3px;box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;height: auto !important;" type="block" data-imgfileid="100148915" src="/upload/23df073726ffa48a185b74245a934aae.png"> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9fjywd6abu"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">什么带情绪的也可以,比如高兴、悲伤、生气等等。</span></span></p> </section> </section> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9fjyzzw1n24" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img" data-ratio="0.7478260869565218" data-s="300,640" data-type="png" data-w="345" style="box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;height: auto !important;" type="block" data-imgfileid="100148916" src="/upload/5dd13a62ce05ed83a2a2df92232ea9a8.png"> </section> <section mpa-from-tpl="t"> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9ga0bet1dwe"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">在左下角生成语言选项那里,可以看到,它除了可以生成中文普通话外,还能生成粤语方言以及英语、日语等 30 多种语言。</span></span></p> </section> </section> <section nodeleaf="" data-mpa-action-id="m9g9xtbjx18" data-pm-slice="0 0 []" style="margin: 0px;padding: 0.5em;user-select: initial !important;display: block;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgba(0, 0, 0, 0.9);font-family: mp-quote, " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: none;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.578px;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: break-spaces;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;> <img class="rich_pages wxw-img" data-imgfileid="100148918" data-ratio="0.406380027739251" data-s="300,640" data-type="png" data-w="721" style="margin: 0px;padding: 0px;max-width: 100%;outline: none;vertical-align: bottom;box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;user-select: initial !important;box-sizing: border-box !important;overflow-wrap: break-word !important;height: auto !important;" type="block" src="/upload/7960f2436498a4226b32d85c5e193f92.png"> </section> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">而且不管你克隆的声音说什么语言的,都能生成其它不同的语言。</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">所以在生成的时候有两个模型可供选择:Speech-02-hd、Speech-02-turbo。</span></span></p> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">这两个有什么区别呢?</span></span></p> <p style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">Speech-02-hd 主要是用在声音克隆方面,生成一些小语种声音的话,建议使用 Speech-02-turbo。</span></span></p> </section> </section> <section mpa-from-tpl="t"> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9fjzd7r1w8f" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img" data-imgfileid="100148917" data-ratio="0.5202020202020202" data-s="300,640" data-type="png" data-w="792" style="box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;height: auto !important;" type="block" src="/upload/b84674d613bff335c1a95ca53fb45a63.png"> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gm01no1cya"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">生成不同的语言时注意不要选错。</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">我用它克隆了几个大家都算比较熟悉的声音,然后再和原声对比,大家就更能体验到&nbsp;</span><span leaf="">MiniMax Audio 的声音克隆能力有多强了!</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">第一组:董卿声音</span></span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card mp_common_widget" data-pluginname="insertaudio" name="董卿AI朗读" author="网罗灯下黑" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E8%91%A3%E5%8D%BFAI%E6%9C%97%E8%AF%BB&amp;play_length=25%E7%A7%92" isaac2="1" low_size="45.29" source_size="45.3" high_size="150.65" play_length="25000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzU2NTAzNzYzMl8yMjQ3NjMyNjAy" cover="http://wx.qlogo.cn/mmopen/4QK9bGpA4NiciaENfYo0Rn4DM1vrR5lQlicLJndwLjhfY0p2rD8AJTBGa9kjO72fdW5znk849NusbMicibQyicXsXbjtOF9OkxPoKe/0" duration="25" err_tips=""></mp-common-mpaudio> </section> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf=""></span></span></p> <section> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card mp_common_widget" data-pluginname="insertaudio" name="董卿原声朗读" author="网罗灯下黑" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E8%91%A3%E5%8D%BF%E5%8E%9F%E5%A3%B0%E6%9C%97%E8%AF%BB&amp;play_length=27%E7%A7%92" isaac2="1" low_size="51.83" source_size="51.8" high_size="211.63" play_length="27000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzU2NTAzNzYzMl8yMjQ3NjMyNjA1" cover="http://wx.qlogo.cn/mmopen/4QK9bGpA4NiciaENfYo0Rn4DM1vrR5lQlicLJndwLjhfY0p2rD8AJTBGa9kjO72fdW5znk849NusbMicibQyicXsXbjtOF9OkxPoKe/0" duration="27" err_tips=""></mp-common-mpaudio> </section> <p></p> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gz9udj1j8m"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">第二组:王明军朗读《三体》</span></span></p> </section> </section> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card mp_common_widget" data-pluginname="insertaudio" name="王明军AI声音读三体" author="网罗灯下黑" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E7%8E%8B%E6%98%8E%E5%86%9BAI%E5%A3%B0%E9%9F%B3%E8%AF%BB%E4%B8%89%E4%BD%93&amp;play_length=20%E7%A7%92" isaac2="1" low_size="38.93" source_size="38.9" high_size="120.07" play_length="20000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzU2NTAzNzYzMl8yMjQ3NjMyNjA3" cover="http://wx.qlogo.cn/mmopen/4QK9bGpA4NiciaENfYo0Rn4DM1vrR5lQlicLJndwLjhfY0p2rD8AJTBGa9kjO72fdW5znk849NusbMicibQyicXsXbjtOF9OkxPoKe/0" duration="20" err_tips=""></mp-common-mpaudio> </section> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf=""></span></span></p> <section> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card mp_common_widget" data-pluginname="insertaudio" name="王明军原声三体" author="网罗灯下黑" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E7%8E%8B%E6%98%8E%E5%86%9B%E5%8E%9F%E5%A3%B0%E4%B8%89%E4%BD%93&amp;play_length=15%E7%A7%92" isaac2="1" low_size="29.39" source_size="29.4" high_size="123.51" play_length="15000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzU2NTAzNzYzMl8yMjQ3NjMyNjA2" cover="http://wx.qlogo.cn/mmopen/4QK9bGpA4NiciaENfYo0Rn4DM1vrR5lQlicLJndwLjhfY0p2rD8AJTBGa9kjO72fdW5znk849NusbMicibQyicXsXbjtOF9OkxPoKe/0" duration="15" err_tips=""></mp-common-mpaudio> </section> <p></p> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gzaea21jfp"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">第三组:步非烟声音</span></span></p> </section> </section> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card mp_common_widget" data-pluginname="insertaudio" name="步非烟AI克隆声音" author="网罗灯下黑" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E6%AD%A5%E9%9D%9E%E7%83%9FAI%E5%85%8B%E9%9A%86%E5%A3%B0%E9%9F%B3&amp;play_length=21%E7%A7%92" isaac2="1" low_size="36.58" source_size="36.6" high_size="123.86" play_length="21000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzU2NTAzNzYzMl8yMjQ3NjMyNjA4" cover="http://wx.qlogo.cn/mmopen/4QK9bGpA4NiciaENfYo0Rn4DM1vrR5lQlicLJndwLjhfY0p2rD8AJTBGa9kjO72fdW5znk849NusbMicibQyicXsXbjtOF9OkxPoKe/0" duration="21" err_tips=""></mp-common-mpaudio> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gmd41a22bh"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf=""></span></p> <section> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card mp_common_widget" data-pluginname="insertaudio" name="步非烟原声" author="网罗灯下黑" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E6%AD%A5%E9%9D%9E%E7%83%9F%E5%8E%9F%E5%A3%B0&amp;play_length=28%E7%A7%92" isaac2="1" low_size="48.22" source_size="48.2" high_size="223.51" play_length="28000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzU2NTAzNzYzMl8yMjQ3NjMyNjA5" cover="http://wx.qlogo.cn/mmopen/4QK9bGpA4NiciaENfYo0Rn4DM1vrR5lQlicLJndwLjhfY0p2rD8AJTBGa9kjO72fdW5znk849NusbMicibQyicXsXbjtOF9OkxPoKe/0" duration="28" err_tips=""></mp-common-mpaudio> </section> <p></p> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gzaxriaau"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">怎么样,这一番对比下来,有没有一种那根本不是 AI 克隆的声音,它就是原声的感觉?</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">因为实在是太像了,甚至都基本一模一样了。</span><span leaf=""><br></span></span></p> </section> </section> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong mpa-from-tpl="t" mpa-is-content="t" style="color: rgb(217, 33, 66);font-size: 19px;letter-spacing: 1px;"><span leaf="">PDF 、网页链接转语音</span></strong></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t" data-pm-slice="0 0 []"><span leaf="">MiniMax 除了支持文字转语音之外,还可以支持 PDF 文档和网页链接直接转语音。</span></span></span></p> </section> </section> </section> </section> </section> <section mpa-from-tpl="t"> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9glxp17lnv" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img" data-ratio="0.8924180327868853" data-s="300,640" data-type="png" data-w="976" style="box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;height: auto !important;" type="block" data-imgfileid="100148920" src="/upload/e1e9224bc0c66c21510b765fd76713f9.png"> </section> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gml4tq13zn"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">得,又给我们省了一步操作。。。</span></span></p> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gmywiv14ws"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">现在公众号不是支持听文章了嘛?是方便不少,你看也有小伙伴在用这个功能,但我老觉得它听起来比较生硬。</span></span></p> </section> </section> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9gmz4f81sf9" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100148932" data-ratio="0.6612466124661247" data-s="300,640" data-type="jpeg" data-w="369" style="box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;height: auto !important;" type="block" src="/upload/e424ad0fca4200834fb6728e82c4806d.jpg"> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gn0ook21ip"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">那我就把这篇文章的链接放进去。</span></span></p> </section> </section> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9gmsjqnagr" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img" data-ratio="0.5324074074074074" data-s="300,640" data-type="png" data-w="1080" style="box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;height: auto !important;" type="block" data-imgfileid="100148931" src="/upload/716c55de3a06e40c70a7518fbe9734de.png"> </section> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">大家再听下,是不是比公众号自带的朗读效果要好多了,虽然说情感缺乏一些起伏,但是音色是真的像,这是真的得服。</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">你要知道,这仅用了 10 秒的语料,仅花了 10 秒就能达到的效果。</span></span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card mp_common_widget" data-pluginname="insertaudio" name="黑哥念公众号文章" author="网罗灯下黑" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E9%BB%91%E5%93%A5%E5%BF%B5%E5%85%AC%E4%BC%97%E5%8F%B7%E6%96%87%E7%AB%A0&amp;play_length=3%E5%88%86%E9%92%9F" isaac2="1" low_size="436.84" source_size="436.8" high_size="1395.4" play_length="238000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzU2NTAzNzYzMl8yMjQ3NjMyNjEw" cover="http://wx.qlogo.cn/mmopen/4QK9bGpA4NiciaENfYo0Rn4DM1vrR5lQlicLJndwLjhfY0p2rD8AJTBGa9kjO72fdW5znk849NusbMicibQyicXsXbjtOF9OkxPoKe/0" duration="238" err_tips=""></mp-common-mpaudio> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gn7b691t28"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">同时我也发现,虽然它识别网页链接后的文字有空行,但它生成语音的时候会智能忽略掉,也就是中间不会因为有空行而停顿那么长时间。</span></span></p> <section style="text-align: center;padding: 0.5em;" nodeleaf="" data-mpa-action-id="m9gpluba1fnp" data-pm-slice="0 0 []"> <img class="rich_pages wxw-img" data-imgfileid="100148933" data-ratio="0.5527777777777778" data-s="300,640" data-type="png" data-w="1080" style="box-shadow: rgb(210, 210, 210) 0px 0px 0.5em 0px;height: auto !important;" type="block" src="/upload/f10456fbe69182a66d8199b1ccff0748.png"> </section> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">另外,它还支持长文本模式,最高可输入 20 万字符。</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">这差不多是一本有声书的体量了,当然这么多的字符必须得另外「加钱」了。</span></span></p> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gnbg5020wb"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">目前的话,普通用户每天登录可免费领 4000 积分,可支持能够制作出 5 分钟的音频,如果只是浅玩体验一下,也差不多够了。</span></span></p> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gnmdgh1vkz"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong mpa-from-tpl="t" mpa-is-content="t" style="color: rgb(217, 33, 66);font-size: 19px;letter-spacing: 1px;"><span leaf="">结语</span></strong></p> </section> </section> </section> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9go5twqztx"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">体验了 MiniMax Audio 的 Speech-02 模型后,不得不说又把语音克隆又往前推上了新高度。</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">无论是声音克隆的精准度、多语言支持的广泛性,还是生成语音的自然流畅度,都远超市面上大多数同类产品。</span></span><span leaf=""><br></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="font-family: mp-quote, " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: none;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.578px;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: break-spaces;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;padding: 0px;display: block;margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);user-select: initial !important;box-sizing: border-box !important;overflow-wrap: break-word !important;><span leaf="" style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;">最关键的是,0 门槛就能做出这种效果,要知道之前还都得用&nbsp;</span><span leaf="" style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;">GPT-SoVITS 这种开源工具手搓出来,现在直接全省了。。。</span></p> <section data-mpa-template="t" mpa-from-tpl="t" data-mpa-action-id="m9gowvf51wbk"> <section mpa-from-tpl="t"> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">目前到这个阶段,在音色克隆这方面,大家基本上已经卷得差不多了。</span></span></p> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(85, 85, 85);font-size: 15px;letter-spacing: 1px;" mpa-is-content="t"><span leaf="">再往下的新的突破点,那大概就是大模型根据文本包含的语义来自行调整语音情感和腔调了,到了那个时候,可能我们就真的无法再分辨真人和 AI 的语音了。</span></span></p> </section> </section> </section> </section> </section> </section> </section> </section> </section> </section> </section> </section> </section> <p label="Copyright Jason Ng of Kenengba and knbknb" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(137, 137, 137);text-align: justify;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100148031" data-ratio="0.037096774193548385" data-type="png" data-w="620" style="margin-right: auto;margin-left: auto;outline: 0px;color: rgb(62, 62, 62);line-height: 25.6px;display: block;visibility: visible !important;width: 556px !important;height: auto !important;" width="556px" src="/upload/5a52e1e3f773b3d7bb14e1e322970aeb.png"></span></p> </section> </section> <section class="mp_profile_iframe_wrp" nodeleaf=""> <mp-common-profile class="custom_select_card mp_profile_iframe mp_common_widget" data-pluginname="mpprofile" data-nickname="网罗灯下黑" data-alias="wldxh8" data-from="0" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/ncicWtGoBHtKUwZ0CzQHd5EokZtiavicrdnVevkhrRiaibVCK0mPSSG3nicDKUPE9GvkT6dqtO6IPX4yzIuibiatOsgjbQ/0?wx_fmt=png" data-signature="聊点网络生活中不为人知的有趣事" data-id="MzU2NTAzNzYzMg==" data-service_type="1"></mp-common-profile> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

Spark on K8s 在vivo大数据平台的混部实战

作者:微信小助手

<section style="font-size: 15px;color: rgb(62, 62, 62);"> <section style="margin: 10px 0% 8px;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;width: 100%;border-left: 3px solid rgb(219, 219, 219);border-bottom-left-radius: 0px;padding-left: 8px;align-self: flex-start;"> <section style="color: rgba(0, 0, 0, 0.5);font-size: 14px;text-align: justify;width: 100%;"> <p>作者:vivo 互联网大数据团队- Qin Yehai</p> </section> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: left;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;color: rgb(160, 160, 160);"> <p>在离线混部可以提高整体的资源利用率,不过离线Spark任务部署到混部容器集群需要做一定的改造,本文将从在离线混部中的离线任务的角度,讲述离线任务是如何进行容器化、平台上的离线任务如何平滑地提交到混部集群、离线任务在混部集群中如何调度的完整实现以及过程中的问题解决。</p> </section> </section> </section> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>一、在离线业务差异</p> </section> </section> <p><br></p> <section> <p>互联网数据业务服务一般可以分为在线服务和离线任务两大类,在线服务是指那些长时间运行、随时响应对实时性要求高、负载压力随着接收流量起伏的服务,如电商、游戏等服务,离线任务是指运行周期短、可执行时间提交对实时性要求低、有一定容错性、负载压力基本可控的服务,如离线计算任务、模型训练等。一般在线服务在白天时段繁忙,离线任务在凌晨繁忙,两者的业务高峰期存在错峰现象,如果按传统方式在线和离线都是分别独立机器部署,业务高峰时期需要更多机器来支持,业务低峰期又存在部分机器空闲,整体资源利用率都不高。因此行业提出来在离线混部的解决方案,在线和离线业务通过混部系统部署在同一批机器,实现共享资源并错峰互补,提高整体的资源利用率。目前业内利用混部技术可以将数据中心的CPU利用率提升至40%左右,vivo在2023年混部平台投入生产也已经将部分混部集群的CPU利用率提升至30%左右,整体收益也是可观的。</p> <p><br></p> <p>混部系统需要有强大的隔离能力,绝大部分都是基于容器,所以混部的前提是在线和离线业务都容器化,对于容器管理工具如K8s来说是更适应于运行时间长、启停次数少、容器数量少的在线服务,在线服务也能比较容易地上容器,而对于运行时间短、启停频繁、容器数量大的离线任务,对K8s来说不是天然地适应,但容器化已是大势所趋,K8s也推出了性能更好的调度器、用于离线任务的控制器,Spark在2.3版本后也支持容器化,诸多技术的发展也推动离线任务实现容器化以及在离线混部的落地。</p> <p><br></p> <p>本文将从在离线混部中的离线任务的角度,讲述离线任务是如何进行容器化、平台上的离线任务如何平滑地提交到混部集群、离线任务在混部集群中如何调度的完整实现以及过程中的问题解决。</p> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>二、离线任务容器化</p> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">2.1 Spark Operator 方案</span></p> <p><br></p> <p><strong>2.1.1 方案对比</strong></p> <p><br></p> <p>vivo离线任务大部分任务是以Spark作为执行引擎,Spark任务运行在K8s上,目前业界有两种架构的方案:Spark on K8s及Yarn on K8s。两者部分优缺点对比如下:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016833" data-ratio="0.5247395833333334" data-s="300,640" src="/upload/57b558daeff1cca11d1b72c8b3512b41.jpg" data-type="jpeg" data-w="768" style=""></p> <p><br></p> <section> <p>Spark on K8s是Spark容器化,由K8s直接创建Driver和Executor的Pod来运行Spark作业,Yarn on K8s是Yarn的容器化,由K8s创建RM和NM的Pod,Spark的Driver和Executor运行在NM Pod的container中,正是由于两种架构方案的区别,它们各自也会存在优缺点。</p> <p><br></p> <p>Yarn on K8s方案可以支持原生的Hive、Spark、Flink等引擎,它仅需要创建一定数量的NodeManager Pod来满足作业需求,Pod运行相对稳定因此对K8s的压力比较小,本身Yarn支持调度性能和调度策略也是专门为离线任务设计的,调度性能比K8s的强很多。由于NodeManager ESS服务是对磁盘有容量和读写性能要求的,混部机器的磁盘一般难以满足,所以也需要能支持不同引擎的Remote Shuffle Service。在资源利用上,NodeManager需要满足多个作业的资源,最小单位是Container,Pod的资源粒度比较大,自身也会占用一些资源,如果资源粒度得不到有效地弹性伸缩,也会造成资源的浪费,因此需要引入额外的组件来协调,根据Kubernetes集群节点的剩余资源,动态调整NodeManager的CPU和内存,然而这也需要一定的改造成本。在资源紧张的情况下,NodeManager Pod如果被驱逐也就意味着整个NodeManager被销毁,将会影响多个任务。</p> <p><br></p> <p>Spark on K8s方案目前在Spark 3.1以上版本才正式可用,它需要频繁的创建、查询、销毁大量的Executor Pod,对K8s的ApiServer和ETCD等组件都会造成比较大的压力,K8s的调度器也不是专门为离线的大批量任务设计的,调度性能也比较弱。另一方面,Spark on K8s虽然只能支持Spark3.X的RSS,不过目前有较多的开源产品可选择。在资源利用上,最小单位是Driver和Executor的Pod,资源粒度小,可以填充到更多的碎片资源,调度时直接与K8s对接,资源的弹性调度更多由K8s来承担,不需要额外的组件,改造成本比较低。在资源紧张的情况下,Executor、Driver的Pod将依次逐个被驱逐,任务的稳定性会更高。</p> <p><br></p> <p><span style="color: rgb(62, 62, 62);font-size: 15px;letter-spacing: 0.578px;">而对于Spark on K8s方案,还细分2种实现方案:</span><span style="color: rgb(62, 62, 62);font-size: 15px;letter-spacing: 0.578px;">Spark Submit on K8s和Spark Operator on K8s。</span></p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016834" data-ratio="0.676985195154778" data-s="300,640" src="/upload/91fd2a1954307dc8269f83341744893b.png" data-type="png" data-w="743" style=""></p> <section> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">SparkOnK8s架构图</span></p> <p style="text-align: center;"><span style="font-size: 14px;color: rgb(136, 136, 136);">(图片来源:Spark官网)</span> </p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016835" data-ratio="0.5189075630252101" data-s="300,640" src="/upload/e29941ab2c8492f9ee24f0707f99c6c8.png" data-type="png" data-w="952" style=""></p> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">Spark Operator架构图</span></p> <p style="text-align: center;"><span style="color: rgb(136, 136, 136);font-size: 14px;">(图片来源:Spark Operator开源项目)</span></p> </section> <p><br></p> <section> <p>以spark-submit方式提交到K8s集群是Spark在2.3版本后提供的原生功能,客户端通过spark-submit设置K8s的相关参数,内部再调用K8sApi在K8s集群中创建Driver Pod,Driver再调用K8sApi创建需要的Executor Pod,共同组成Spark Application,作业结束后Executor Pod会被Driver Pod销毁,而Driver Pod则继续存在直到被清理。使用spark-submit方式的最大好处是由spark-submit来与K8s的进行交换,提交作业的方式几乎保持一致。但是因为使用的便利性所需要的封装也会带来一些缺点,spark-submit是通过K8sApi创建Pod,使用非声明式的提交接口,如果需要修改K8s配置就需要重新开发新接口,二次开发复杂繁琐,虽然Spark提供了大量的K8s配置参数,但也远比不了K8s YAML的声明式的提交方式更加灵活,而且Spark Application和K8s Workload的生命周期还不能较好地对应起来,生命周期不能灵活控制,任务监控也比较难接入Prometheus集群监控。虽然Spark社区也不断地在推出新特性来和K8s集成地更加灵活,不过对于些复杂场景需要定制开发,spark-submit的封装性也会成为阻碍。</p> <p><br></p> <p>spark-submit还是离线任务提交的思维,而Spark Operator方式就更倾向于K8s作业的思维,作为K8s的自定义控制器,在集成了原生的Spark on K8s的基础上利用K8s原生能力提供了更全面管控功能。Spark Operator使用声明式的YAML提交Spark作业,并提供额外组件来管理Spark作业的生命周期,SparkApplication控制器,负责<span style="letter-spacing: 0.034em;">SparkApplication</span><span style="letter-spacing: 0.034em;">Object的创建、更新和删除,同时处理各种事件和作业状态,Submission Runner, 负责调用spark-submit提交Spark作业,Driver和Executor的运行流程是一致的,Spark Pod Monitor,负责监控和同步Spark作业相关Pod的状态。</span><span style="letter-spacing: 0.034em;">Spark Operator最大的好处是为在K8s中的Spark作业提供了更好的控制、管理和监控的功能,可以更加紧密地与K8s结合并能灵活使用K8s各种特性来满足复杂场景,例如混部场景,而相对地它也不再像spark-submit那样方便地提交任务,所以如何使用Spark Operator优雅提交任务将是在离线混部中一项重要的工作。</span></p> <p><span style="letter-spacing: 0.034em;"></span></p> </section> <p><br></p> <p><strong>2.1.2 最终选项</strong></p> <p><br></p> <p>在大的架构选型上,我们选择了Spark on K8s,一方面因为Spark3.X是vivo当前及未来2~3年的主流离线引擎,另一方面vivo有比较完善的K8s生态体系,内部对K8s研发也比较深入,环境和能力都能很好地支持,在应用的小方向上,我们选择了Spark Operator,因为它在混部这种复杂场景下使用更加灵活、扩展性更强、改造成本更低,我们最终决定使用Spark Operator方案。</p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">2.2 Spark优化</span></p> <p><br></p> <p><strong>2.2.1 Spark镜像</strong></p> <p><br></p> <p>Spark任务容器化的第一步就是构建具有Spark相关环境的镜像,Spark任务类型主要分为sql任务和jar任务,在实践的过程中我们发现Spark的镜像构建需要<strong>注意几个问题</strong>:</p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="margin-bottom: -2.25em;margin-right: 5px;background-color: rgb(247, 247, 247);"> <section style="padding: 10px;margin-bottom: 5px;"> <section style="text-align: left;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p><strong>Spark环境的完整性</strong>:镜像中除了打入自研的Spark包以外,还需要打入相应的依赖如Hadoop、ZSTD、RSS等包,对于SparkJar任务还有直接调用Hadoop客户端的,因此Hadoop客户端也需要打入镜像中。</p><p><br></p></li> <li><p><strong>JDK版本问题</strong>:K8s使用的Spark是基于3.2.0版本,镜像打包工具默认使用JDK11,而自研的Spark用的JDK1.8,由于在Yarn和K8s上使用的JDK版本不同,导致在双跑验证数据一致性时发现了hash函数、时间戳不一致的问题,因此Spark镜像中的JDK版本需要和Yarn保持一致。</p><p><br></p></li> <li><p><strong>环境变量问题</strong>:镜像生成容器后需要预置如Spark、Hadoop的环境变量,如果镜像中相关目录的位置不能完全和Yarn的提交节点保持一致,则需要检查各启动脚本,如spark-env.sh中的环境变量的路径是否存在,发生冲突时可以修改为绝对路径。</p></li> </ul> </section> </section> </section> <section style="margin-left: auto;width: 2.25em;height: 2.25em;border-right: 5px solid transparent;border-bottom: 5px solid transparent;"> <svg viewbox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg> </section> </section> <p><br></p> <p>Spark镜像构建完成后,区分SparkSql任务和SparkJar任务实质就是启动命令的不同,事实上SparkSql任务也就是SparkJar任务的一种,只是启动的主类是固定的,两者的启动参数如下:</p> <p><br></p> <section> <p>SparkSql任务:</p> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="javascript"><code><span class="code-snippet_outer">driver --<span class="code-snippet__class"><span class="code-snippet__keyword">class</span> <span class="code-snippet__title">org</span>.<span class="code-snippet__title">apache</span>.<span class="code-snippet__title">spark</span>.<span class="code-snippet__title">sql</span>.<span class="code-snippet__title">hive</span>.<span class="code-snippet__title">thriftserver</span>.<span class="code-snippet__title">SparkSQLCLIDriver</span> -<span class="code-snippet__title">f</span> </span>{sql文件}</span></code></pre> </section> <p><br></p> <p>SparkJar任务:</p> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="javascript"><code><span class="code-snippet_outer">driver --<span class="code-snippet__class"><span class="code-snippet__keyword">class</span> </span>{jar任务主类} {jar任务jar包} {参数}</span></code></pre> </section> <p><br></p> </section> <p>早期不仅构建了Spark镜像,还构建了Spark日志镜像,容器组成结构会复杂一些。如图例如Driver容器,我们将Spark、Hadoop等配置文件构建了configMap,启动initContainer来拉取从configMap拉取配置文件,然后启动Driver容器执行Spark任务,同时也使用sidecar创建日志上报的容器,在Spark任务运行完成后上报Driver和Executor日志到Spark HistoryServer。这样的方案看似充分应用了K8s技术,但是在实践的过程中这些技术却被一一弃用,转而逐步地把各种功能集中到了一个Driver容器上。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016836" data-ratio="0.36007462686567165" data-s="300,640" src="/upload/ed7e61eda435286a2e5a3acc90f77643.png" data-type="png" data-w="1072" style=""></p> <p><br></p> <p>具体演进如下:</p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p><strong>移除initContainer</strong>,拉取Spark等配置文件步骤写在启动命令中,Spark作业执行前执行下载配置,原因在多个namespace下不方便统一管理,而且configmap内容较大,会导致Pod启动时配置加载的延迟增加,影响了Pod创建速度,同时K8s的内存和CPU资源占用增加,对kube-apiserver、ETCD负载有一些影响。去掉initContainer还有个重要的好处就是减小ETCD的存储压力,事实上我们在移除initContainer拉取配置的功能后的一段时间内还保留着initContainer,在任务逐渐上量后发现ETCD的存储比较满,分析后发现Spark作业中的一个Pod生命周期大约8次更新,其中initContainer更新会占用2次,移除了之后理论上是可以减少1/4的ETCD存储,实际应用中完全去除了initContainer也确实能减小了ETCD的存储压力。</p><p><br></p></li> <li><p><strong>移除sidecar创建日志上报的容器</strong>,Driver和Executor日志上报步骤写在启动命令中,Spark作业执行完后再执行脚本上报,原因是sidecar在同一个Pod中与主容器共享相同的生命周期,不使用sidecar方式就能更快创建Pod,Spark任务执行完成后能更快释放资源。</p></li> </ul> </section> </section> </section> <p><br></p> <p>对于Spark作业会频繁创建、更新和销毁大量的Pod,所以去除非必要的容器,提高Pod生命周期流转速度,就能降低kube-apiserver、ETCD工作负载,也能提高Spark的作业效率。</p> <p><br></p> <p><strong>2.2.2 Spark改造</strong></p> <p><br></p> <p>Spark任务运行在K8s上,对于一些使用的兼容问题也进行了<strong>相关改造</strong>。</p> <p><br></p> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li> <section> <p><strong>HistoryServer改造</strong>,因为Spark Operator没有存储已结束作业的日志,因此参考了on Yarn的方式,在Spark作业结束后,通过日志上传脚本把Driver和Executor的日志上传HDFS,与Yarn日志聚合类似,同时也在Spark HistoryServer做了二次开发工作,增加了on K8s方式的日志查看接口,用户查看已完成的Executor日志时,不再请求JobHistory Server,而是请求Spark HistoryServer接口。但日志上传方式需要Executor执行完才能查看到日志,为了能实时查看到执行中的日志,可以在Executor内部实现一个HTTP服务,根据Pod以及端口信息拼接出日志请求URL,Executor启动一个Servlet自动获取本地日志并返回。日志查看体验上做到了基本与Yarn一致。</p> </section></li> </ul> <p><br></p> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li> <section> <p><strong style="letter-spacing: 0.034em;">主机ip通信</strong><span style="letter-spacing: 0.034em;">,Spark Driver和Executor之间的通信通常是通过主机名进行的,不过随着Spark任务增多,CoreDNS因为频繁的域名解释请求导致压力增大,甚至会影响到在线服务,因此我们将Hadoop的配置文件改为ip格式、设置Driver和Executor使用ip地址,同时去除了对应的K8s Service,通过访问ip而不是域名的方式来规避这个问题。</span></p> </section><p><br></p></li> <li><p><strong style="letter-spacing: 0.034em;">文件参数兼容</strong><span style="letter-spacing: 0.034em;">,Spark Driver在K8s上是运行在某一个Pod中的,所以文件需要是全局可视的,如HDFS文件,否则就会报文件未找到的错误,但Spark作业运行在大数据作业平台时有的任务使用的上传的本地文件,因此对于提交到K8s的任务,第一步是要把上传到大数据作业平台的文件再次上传到HDFS,第二步是改造add jar和--file等命令逻辑,Spark任务在未能读取本地文件后将再尝试读取二次上传到HDFS的文件,实现任务无需修改成全局可视的文件路径也能读取到文件。</span></p></li> </ul> <p><br></p> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li> <section> <p><strong>non-daemon线程终止</strong>,在K8s上运行的Spark任务是指定Client模式,Client模式下Driver遇到异常时停掉SparkContxet,等所有non-daemon线程结束后,Driver才会退出,但如果存在一直运行的non-daemon线程,那么Driver一直不退出,任务就一直处于执行中。因此需要改造成Cluster模式的异常退出机制,即异常时以非0退出码退出,不再等待其他的non-daemon线程结束,Driver直接终止,以确保Driver Pod的正常结束。</p> </section></li> </ul> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">2.3 Spark Operator优化</span></p> <p><br></p> <p>随着在K8s上运行的Spark任务不断增加,K8s集群的负载也逐渐显现。因此,需要对Spark Operator进行一系列优化,以减轻K8s集群的压力。</p> <p><br></p> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li> <section> <p><strong>离线使用独立的kube-apiserver</strong>,<span style="letter-spacing: 0.034em;">混部集群中离线容器占了很大一部分,而且离线任务由于生命周期短,容器创建销毁更加频繁,这对kube-apiserver造成了很大的压力,然而在线业务需要更高的稳定性,为了减少离线对在线业务的影响,我们拆分了kube-apiserver,离线任务通过指定master参数来使用独立的kube-apiserver。</span></p> </section><p><span style="letter-spacing: 0.034em;"></span></p></li> <li> <section> <p><strong>使用K8s的HostNetwork网络模式</strong>,<span style="letter-spacing: 0.034em;">在K8s上启动Driver与Executor虽然使用的是独立ip+固定端口,但频繁的ip申请和释放也对kube-apiserver造成了一定的压力,因此我们改为使用HostNetwork网络模式,同时不指定端口避免端口冲突。</span></p> </section><p><span style="letter-spacing: 0.034em;"></span></p></li> <li> <section> <p><strong>优化Spark Operator控制器的队列</strong>,<span style="letter-spacing: 0.034em;">在任务量比较大的情况下,Spark Operator对Pod创建消耗效率会遇到瓶颈,排查后发现是Spark Operator的事件处理队列的并发数和限速桶的默认配置地太小,因此我们调低Spark maxPendingPods参数,调高schedulerBacklogTimeout、 sustainedSchedulerBacklogTimeout参数,减少Pending Pod个数,使Pod的处理效率符合集群的承载水平。</span></p> </section><p><span style="letter-spacing: 0.034em;"></span></p></li> <li> <section> <p><strong>优化Spark Driver List Pod接口</strong><span style="letter-spacing: 0.034em;">,</span><span style="letter-spacing: 0.034em;">使用kube-apiserver缓存,避免对ETCD产生影响,同时修改Spark Driver清理Executor逻辑,直接Delete,减少List Pod对kube-apiserver压力。</span></p> </section><p><span style="letter-spacing: 0.034em;"></span></p></li> <li> <section> <p><strong>存储emptydir + log lv存储优化</strong><span style="letter-spacing: 0.034em;">,</span><span style="letter-spacing: 0.034em;">开发CSI插件,Spark任务的离线日志单独存储,避免对在线业务pod的影响和磁盘负载高等问题。</span></p> </section><p><span style="letter-spacing: 0.034em;"></span></p></li> <li> <section> <p><strong>Spark Secret标记immutable</strong><span style="letter-spacing: 0.034em;">,</span><span style="letter-spacing: 0.034em;">减少kubelet watch secret请求,降低kube-apiserver的负载。</span></p> </section></li> </ul> <section> <p><br></p> </section> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="padding-right: 1em;padding-left: 1em;display: inline-block;text-align: center;"> <span title="" style="padding: 0.3em 0.5em;display: inline-block;border-radius: 0.5em;font-size: 13px;text-shadow: rgb(204, 204, 204) 4px 3px;color: rgb(65, 95, 255);"><p>彩蛋提醒</p></span> </section> <section style="margin-top: -1em;padding: 20px 10px 10px;border-width: 1px;border-style: solid;border-color: rgb(192, 200, 209);background-color: rgb(239, 239, 239);text-align: center;"> <p>我们为大家准备了抽奖福利,请继续阅读下去。</p> </section> </section> <p style="margin-bottom: 0px;"><br style="color: rgb(62, 62, 62);font-size: 15px;letter-spacing: 0.578px;"></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>三、离线任务提交</p> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">3.1 平台任务提交平滑切换</span></p> <p><br></p> <p>离线任务容器化方案确定后就要落地到生产,目前有SparkSql和SparkJar两种离线任务实现了容器化,这里以SparkSql任务为例描述Spark提交到混部K8s集群的流程并达到与传统客户端提交任务几乎无差异的平滑切换。目前vivo的离线任务都是通过大数据平台进行提交和调度的,平台会把主要的提交流程进行封装形成简单操作的功能,例如在平台上提交SparkSql任务流程一般是编写sql、提交任务、查看Driver日志或在跳转到SparkUI、执行完成后获取结果以及更新任务状态。</p> <p><br></p> <p>在平台内部,SparkSql任务使用传统的spark-submit<strong>提交流程</strong>是:</p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ol class="list-paddingleft-1" style="list-style-type: decimal;"> <li><p>用户编写好的sql上传到提交节点生成一个sql文件;</p></li> <li><p>在提交节点使用Spark客户端执行该sql文件启动SparkSql任务;</p></li> <li><p>任务启动后,通过不断地tail操作查询日志转存到HBase方便在平台页面上查询到Driver日志;</p></li> <li><p>任务结束后,再查询输出结果转存到HBase方便在平台页面上查询到执行结果;</p></li> <li><p>根据提交sql任务命令的返回码来更新任务状态。</p></li> </ol> </section> </section> </section> <p><br></p> <p>传统Spark客户端提交任务大部分只会涉及到提交节点的客户端与平台服务器之间的交互,而SparkSql任务提交到混部K8s集群,从上节的Spark容器化方案的原理可知最终目的是要将Spark任务的任务参数按一定的格式封装好传入Spark Operator控制器来创建相关的容器,平台需要通过会调用容器团队提供的封装好K8sApi的统一接入层来创建Spark容器。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016837" data-ratio="0.5305555555555556" data-s="300,640" src="/upload/b41b9db3fb551864783be17f042015ea.png" data-type="png" data-w="1080" style=""></p> <p><br></p> <p>在平台内部,SparkSql任务提交到混部K8s集群的<strong>完整流程</strong>为:</p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <ol class="list-paddingleft-1" style="list-style-type: decimal;"> <li><p>用户编写好的sql上传到HDFS生成一个远程可访问的HDFS文件;</p></li> <li><p>SparkSql任务参数封装好传入容器接入层的createSpark接口来调用Spark Operator控制器容器,再由Spark Operator控制器创建Driver Pod,最后由Driver Pod根据Spark任务需要创建多个Executor Pod,这些Driver、Executor的Pod相当于Driver和Executor的角色,共同配合执行Spark作业;</p></li> <li><p>任务启动后,通过容器接入层的getDriverLog接口周期性地查询Driver日志,实质上是查询Driver容器的日志,查询到的Driver日志会转存到HBase方便在平台页面上查询;</p></li> <li><p>任务结束后,一方面通过Spark启动脚本中的日志上传命令,把Driver和Executor的日志上传HDFS,可以在改造后的Spark HistoryServer直接查看,另一方面执行结果也会先输出到HDFS,再从HDFS转存到HBase方便在平台页面上查询到执行结果;</p></li> <li><p>&nbsp;通过轮询接入层的getSpark接口根据返回的状态码来更新任务状态,在任务结束后,此时Driver Pod不会主动退出,首先将任务状态更新为成功,在日志和结果都存储完成后,再调用deleteSpark接口主动地杀死Driver Pod释放资源,完成整个Spark任务流程。</p></li> </ol> </section> </section> </section> <p><br></p> <section> <p>可以看出SparkSql任务提交到混部K8s的执行主体是容器,因此需要增加容器接入层来管理Spark相关的容器,同时容器的使用更倾向于存算分离的效果,因此需要使用HDFS作为远程文件中转。</p> <p><br></p> <p>大数据平台上传统使用spark-submit和onK8s使用spark-operator的SparkSql任务执行流程对比如下:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016838" data-ratio="0.4231770833333333" data-s="300,640" src="/upload/238a22e94139df10dcf38a422110bfbc.jpg" data-type="jpeg" data-w="768" style=""></p> <p><br></p> </section> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">3.2 混部任务的资源参数调整</span></p> <p><br></p> <section> <p>Spark任务的Driver和Executor,在Yarn上执行实质是运行在NodeManager节点上的,而在K8s上执行实质是运行在对应的Pod中的,由于Spark on K8s的提交方式和运行环境都不同于on Yarn,任务的资源参数不能直接套用,需要做一些参数调整才能提交到K8s上。</p> <p><br></p> <p><strong>1、资源参数提取和转换</strong></p> <p><br></p> <p>SparkSql任务在Yarn上可以灵活地调整sql中的配置来满足不同特性的任务,sql中的资源配置会覆盖客户端启动时的全局配置,因为Executor是运行在NodeManager节点上的,资源会相对充裕能满足Executor的资源需求,与此不同的是Spark on K8s的Executor是运行在Executor Pod中的,使用的资源会受到Pod资源规格大小的限制,而spark-operator的提交方式是要先获取Executor全局资源规格并生成相应资源规格大小的Executor Pod,所以在提交Spark任务到K8s前就要准确地获取任务真正生效的资源参数。在大数据平台中资源参数会存在多中类型的参数中,参数的优先级为:任务配置参数 &lt; 任务模板参数 &lt; sql中设置参数 &lt; HBO优化参数 &lt; 平台统一参数,按此优先级顺序依次提取最终的资源参数并传入容器接入层创建Spark作业。另外容器接入层对于Spark的arguments和sparkConf参数都是要求以字符数组的方式传入,需要做好对原任务参数中的单引号、双引号、反斜杠和回车等符号以及分段落的处理和转换。</p> <p><br></p> <p><strong>2、overheadMemory的计算</strong></p> <p><br></p> <p>在Yarn上Executor是运行在NodeManager节点上的,节点的资源一般都大于并能满足container申请的资源,所以在Yarn上只需要关心container本身申请的资源即可,而在K8s上Executor运行在对应的Pod中,可以把Pod理解为只一台独立的节点,除了要满足container申请的资源量,还需要一些Pod容运行时网络、存储等基础设施的自身开销资源,如果把Spark任务中Driver和Executor申请的资源直接设置为K8s中Driver Pod和Executor Pod的资源规格,有可能出现OOM情况,另外还要考虑非JVM内存,Spark默认会把申请的Executor内存乘以一个系数或者至少预留384 MiB内存作为额外的非JVM内存缓冲区,用于堆外内存分配、非JVM任务以及各类系统进程的使用,可以通过设置overheadMemory进行覆盖。因此K8s的Pod除了要满足申请的Memory和运行时需要的overheadMemory的资源,还会再添加100M资源用于Pod运行的自身开销。</p> <p><br></p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <p>pod的资源规格 = memory + pod overheadMemory</p> </section> </section> </section> <section> <p><br></p> <p>对于overheadMemory也需要先获取到并加到Pod的资源规格,如果任务有配置就直接使用配置的overheadMemory,如果没有配置值则按一定计算公式来计算得到。</p> <p><br></p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <p><strong>有配置</strong>:</p> <p>pod overheadMemory = overheadMemory + 100M</p> <p><br></p> <p><strong>无配置</strong>:</p> <p>pod overheadMemory = (max(384M,0.1*memory))向上取整到512MB的整数倍 + 100M</p> </section> </section> </section> <section> <p><br></p> <p>不过在实际应用中发现对于个别任务,即使K8s上配置的overheadMemory比在Yarn的配置多100M,完全一样的任务在K8s上则有较多的Executor OOM情况,而在Yarn上却完全没有,目前排查到的现象是有JVM堆外的内存无法回收,如果任务需要较多的对外内存,堆外内存一直增长最终导致OOM,但哪些内存无法回收的还未排查到。目前对于这些OOM过多且实际影响到运行效率的任务,在原overheadMemory基础上再增加512M后就没有OOM情况了,同时也有采用了大数据平台的HBO能力自动调整内存参数来事后规避这个问题。</p> <p><br></p> <p><strong>3、CPU超分配置</strong></p> <p><br></p> <p>Spark任务申请的CPU使用一般不会使用完,事实上Executor Pod的CPU利用率也并不是很高,比如Executor申请1个核,通常只能利用0.6个核,存在CPU浪费的现象。Executor Pod的资源规格是创建的时候分配的,利用容器的能力,可以采取CPU超分的方式提高CPU的利用率,例如Executor申请1核,实际用0.6核,如果Pod分配1核,那利用率就只有60%,但如果Pod只分配0.8核,那利用率就有75%了,所以超分的策略就是申请了1核只给0.8核,但还是要按1核的申请量来运行任务。目前平台使用的是静态的固定比例超分设置为0.8,实施超分配置策略后Pod的实际CPU利用率打到80%以上。</p> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016839" data-ratio="0.28703703703703703" data-s="300,640" src="/upload/cf14e825d02cd408366c3927a869e4e2.png" data-type="png" data-w="1080" style=""></p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">3.3 混部任务的筛选提交</span></p> <p><br></p> <p>经过上面的任务提交方式的改造和任务资源参数的调整,原SparkSql和SparkJar任务就可以平滑切换提交到混部K8s上执行了,但在大规模切换之前平台还做了比较长期的双跑验证工作,在执行成功率、数据一致性和执行时效等方案都进行了双跑比较,双跑通过的任务才能切换到K8s上执行。除了双跑通过,前期还设置了其他的筛选条件如下。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016840" data-ratio="0.13796296296296295" data-s="300,640" src="/upload/c09ff4326f48df14d8e0cbd09001f33a.jpg" data-type="jpeg" data-w="1080" style=""></p> <p><br></p> <section> <p>前期按这些条件筛选出可以提交到K8s的任务,然后分批的进行K8s任务的参数标记,并把标记的这批任务添加监控进行跟踪。经过双跑验证、任务筛选、批量标记、监控跟踪和问题解决这一整套SparkSql任务上量K8s的流程,K8s上的任务运行逐步稳定,K8s的兼容问题也基本解决,因此目前取消了双跑通过的这一条件,主要保留了任务重要性、运行时长和重试次数这几个筛选指标。随着SparkSql任务上量和稳定,提交到K8s的任务类型也增加了SparkJar任务,SparkJar任务无法进行双跑验证,所以在各种K8s兼容问题解决后再推进会更加稳妥。</p> <p><br></p> <p>目前大数据平台会定期筛选和标记一批SparkSql和SparkJar任务允许提交到混部K8s,用户也可以自行开启,在任务配置页面只显示已开启混部,则该任务就有机会被提交到混部K8s上执行。当然,用户也可以手动关闭这一开关,并且手动操作的优先级最高,手动关闭后平台的自动开启功能将不再生效。</p> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>四、弹性调度系统</p> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.1 弹性调度功能矩阵</span></p> <p><br></p> <p>Spark任务开启了混部也不是必定能提交到混部,最终能不能在混部集群上执行,还要根据当时混部集群的资源和运行情况等来确定,为了更好地协调离线任务和混部集群的供需关系,大数据平台构建了离线任务混部弹性调度系统。弹性调度系统的设计目是混部集群有资源了就调度离线任务,但在生产环境中不管是混部集群还是离线任务都会各自的问题需要解决和优化的需求,弹性调度系统也逐步演变成了全面管理离线任务提交到混部以实现混部资源最大化利用的功能矩阵。</p> <p><br></p> <p><strong>4.1.1 资源水位线调度</strong></p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016841" data-ratio="0.38425925925925924" data-s="300,640" src="/upload/97176028dc1745ed57fcc54c31410c3b.png" data-type="png" data-w="1080" style=""></p> <p><br></p> <p>弹性调度的流程,任务按调度时间以任务流的形式过来,如果任务标记了允许提交到混部,那就会先去查询K8s的各个集群,如果某一个集群资源充足就直接提交到K8s,如果当时没有足够资源就等待资源再判断,这里分为有三类任务,第一类是一直等K8s资源,永不超时,只会提交到K8s;第二类是长时间等待,超时时间在1到5分钟,可以等久一点;第三类是短时等待,超时时间为30-60秒,稍微等一下,如果K8s没有资源就回到Yarn上执行,目前平台标记的任务大部分任务都是第三类短时等待。</p> <p><br></p> <p>混部集群提供给离线任务的资源是呈潮汐波动的,使用百分比的水位线方式才能更好地贴合资源的波动情况。混部集群提供的资源是指CPU和内存,但离线任务一般不能百分之百地获取到这部分资源,需要设置一个折算比例也就是水位线来计算出离线任务能使用的真正资源是多少,水位线的设置需要考虑<strong>几个因素</strong>:</p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="margin-bottom: -2.25em;margin-right: 5px;background-color: rgb(247, 247, 247);"> <section style="padding: 10px;margin-bottom: 5px;"> <section style="text-align: left;"> <ol class="list-paddingleft-1" style="list-style-type: decimal;"> <li><p><strong>混部集群的碎片化率</strong>,混部集群中的机器规格和正在运行的业务占用量都是不确定的,但一般大规格的机器多的集群碎片化率较低,所以小规格的机器多的集群的水位线要设置低一点。</p><p><br></p></li> <li><p><strong>资源动态分配容纳率</strong>,对于开启了动态分配的Spark任务,无法提前知道任务所需的资源,需要留有一部分资源用于动态分配的消耗,如果同样的水位线资源规模大的混部集群容纳率会高,所以资源规模小的集群的水位线要设置低一点。</p><p><br></p></li> <li><p><strong>资源配比的均衡性</strong>,不同的集群或者同一集群的不同时间段的CPU和内存配比可能会存在很大的差异,例如Spark任务的CPU和内存的平均比例是1核6G,即1:6,如果有CPU和内存比为1:2的,内存会被用完而CPU有剩余,此时为了内存留有部分余量,水位线要设置低一点。</p></li> </ol> </section> </section> </section> <section style="margin-left: auto;width: 2.25em;height: 2.25em;border-right: 5px solid transparent;border-bottom: 5px solid transparent;"> <svg viewbox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg> </section> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <p>混部资源可用量 = 混部资源提供量 * 资源水位线</p> </section> </section> </section> <p><br></p> <p>资源水位线有CPU水位线和内存水位线,设计时以CPU或内存中的最低水位线为准,哪个资源先分配完就停止提交任务,不过在实际生产中大部分混部集群都是受内存限制较多,个别时段CPU比内存多但通过其他的限制手段即使CPU满载对任务影响不大,因此目前只开启了内存资源水位线。以上提到的3点可以当成集群的固有消耗需要保留有一定的余量,为了直观地控制混部资源使用率和引入优先策略,计算方式调整为:</p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <p>混部资源可用量 = 混部资源提供量 * (1-余量水位线) * 优先水位线</p> </section> </section> </section> <p><br></p> <p>余量水位线根据各个集群来调整,一般为0.05,优先水位线的范围可以在0-1之间。优先水位线的作用是对于一些符合优先条件的任务可以优先提交,但是任务调度是一有任务就要调度的流式调度,不能够先集中再挑选优先任务而是先到先得,所以要为优先任务预留一部分资源,例如优先水位线为0.8,混部资源使用到0.8以下的时候任何任务都可以调度上来,但使用量超过了0.8,那只有优先任务能调上来,也就是为优先任务预留了0.2的资源,当然即使资源使用量达到了1,由于余量水位线的存在,实际的使用量为0.95,混部集群仍有资源维持周转。优先水位线是最常用的调整参数,它实质就是控制混部任务提交量,不仅能调整混部资源的使用量,还在灰度测试、压力测试和问题排查等事项起到了灵活调节的作用。</p> <p><br></p> <p><strong>4.1.2 其他调度能力</strong></p> <p><br></p> <section> <p><strong>1.多集群管理</strong>:混部集群通常会有多个,vivo目前就有多个生产环境的混部集群,各混部集群由于建设周期、机器规格和业务接入的不同,混部资源的规模和变化趋势都会呈现比较大的差异,因此每个集群的调度策略配置都需要做到能独立调整来适应各自的资源特点。</p> <p><br></p> <p><strong>2.分时段控制</strong>:每个混部集群上的在线业务一般是潮汐波动的,给到离线任务的资源也是潮汐波动的,因此每个集群需要做到在每天不同时段可以调整不同的调度策略,尤其在波峰波谷差异较大的时间段各自调整配置的差异会更大。</p> <p><br></p> <p><strong>3.分散namespace</strong>:Spark任务的Driver Pod和Executor Pod都会放在一个namespace中管理,如果所有任务都由一个namespace管理,那需要管理的pod数量会达到数十万的级别,会对K8s集群的性能和稳定性产生影响。因此需要将Spark任务平均分配到多个namespace,采用的方案是轮询填充,任务优先分配到多个namespace中任务最少namespace。</p> <p><br></p> <p><strong>4.失败回退Yarn</strong>:离线任务混部推进的过程中还有会有Spark兼容问题、混部集群异常和平台变更等问题导致的离线任务在混部K8s上运行失败,为了减少失败对任务的影响,任务在K8s上首次执行失败后就会自动回到Yarn重新执行。</p> <p><br></p> <p><strong>5.资源准入粒度</strong>:各混部集群的机器规格和碎片率是不一样的,如executorMemory=2G这样较小粒度的Spark任务即使碎片率较高的混部集群可以填充,而对于executorMemory=16G这样较大粒度的Spark任务,机器规格大的集群才更容易获取到资源,因此不同混部集群可以设置不同的准入粒度,小规格和碎片率高的集群准入粒度可以设置小一些。</p> <p><br></p> <p><strong>6.任务偏好配置</strong>:对于一些灰度任务和特殊要求的任务,例如只有在0到8点才允许提交到混部、只提交到某几个指定的混部集群等调度要求,需要支持任务偏好配置,在任务参数中调整混部控制参数实现相应的调度需求。</p> <p><br></p> </section> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.2 弹性调度策略优化</span></p> <p><br></p> <p>弹性调度的核心是通过资源水位线的调节,有混部资源就调度离线任务,但实际生产中还要考虑混部集群的运行情况,是否能稳定地接收和消化离线任务,同时在存在多个差异较大的集群时提交到哪个集群最优。</p> <p><br></p> <p><strong>4.2.1 任务调度稳定优化</strong></p> <p><br></p> <p>大数据平台的离线任务提交高峰在凌晨时段而且调度时间集中在整点半点,还有5分和10分这样的整分,例如03:00调度的任务达1000个,但在03:01调度的任务只有10个,过于集中地提交任务会导致混部集群Pending Pod数量急剧上升,这是因为无论是查询集群资源还是Pending数的接口,更新数据都需要一定的周期时间,而且离线任务提交上去到获取资源也受K8s的调度时间的影响,所以获取集群运行情况总会滞后于任务提交。例如03:00查询集群是有资源的并且是健康的,由于任务开启了动态分配所以不能确定需要多少资源,此时集中提交了1000个任务,这1000个任务首先会创建1000个Driver Pod,集群资源还是能满足的并且优先创建,假如每个Driver需要创建100个Executor,如果集群没有这么多资源,那就会产生大量的Penging Pod,严重影响集群的性能和稳定以及任务的执行效率,因此需要对弹性调度的稳定性进行优化。</p> <p><br></p> <section> <p><strong>短时提交限制</strong>:避免集中提交任务的直接方案就是根据各混部集群的资源规模设置短时提交的任务数量限制,例如1分钟内只能提交100个任务,集群短时间内Pending Pod数量会增加但仍在可以承受范围内,集群和任务都会稳定运行。短时提交限制相当于拦截并舍弃了部分某个时间点集中提交的任务,这里相当于舍弃了900个任务,那么提交的总任务量就减少了。</p> <p><br></p> <p><strong>延迟打散提交</strong>:为解决短时提交限制导致舍弃部分任务的问题,增加了短时延迟打散提交,例如03:00提交的1000个任务,随机打散到03:00到03:03的3分钟内,即使有短时提交限制,这3分钟内也可以提交300个任务。理论上将集中提交的任务延迟更久,能提交到混部的任务会更多,但是增加延迟时长就等于增加任务的执行时长,会影响到业务数据产出的及时性,因此延迟打散提交策略只能是短时的,进一步的优化是执行时长更久的任务延迟更久一点,但根本解决方案还是用户能将调度时间尽量打散。</p> <p><br></p> <p><strong>集群反馈限制</strong>:短时提交限制和延迟打散提交都属于静态限制,需要人为地根据各个混部集群的情况去判断和设置限制值,因此需要做到动态限制,就需要获取集群的运行情况并根据运行情况进行限制。事实上K8s的调度性能相比于Yarn还是有差距的,从提交的Spark任务到获取到资源运行Pod有一定的滞后时间差,这段时间查询内还是有剩余资源,但如果还继续提交新任务就会产生更多Pending Pod,因此需要做集群运行情况的反馈控制,例如查询Pending Pod数、等待的SparkApp数,当数量达到一定数量就不再提交新任务。</p> </section> <p><br></p> <p>集群反馈限制虽然是动态的能根据混部集群情况进行反馈调节,但是查询集群状态是滞后的,这种滞后的控制就容易被集中提交给打垮,所以要加上短时提交限制来上一道保险,为缓解短时提交限制造成的任务损失,就引入了延迟打散提交,而在延时打散的过程中集群能逐步消化任务,查询集群状态逐步接近真实情况,这时又可以交给集群反馈限制来动态调节,逐步从突增恢复到稳定,三个调度稳定优化策略相辅相成。</p> <p><br></p> <p><strong>4.2.2 集群分配均匀优化</strong></p> <p><br></p> <p>离线任务会调度到多个混部集群,每个集群的资源总量和可用资源量,以及集群运行状况都不相同,为保证离线任务的运行稳定和执行效率,需要在多个混部集群中选择一个最合适的集群。各个集群会按一定的规则进行排序,离线任务会按这个排序依次轮询各个集群,只要集群剩余资源满足且没有被短时提交限制、集群反馈限制等拒绝,离线任务就提交到该集群。集群排序的<strong>演化顺序</strong>如下:</p> <p><br></p> <p>①初始方案</p> <section style="margin: 10px 0% 8px;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;width: 100%;border-left: 3px solid rgb(65, 95, 255);border-bottom-left-radius: 0px;padding-left: 8px;align-self: flex-start;"> <section style="text-align: justify;width: 100%;"> <p><strong>排队队列+轮询</strong></p> <p>剩余资源量多的优先</p> </section> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016842" data-ratio="0.5052631578947369" data-s="300,640" src="/upload/743b01c6bbe53c4f345d67305679ef23.png" data-type="png" data-w="380" style=""></p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <p><strong>优点</strong></p> <p>离线任务优先提交到资源最多的集群,保证离线任务运行稳定</p> <p><br></p> <p><strong>缺点</strong></p> <p>对于小集群剩余资源量很小一直分配不到任务容易“饿死”(事实上有的小集群全部资源量都达不到一个大集群的20%)</p> </section> </section> </section> <p><br></p> <p>② 优化方案</p> <section style="margin: 10px 0% 8px;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;width: 100%;border-left: 3px solid rgb(65, 95, 255);border-bottom-left-radius: 0px;padding-left: 8px;align-self: flex-start;"> <section style="text-align: justify;width: 100%;"> <p><strong>随机队列+排序队列+轮询</strong></p> <p>将资源使用量超过一定比例的集群放到排序队列,剩余的集群放到随机队列</p> </section> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016843" data-ratio="0.5119363395225465" data-s="300,640" src="/upload/097426418dd1b083d6c10dde28077187.png" data-type="png" data-w="377" style=""></p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <p><strong>优点</strong></p> <p>离线任务优先提交到资源较多的集群,即保证任务的运行稳定,随机的方式也能均匀“喂饱”每个集群</p> <p><br></p> <p><strong>缺点</strong></p> <p>随机分配在大任务量时相当于是平均分配,每个集群都会调度差不多的任务量,当前情况会存在整点集中提交大量任务,小集群接收和大集群同样任务量会抗不住,影响任务执行稳定和效率,小集群容易“撑死”</p> </section> </section> </section> <p><br></p> <p>③再优化方案</p> <section style="margin: 10px 0% 8px;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;width: 100%;border-left: 3px solid rgb(65, 95, 255);border-bottom-left-radius: 0px;padding-left: 8px;align-self: flex-start;"> <section style="text-align: justify;width: 100%;"> <p><strong>加权随机队列+排序队列+轮询</strong></p> <p>按剩余资源进行加权随机,剩余资源多的集群有更多概率分配到任务</p> </section> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016844" data-ratio="0.5283018867924528" data-s="300,640" src="/upload/6ba47e70e03ac6f4b552b82aa9022f29.png" data-type="png" data-w="371" style=""></p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <p><strong>优点</strong></p> <p>离线任务优先提交到资源较多的集群,“大集群多吃,小集群少吃”,每个集群都能填充同时保证任务的运行稳定</p> </section> </section> </section> <p><br></p> <p>④ 最终方案</p> <section style="margin: 10px 0% 8px;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;width: 100%;border-left: 3px solid rgb(65, 95, 255);border-bottom-left-radius: 0px;padding-left: 8px;align-self: flex-start;"> <section style="text-align: justify;width: 100%;"> <p><strong>优先队列(排序)+加权随机队列+排序队列+轮询</strong></p> <p>考虑优先队列,无视其他排序规则,优先队列里的集群将最优先,在优先队列中的集群再按资源排序</p> </section> </section> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016845" data-ratio="0.4852216748768473" data-s="300,640" src="/upload/989df0f7327dd2a6f5f19f975c62eec8.png" data-type="png" data-w="406" style=""></p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: rgb(160, 160, 160);padding: 10px;"> <section style="text-align: justify;line-height: 1.8;padding-right: 5px;padding-left: 5px;"> <p><strong>优点</strong></p> <p>继承上一方案的优点,同时对于特定项目或机房的离线任务,能优先调度到某些特定的集群</p> </section> </section> </section> <p><br></p> <p>目前只以内存作为资源水位线的衡量标准,这里的资源量指的是内存量。最开始方案是按集群的剩余资源排序,内存资源剩余多的集群优先,缺点是小集群一直分配不到任务容易“饿死”,然后使用随机的方式也能均匀“喂饱”每个集群,但小集群接收同样任务量时容易“撑死”,于是随机队列按剩余资源进行加权随机,剩余资源多的集群有更多概率分配到任务,这样离线任务优先提交到资源较多的集群,“大集群多吃,小集群少吃”,每个集群都能填充同时保证任务的运行稳定,在此基础上增加优先队列,无视其他排序规则,优先队列里的集群将最优先,在优先队列中的集群再按资源排序,能优先调度到某些特定的集群,形成最终集群选择排序方案。</p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p>五、混部的效果与未来规划</p> </section> </section> <p><br></p> <section> <p>经过以上的对Spark组件、K8s混部系统、大数据平台以及弹性调度系统的改造和优化,目前混部集群及提交混部的离线任务运行持续稳定,每天任务调度到混部的次数达10+万次,在凌晨的高峰期通过混部能为离线任务额外增加数百TB内存的计算资源,部分混部集群的CPU利用率提升至30%左右,整体收益也是可观的。</p> <p><br></p> <p>虽然目前vivo的在离线混部达到了一定的规模,但未来要继续提高混部的规模和收益,还有规划一些改进工作。</p> <p><br></p> </section> <section> <p><strong>1、提高离线任务混部规模</strong>。</p> <p>离线任务混部的节点是在线业务提供的,节点规模取决于在线业务峰值,峰值越高那么在业务低峰期能提供给离线混部资源就越多,因此提高混部规模的重要因素是提交更多的离线任务。然而目前采用的Spark Operator方案能提交的离线任务只有标准的SparkSql和SparkJar任务,而对于非标准的任务如脚本任务,脚本中除了调用spark-submit提交Spark作业还有额外的处理逻辑,这类任务还不能直接以Spark Operator的方式提交。事实上Spark作业更多是来自脚本任务的非标准任务,如果要继续增加离线任务的量,就必须把非标准任务也提交到混部,因此后续是选择改造spark-submit客户端支持Spark Operator,或是选择使用Yarn on K8s,还需要综合评估。</p> <p><br></p> <p><strong>2、提高离线任务混部收益</strong>。</p> <p>目前混部节点CPU的平均利用率达到30%,但仍有提升空间。从离线任务的角度来看,一方面是要增加错峰互补的时间段,例如离线任务的高峰期是02:00到08:00,在线业务的高峰期是06:00到23:00,在06:00后在线业务逐步上量开始回收资源,所以离线任务能显著提高混部集群CPU利用率的黄金时间是有02:00到06:00这4个小时,因此如果能把离线任务高峰期提前到00:00到06:00,混部提效的黄金时间就能达到6小时。所以需要推动离线任务高峰期的前移,对于有依赖链路的任务,尽量减少调度时间的间隔,上游任务完成后能尽快调起下游任务,而对于没有依赖的任务,可以尽量提前调度时间,不过这两种调整都需要推动业务方来调整,平台也可以给予一定的计算成本优惠作为激励。另一方面是要提高混部资源的填充率,Spark任务需要创建大量的Executor Pod,目前混部集群的调度器为了保证调度效率就没有开启预选、优先策略,事实上Spark的资源粒度比较小更适合填充资源碎片,所以在不影响K8s调度效率的情况下优化资源调配策略,把合适的资源粒度的Pod分配到合适的混部节点,也是提高混部收益的方向。</p> </section> </section>

RAG优化策略总结

作者:微信小助手

<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="font-size: 16px;color: black;padding: 0 10px;line-height: 1.6;word-spacing: 0px;letter-spacing: 0px;word-break: break-word;word-wrap: break-word;text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;" data-pm-slice="0 0 []"> <h1 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 24px;"><span style="display: none;"></span><span leaf="">一、背景</span></h1> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">目前LLM虽然已经具备了强大的能力,但是在某些情况下,它们仍可能无法提供准确的答案。目前 LLM 面临的主要问题有:</span></p> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">信息偏差/幻觉:</span></strong><span leaf="">&nbsp;LLM 有时会产生与客观事实不符的信息,导致用户接收到的信息不准确。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">知识更新滞后性:</span></strong><span leaf="">&nbsp;LLM 基于静态的数据集训练,这可能导致模型的知识更新滞后,无法及时反映最新的信息动态。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">领域专业知识能力欠缺</span></strong><span leaf="">:LLM通常基于公开数据集训练,在处理特定领域的专业知识时,效果不太理想。</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">对于 Transformer架构类型的大模型来说,想要提高LLM生成内容的准确性,一般只需要 3 个步骤:</span></p> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">提供更准确的内容</span></strong><span leaf="">:提供准确性更高的内容,会让 LLM 能识别到关联的内容, 生成的内容准确性更高。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">让重要的内容更靠前</span></strong><span leaf="">:GPT 模型的注意力机制会让传递 Prompt中更靠前的内容权重更高,越靠后权重越低。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">不传递不相关内容</span></strong><span leaf="">:缩短每个块的大小,尽可能让每个块只包含关联的内容,缩小不相关内容的比例。</span> </section></li> </ol> <h1 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 24px;"><span style="display: none;"></span><span leaf="">二、RAG流程简介</span></h1> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">RAG 是一个完整的系统,其工作流程可以简单地分为数据预处理、检索、增强和生成四个阶段:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/215f896d5fb4b96aba9dd6167cf51b2e.png" class="rich_pages wxw-img" data-ratio="0.6087533156498673" data-type="png" data-w="754" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000575"></span> </figure> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">数据处理阶段:</span></strong><span leaf="">对原始数据进行清洗和处理,然后将处理后的数据转化为检索模型可以使用的格式,最后存储在对应的数据库中。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">检索阶段:</span></strong><span leaf="">将用户的问题输入到检索系统中,从数据库中检索相关信息。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">增强阶段:</span></strong><span leaf="">对检索到的信息进行处理和增强,以便生成模型可以更好地理解和使用。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">生成阶段:</span></strong><span leaf="">将增强后的信息输入到生成模型中,生成模型根据这些信息生成答案。</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">一个完整的RAG应用开发流程,涉及到文档加载器、向量数据库、检索器、Prompt、记忆、输出解析器、大语言模型、多个功能模块,如下所示:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/68405a4ef4515372a3d39a3331df0a65.png" class="rich_pages wxw-img" data-ratio="0.5388888888888889" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000576"></span> </figure> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">通常RAG的优化策略主要分为:查询转换、路由、问题构建、索引、检索和生成六个方面进行,如下与所示:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/0c01733e574b41affd37533183dacf00.png" class="rich_pages wxw-img" data-ratio="0.7833333333333333" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000579"></span> </figure> <h1 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 24px;"><span style="display: none;"></span><span leaf="">三、RAG优化</span></h1> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 22px;"><span style="display: none;"></span><span leaf="">3.1 查询转换</span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.1.1 查询重写和融合策略</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">如果直接使用原始问题进行检索,可以因为用户的表述偏差导致检索不到相关的文档。多查询重写策略的核心思想是</span><strong style="font-weight: bold;color: black;"><span leaf="">利用大语言模型(LLM)对原始问题进行扩展、分解或抽象,生成多个语义相关但视角不同的子查询</span></strong><span leaf="">,从而提高检索系统对用户意图的覆盖能力。这种方法能有效解决单一查询可能存在的表述偏差或信息不全问题。整体流程如下所示:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/62d4da57a57935ad03fc98800763dc04.png" class="rich_pages wxw-img" data-ratio="0.2657407407407407" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000577"></span> </figure> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">一个简易的prompt如下所示:</span></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你的任务是为给定的用户问题生成</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3</span></span><span leaf="">&nbsp;-&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">5</span></span><span leaf="">个语义等价但表述差异化的查询变体,目的是帮助用户克服基于距离的相似性搜索的一些局限性,以便从向量数据库中检索相关文档。</span><span leaf=""><br></span><span leaf="">以下是原始问题:</span><span leaf=""><br></span><span leaf=""> <question></question></span><span leaf=""><br></span><span leaf="">{{question}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">请生成</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3</span></span><span leaf="">&nbsp;-&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">5</span></span><span leaf="">个语义与原始问题等价,但表述不同的查询变体,用换行符分隔这些替代问题。</span><span leaf=""><br></span><span leaf="">请在&lt;查询变体&gt;标签内写下你的答案。</span><span leaf=""><br></span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">由于需要转换问题一般较小,以及生成子问题时对 LLM 的能力要求并不高,在实际的 LLM 应用开发中,</span><strong style="font-weight: bold;color: black;"><span leaf="">通常使用参数较小的本地模型+针对性优化的 prompt 即可完成任务,并将&nbsp;</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">temperature</span></code><span leaf="">&nbsp;设置为&nbsp;</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">0</span></code><span leaf="">,确保生成的文本更加有确定性。</span></strong></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">调用样例如下:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/fb1e8e7295c417aaa62de34f23d19be7.png" class="rich_pages wxw-img" data-ratio="0.4888888888888889" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000578"></span> </figure> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在多查询重写策略中,每个子问题都会检索出相应的文档片段。针对如何合并这些文档的问题,便延伸出多查询结果融合策略。主要思想对其检索结果进行重新排序(即 reranking)后输出 Top K 个结果,最后再将这 Top K 个结果喂给 LLM 并生成最终答案</span><strong style="font-weight: bold;color: black;"><span leaf="">。通常使用的算法是RRF(Reciprocal Rank Fusion),即倒排序排名算法</span></strong><span leaf="">。公式如下:</span></p><span style="cursor:pointer;" data-tool="mdnice编辑器"> <section role="presentation" data-formula="RRF_{score}(d \in D) = \sum_{r \in R} \frac{1}{k + r(d)} " data-formula-type="block-equation" style="display: block;text-align: center;overflow: auto;display: block;-webkit-overflow-scrolling: touch;"> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -1342 14065.4 2570.2" aria-hidden="true" style="-webkit-overflow-scrolling: touch;vertical-align: -2.779ex;width: 31.822ex;height: 5.815ex;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="mi"> <path data-c="52" d="M230 637Q203 637 198 638T193 649Q193 676 204 682Q206 683 378 683Q550 682 564 680Q620 672 658 652T712 606T733 563T739 529Q739 484 710 445T643 385T576 351T538 338L545 333Q612 295 612 223Q612 212 607 162T602 80V71Q602 53 603 43T614 25T640 16Q668 16 686 38T712 85Q717 99 720 102T735 105Q755 105 755 93Q755 75 731 36Q693 -21 641 -21H632Q571 -21 531 4T487 82Q487 109 502 166T517 239Q517 290 474 313Q459 320 449 321T378 323H309L277 193Q244 61 244 59Q244 55 245 54T252 50T269 48T302 46H333Q339 38 339 37T336 19Q332 6 326 0H311Q275 2 180 2Q146 2 117 2T71 2T50 1Q33 1 33 10Q33 12 36 24Q41 43 46 45Q50 46 61 46H67Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628Q287 635 230 637ZM630 554Q630 586 609 608T523 636Q521 636 500 636T462 637H440Q393 637 386 627Q385 624 352 494T319 361Q319 360 388 360Q466 361 492 367Q556 377 592 426Q608 449 619 486T630 554Z"></path> </g> <g data-mml-node="mi" transform="translate(759, 0)"> <path data-c="52" d="M230 637Q203 637 198 638T193 649Q193 676 204 682Q206 683 378 683Q550 682 564 680Q620 672 658 652T712 606T733 563T739 529Q739 484 710 445T643 385T576 351T538 338L545 333Q612 295 612 223Q612 212 607 162T602 80V71Q602 53 603 43T614 25T640 16Q668 16 686 38T712 85Q717 99 720 102T735 105Q755 105 755 93Q755 75 731 36Q693 -21 641 -21H632Q571 -21 531 4T487 82Q487 109 502 166T517 239Q517 290 474 313Q459 320 449 321T378 323H309L277 193Q244 61 244 59Q244 55 245 54T252 50T269 48T302 46H333Q339 38 339 37T336 19Q332 6 326 0H311Q275 2 180 2Q146 2 117 2T71 2T50 1Q33 1 33 10Q33 12 36 24Q41 43 46 45Q50 46 61 46H67Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628Q287 635 230 637ZM630 554Q630 586 609 608T523 636Q521 636 500 636T462 637H440Q393 637 386 627Q385 624 352 494T319 361Q319 360 388 360Q466 361 492 367Q556 377 592 426Q608 449 619 486T630 554Z"></path> </g> <g data-mml-node="msub" transform="translate(1518, 0)"> <g data-mml-node="mi"> <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="TeXAtom" transform="translate(643, -150) scale(0.707)" data-mjx-texclass="ORD"> <g data-mml-node="mi"> <path data-c="73" d="M131 289Q131 321 147 354T203 415T300 442Q362 442 390 415T419 355Q419 323 402 308T364 292Q351 292 340 300T328 326Q328 342 337 354T354 372T367 378Q368 378 368 379Q368 382 361 388T336 399T297 405Q249 405 227 379T204 326Q204 301 223 291T278 274T330 259Q396 230 396 163Q396 135 385 107T352 51T289 7T195 -10Q118 -10 86 19T53 87Q53 126 74 143T118 160Q133 160 146 151T160 120Q160 94 142 76T111 58Q109 57 108 57T107 55Q108 52 115 47T146 34T201 27Q237 27 263 38T301 66T318 97T323 122Q323 150 302 164T254 181T195 196T148 231Q131 256 131 289Z"></path> </g> <g data-mml-node="mi" transform="translate(469, 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="mi" transform="translate(902, 0)"> <path data-c="6F" d="M201 -11Q126 -11 80 38T34 156Q34 221 64 279T146 380Q222 441 301 441Q333 441 341 440Q354 437 367 433T402 417T438 387T464 338T476 268Q476 161 390 75T201 -11ZM121 120Q121 70 147 48T206 26Q250 26 289 58T351 142Q360 163 374 216T388 308Q388 352 370 375Q346 405 306 405Q243 405 195 347Q158 303 140 230T121 120Z"></path> </g> <g data-mml-node="mi" transform="translate(1387, 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(1838, 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> </g> <g data-mml-node="mo" transform="translate(3840.2, 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(4229.2, 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="mo" transform="translate(5027, 0)"> <path data-c="2208" d="M84 250Q84 372 166 450T360 539Q361 539 377 539T419 540T469 540H568Q583 532 583 520Q583 511 570 501L466 500Q355 499 329 494Q280 482 242 458T183 409T147 354T129 306T124 272V270H568Q583 262 583 250T568 230H124V228Q124 207 134 177T167 112T231 48T328 7Q355 1 466 0H570Q583 -10 583 -20Q583 -32 568 -40H471Q464 -40 446 -40T417 -41Q262 -41 172 45Q84 127 84 250Z"></path> </g> <g data-mml-node="mi" transform="translate(5971.7, 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(6799.7, 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(7466.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="munder" transform="translate(8522.3, 0)"> <g data-mml-node="mo"> <path data-c="2211" d="M60 948Q63 950 665 950H1267L1325 815Q1384 677 1388 669H1348L1341 683Q1320 724 1285 761Q1235 809 1174 838T1033 881T882 898T699 902H574H543H251L259 891Q722 258 724 252Q725 250 724 246Q721 243 460 -56L196 -356Q196 -357 407 -357Q459 -357 548 -357T676 -358Q812 -358 896 -353T1063 -332T1204 -283T1307 -196Q1328 -170 1348 -124H1388Q1388 -125 1381 -145T1356 -210T1325 -294L1267 -449L666 -450Q64 -450 61 -448Q55 -446 55 -439Q55 -437 57 -433L590 177Q590 178 557 222T452 366T322 544L56 909L55 924Q55 945 60 948Z"></path> </g> <g data-mml-node="TeXAtom" transform="translate(58.4, -1100) scale(0.707)" data-mjx-texclass="ORD"> <g data-mml-node="mi"> <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="mo" transform="translate(451, 0)"> <path data-c="2208" d="M84 250Q84 372 166 450T360 539Q361 539 377 539T419 540T469 540H568Q583 532 583 520Q583 511 570 501L466 500Q355 499 329 494Q280 482 242 458T183 409T147 354T129 306T124 272V270H568Q583 262 583 250T568 230H124V228Q124 207 134 177T167 112T231 48T328 7Q355 1 466 0H570Q583 -10 583 -20Q583 -32 568 -40H471Q464 -40 446 -40T417 -41Q262 -41 172 45Q84 127 84 250Z"></path> </g> <g data-mml-node="mi" transform="translate(1118, 0)"> <path data-c="52" d="M230 637Q203 637 198 638T193 649Q193 676 204 682Q206 683 378 683Q550 682 564 680Q620 672 658 652T712 606T733 563T739 529Q739 484 710 445T643 385T576 351T538 338L545 333Q612 295 612 223Q612 212 607 162T602 80V71Q602 53 603 43T614 25T640 16Q668 16 686 38T712 85Q717 99 720 102T735 105Q755 105 755 93Q755 75 731 36Q693 -21 641 -21H632Q571 -21 531 4T487 82Q487 109 502 166T517 239Q517 290 474 313Q459 320 449 321T378 323H309L277 193Q244 61 244 59Q244 55 245 54T252 50T269 48T302 46H333Q339 38 339 37T336 19Q332 6 326 0H311Q275 2 180 2Q146 2 117 2T71 2T50 1Q33 1 33 10Q33 12 36 24Q41 43 46 45Q50 46 61 46H67Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628Q287 635 230 637ZM630 554Q630 586 609 608T523 636Q521 636 500 636T462 637H440Q393 637 386 627Q385 624 352 494T319 361Q319 360 388 360Q466 361 492 367Q556 377 592 426Q608 449 619 486T630 554Z"></path> </g> </g> </g> <g data-mml-node="mfrac" transform="translate(10133, 0)"> <g data-mml-node="mn" transform="translate(1716.2, 676)"> <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="mrow" transform="translate(220, -710)"> <g data-mml-node="mi"> <path data-c="6B" d="M121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647Z"></path> </g> <g data-mml-node="mo" transform="translate(743.2, 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(1743.4, 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="mo" transform="translate(2194.4, 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(2583.4, 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="mo" transform="translate(3103.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> <rect width="3692.4" height="60" x="120" y="220"></rect> </g> </g> </g> </svg> </section></span> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span style="cursor:pointer;"><span role="presentation" data-formula="D" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -683 828 683" aria-hidden="true" style="vertical-align: 0px;width: 1.873ex;height: 1.545ex;"> <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="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> </g> </svg></span></span><span leaf="">&nbsp;表示检索到的所有相关文档,</span><span style="cursor:pointer;"><span role="presentation" data-formula="d" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -694 520 704" aria-hidden="true" style="vertical-align: -0.023ex;width: 1.176ex;height: 1.593ex;"> <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="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> </g> </svg></span></span><span leaf="">&nbsp;则是一个子文档</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span style="cursor:pointer;"><span role="presentation" data-formula="R" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -683 759 704" aria-hidden="true" style="vertical-align: -0.048ex;width: 1.717ex;height: 1.593ex;"> <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="52" d="M230 637Q203 637 198 638T193 649Q193 676 204 682Q206 683 378 683Q550 682 564 680Q620 672 658 652T712 606T733 563T739 529Q739 484 710 445T643 385T576 351T538 338L545 333Q612 295 612 223Q612 212 607 162T602 80V71Q602 53 603 43T614 25T640 16Q668 16 686 38T712 85Q717 99 720 102T735 105Q755 105 755 93Q755 75 731 36Q693 -21 641 -21H632Q571 -21 531 4T487 82Q487 109 502 166T517 239Q517 290 474 313Q459 320 449 321T378 323H309L277 193Q244 61 244 59Q244 55 245 54T252 50T269 48T302 46H333Q339 38 339 37T336 19Q332 6 326 0H311Q275 2 180 2Q146 2 117 2T71 2T50 1Q33 1 33 10Q33 12 36 24Q41 43 46 45Q50 46 61 46H67Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628Q287 635 230 637ZM630 554Q630 586 609 608T523 636Q521 636 500 636T462 637H440Q393 637 386 627Q385 624 352 494T319 361Q319 360 388 360Q466 361 492 367Q556 377 592 426Q608 449 619 486T630 554Z"></path> </g> </g> </g> </svg></span></span><span leaf="">&nbsp;表示所有子问题检索出来的文档列表,</span><span style="cursor:pointer;"><span role="presentation" data-formula="r" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -442 451 453" aria-hidden="true" style="vertical-align: -0.025ex;width: 1.02ex;height: 1.025ex;"> <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="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> </g> </svg></span></span><span leaf="">&nbsp;表示某个子问题检索出来的列表。</span><strong style="font-weight: bold;color: black;"><span leaf="">需要注意的是这个列表除了包含子文档,还表示了子文档的按照相关度的排序结果</span></strong> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span style="cursor:pointer;"><span role="presentation" data-formula=" r(d)" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -750 1749 1000" aria-hidden="true" style="vertical-align: -0.566ex;width: 3.957ex;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="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="mo" transform="translate(451, 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(840, 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="mo" transform="translate(1360, 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> </svg></span></span><span leaf="">&nbsp;表示当前文档子d在其子集中的位置。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span style="cursor:pointer;"><span role="presentation" data-formula="k" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -694 521 705" aria-hidden="true" style="vertical-align: -0.025ex;width: 1.179ex;height: 1.595ex;"> <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="6B" d="M121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647Z"></path> </g> </g> </g> </svg></span></span><span leaf="">&nbsp;是固定常数60,这个是经过实验的最优值。</span> </section></li> </ul> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">该算法会对全集 D 进行二重遍历,外层遍历文档全集 D,内层遍历文档子集,在做内层遍历的时候,我们会累计当前文档在其所在子集中的位置并取倒数作为其权重。</span><strong style="font-weight: bold;color: black;"><span leaf="">也就是说如果该子文档在每个子问题检索位置越靠前,则权重越高。</span></strong><span leaf="">RFF的代码实现如下所示:</span></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><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="">rrf</span></span><span style="line-height: 26px;"><span leaf="">(results: list[list], k: int =&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">60</span></span><span leaf="">)</span></span><span leaf="">&nbsp;-&gt; list[tuple]:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""倒数排名融合RRF算法,用于将多个结果生成单一、统一的排名"""</span></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=""># 1.初始化一个字典,用于存储每一个唯一文档的得分</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; fused_scores = {}</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=""># 2.遍历每个查询对应的文档列表</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">for</span></span><span leaf="">&nbsp;docs&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf="">&nbsp;results:</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=""># 3.内层遍历文档列表得到每一个文档</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">for</span></span><span leaf="">&nbsp;rank, doc&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf="">&nbsp;enumerate(docs):</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 4.将文档使用langchain提供的dump工具转换成字符串</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; doc_str = dumps(doc)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 5.检测该字符串是否存在得分,如果不存在则赋值为0</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">if</span></span><span leaf="">&nbsp;doc_str&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">not</span></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf="">&nbsp;fused_scores:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fused_scores[doc_str] =&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">0</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 6.计算多结果得分,排名越小越靠前,k为控制权重的参数</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fused_scores[doc_str] +=&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1</span></span><span leaf="">&nbsp;/ (rank + k)</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=""># 7.提取得分并进行排序</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; reranked_results = [</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; (loads(doc), score)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">for</span></span><span leaf="">&nbsp;doc, score&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf="">&nbsp;sorted(fused_scores.items(), key=</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">lambda</span></span><span leaf="">&nbsp;x: x[</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1</span></span><span leaf="">], reverse=</span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">True</span></span><span leaf="">)</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: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf="">&nbsp;reranked_results</span><span leaf=""><br></span><span leaf=""><br></span></code></pre> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.1.2 问题分解策略</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">当提问的原始问题非常复杂时,无论是使用原始问题进行检索,亦或者生成多个相关联的问题进行检索,往往都很难在向量数据库中找到关联性高的文档,导致 RAG 效果偏差。造成这个问题的原因有几种:</span></p> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">复杂问题由多个问题按顺序步骤组成,执行相似性搜索时,向量数据库存储的都是基础文档数据,往往相似度低,但是这些数据在现实世界又可能存在很大的关联(文本嵌入模型的限制,一条向量不可能无损记录段落信息)。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">问题复杂度高或者涉及到数学问题,导致 LLM 没法一次性完成答案的生成,一次性传递大量的相关性文档,极大压缩了大语言模型生成内容上下文长度的限制</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">问题分解策略就是将一个复杂问题分解成多个子问题或者子步骤。问题分解后的子问题跟原始问题是“父子”关系,而查询重写跟原始问题则是“兄弟”关系。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">问题分解策略一共有两种分别是串行模式和并行模式。</span></p> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <p style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">串行模式适用于逻辑依赖强的问题分解,确保步骤的连贯性。如“RAG都有哪些阶段?”,需要先找到都有哪些阶段,然后再询问各个阶段该做什么事情。</span></p> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <p style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">并行模式适用于独立子任务的高效处理,提升响应速度。如“如何规划北京到上海的 5 天旅游行程?”,需要分解成交通、住宿、景点三个子问题,分别完成。</span></p> </section></li> </ul> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">两种模式的流程如下所示:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/b65c712fcc1686f50b60ef5c23a35e24.png" alt="串行模式" class="rich_pages wxw-img" data-ratio="0.16944444444444445" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000581"></span> <figcaption style="margin-top: 5px;text-align: center;color: #888;font-size: 14px;"> <span leaf="">串行模式</span> </figcaption> </figure> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/57e791e3c4058989e8d3e423e44006aa.png" alt="并行模式" class="rich_pages wxw-img" data-ratio="0.2037037037037037" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000582"></span> <figcaption style="margin-top: 5px;text-align: center;color: #888;font-size: 14px;"> <span leaf="">并行模式</span> </figcaption> </figure> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">一个简单问题分解的prompt如下所示:</span></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你的任务是针对输入的问题生成多个相关的子问题或子查询,将输入问题分解成一组可以独立回答的子问题或子任务。</span><span leaf=""><br></span><span leaf="">以下是输入的问题:</span><span leaf=""><br></span><span leaf=""> <question></question></span><span leaf=""><br></span><span leaf="">{{question}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">请生成</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3</span></span><span leaf="">&nbsp;-&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">5</span></span><span leaf="">个与该问题相关的搜索查询,并使用换行符进行分割。生成的子问题/子查询应具有明确的主题和可独立回答的特点。</span><span leaf=""><br></span><span leaf="">请在&lt;子问题&gt;标签内写下生成的子问题/子查询。</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">调用样例如下:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/19d102dcf19e5c13cf73c1d2df8cf03c.png" class="rich_pages wxw-img" data-ratio="0.5" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000583"></span> </figure> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.1.3 问题回退策略</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">问题回退策略和问题分解策略相反,当用户问题非常具体时,可能无法检索的对应文档,就需要将问题进行抽象。比如“李开复在2000年是在哪个公司工作?”,重新抽象成“李开复的工作经历是什么?”。处理流程如下:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/619127939c14bc1aad67063cb86c8ac4.png" class="rich_pages wxw-img" data-ratio="0.11907810499359796" data-type="png" data-w="781" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000580"></span> </figure> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">下面是一个执行样例:</span></strong></p><span leaf=""><img src="/upload/5cc63c59ed15357ce3aec1fb9be727a2.png" class="rich_pages wxw-img" data-ratio="0.700925925925926" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;zoom: 67%;" data-imgfileid="100000584"></span> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">原始问题:</span></strong><span leaf="">如果理想气体的温度增加 2 倍,体积增加 8 倍,压力 P 会如何变化?</span> </section></li> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">直接回答的答案:</span></strong><span leaf="">如果温度增加 2 倍,体积增加 8 倍,那么压力将减少 16 倍</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">回溯问题</span></strong><span leaf="">:这个问题背后的物理原理是什么?</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">回溯答案</span></strong><span leaf="">:理想气体定律:</span><span style="cursor:pointer;"><span role="presentation" data-formula="PV = nRT" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -683 4916.6 765" aria-hidden="true" style="vertical-align: -0.186ex;width: 11.123ex;height: 1.731ex;"> <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="50" d="M287 628Q287 635 230 637Q206 637 199 638T192 648Q192 649 194 659Q200 679 203 681T397 683Q587 682 600 680Q664 669 707 631T751 530Q751 453 685 389Q616 321 507 303Q500 302 402 301H307L277 182Q247 66 247 59Q247 55 248 54T255 50T272 48T305 46H336Q342 37 342 35Q342 19 335 5Q330 0 319 0Q316 0 282 1T182 2Q120 2 87 2T51 1Q33 1 33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM645 554Q645 567 643 575T634 597T609 619T560 635Q553 636 480 637Q463 637 445 637T416 636T404 636Q391 635 386 627Q384 621 367 550T332 412T314 344Q314 342 395 342H407H430Q542 342 590 392Q617 419 631 471T645 554Z"></path> </g> <g data-mml-node="mi" transform="translate(751, 0)"> <path data-c="56" d="M52 648Q52 670 65 683H76Q118 680 181 680Q299 680 320 683H330Q336 677 336 674T334 656Q329 641 325 637H304Q282 635 274 635Q245 630 242 620Q242 618 271 369T301 118L374 235Q447 352 520 471T595 594Q599 601 599 609Q599 633 555 637Q537 637 537 648Q537 649 539 661Q542 675 545 679T558 683Q560 683 570 683T604 682T668 681Q737 681 755 683H762Q769 676 769 672Q769 655 760 640Q757 637 743 637Q730 636 719 635T698 630T682 623T670 615T660 608T652 599T645 592L452 282Q272 -9 266 -16Q263 -18 259 -21L241 -22H234Q216 -22 216 -15Q213 -9 177 305Q139 623 138 626Q133 637 76 637H59Q52 642 52 648Z"></path> </g> <g data-mml-node="mo" transform="translate(1797.8, 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="mi" transform="translate(2853.6, 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(3453.6, 0)"> <path data-c="52" d="M230 637Q203 637 198 638T193 649Q193 676 204 682Q206 683 378 683Q550 682 564 680Q620 672 658 652T712 606T733 563T739 529Q739 484 710 445T643 385T576 351T538 338L545 333Q612 295 612 223Q612 212 607 162T602 80V71Q602 53 603 43T614 25T640 16Q668 16 686 38T712 85Q717 99 720 102T735 105Q755 105 755 93Q755 75 731 36Q693 -21 641 -21H632Q571 -21 531 4T487 82Q487 109 502 166T517 239Q517 290 474 313Q459 320 449 321T378 323H309L277 193Q244 61 244 59Q244 55 245 54T252 50T269 48T302 46H333Q339 38 339 37T336 19Q332 6 326 0H311Q275 2 180 2Q146 2 117 2T71 2T50 1Q33 1 33 10Q33 12 36 24Q41 43 46 45Q50 46 61 46H67Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628Q287 635 230 637ZM630 554Q630 586 609 608T523 636Q521 636 500 636T462 637H440Q393 637 386 627Q385 624 352 494T319 361Q319 360 388 360Q466 361 492 367Q556 377 592 426Q608 449 619 486T630 554Z"></path> </g> <g data-mml-node="mi" transform="translate(4212.6, 0)"> <path data-c="54" d="M40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40Z"></path> </g> </g> </g> </svg></span></span><span leaf="">&nbsp;其中</span><span style="cursor:pointer;"><span role="presentation" data-formula="P" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -683 751 683" aria-hidden="true" style="vertical-align: 0px;width: 1.699ex;height: 1.545ex;"> <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="50" d="M287 628Q287 635 230 637Q206 637 199 638T192 648Q192 649 194 659Q200 679 203 681T397 683Q587 682 600 680Q664 669 707 631T751 530Q751 453 685 389Q616 321 507 303Q500 302 402 301H307L277 182Q247 66 247 59Q247 55 248 54T255 50T272 48T305 46H336Q342 37 342 35Q342 19 335 5Q330 0 319 0Q316 0 282 1T182 2Q120 2 87 2T51 1Q33 1 33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM645 554Q645 567 643 575T634 597T609 619T560 635Q553 636 480 637Q463 637 445 637T416 636T404 636Q391 635 386 627Q384 621 367 550T332 412T314 344Q314 342 395 342H407H430Q542 342 590 392Q617 419 631 471T645 554Z"></path> </g> </g> </g> </svg></span></span><span leaf="">&nbsp;是压力,</span><span style="cursor:pointer;"><span role="presentation" data-formula="V" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -683 769 705" aria-hidden="true" style="vertical-align: -0.05ex;width: 1.74ex;height: 1.595ex;"> <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="56" d="M52 648Q52 670 65 683H76Q118 680 181 680Q299 680 320 683H330Q336 677 336 674T334 656Q329 641 325 637H304Q282 635 274 635Q245 630 242 620Q242 618 271 369T301 118L374 235Q447 352 520 471T595 594Q599 601 599 609Q599 633 555 637Q537 637 537 648Q537 649 539 661Q542 675 545 679T558 683Q560 683 570 683T604 682T668 681Q737 681 755 683H762Q769 676 769 672Q769 655 760 640Q757 637 743 637Q730 636 719 635T698 630T682 623T670 615T660 608T652 599T645 592L452 282Q272 -9 266 -16Q263 -18 259 -21L241 -22H234Q216 -22 216 -15Q213 -9 177 305Q139 623 138 626Q133 637 76 637H59Q52 642 52 648Z"></path> </g> </g> </g> </svg></span></span><span leaf="">&nbsp;是体积,</span><span style="cursor:pointer;"><span role="presentation" data-formula="n" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -442 600 453" aria-hidden="true" style="vertical-align: -0.025ex;width: 1.357ex;height: 1.025ex;"> <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="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> </g> </svg></span></span><span leaf="">&nbsp;是物质的量,</span><span style="cursor:pointer;"><span role="presentation" data-formula="R" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -683 759 704" aria-hidden="true" style="vertical-align: -0.048ex;width: 1.717ex;height: 1.593ex;"> <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="52" d="M230 637Q203 637 198 638T193 649Q193 676 204 682Q206 683 378 683Q550 682 564 680Q620 672 658 652T712 606T733 563T739 529Q739 484 710 445T643 385T576 351T538 338L545 333Q612 295 612 223Q612 212 607 162T602 80V71Q602 53 603 43T614 25T640 16Q668 16 686 38T712 85Q717 99 720 102T735 105Q755 105 755 93Q755 75 731 36Q693 -21 641 -21H632Q571 -21 531 4T487 82Q487 109 502 166T517 239Q517 290 474 313Q459 320 449 321T378 323H309L277 193Q244 61 244 59Q244 55 245 54T252 50T269 48T302 46H333Q339 38 339 37T336 19Q332 6 326 0H311Q275 2 180 2Q146 2 117 2T71 2T50 1Q33 1 33 10Q33 12 36 24Q41 43 46 45Q50 46 61 46H67Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628Q287 635 230 637ZM630 554Q630 586 609 608T523 636Q521 636 500 636T462 637H440Q393 637 386 627Q385 624 352 494T319 361Q319 360 388 360Q466 361 492 367Q556 377 592 426Q608 449 619 486T630 554Z"></path> </g> </g> </g> </svg></span></span><span leaf="">&nbsp;是气体常数,</span><span style="cursor:pointer;"><span role="presentation" data-formula="T" data-formula-type="inline-equation" style=""> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -677 704 677" aria-hidden="true" style="vertical-align: 0px;width: 1.593ex;height: 1.532ex;"> <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="54" d="M40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40Z"></path> </g> </g> </g> </svg></span></span><span leaf="">&nbsp;是温度。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">最终答案:</span></strong><span leaf="">压力减少了 4 倍</span> </section></li> </ul> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">原始问题:</span></strong><span leaf="">1954 年 8 月至 11 月期间,埃斯特拉・利奥波德就读于哪所学校?</span> </section></li> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: square;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">1948 年,威斯康星大学麦迪逊分校,植物学学士;</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">1950 年,加州大学伯克利分校,植物学硕士;</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">1955 年,耶鲁大学,植物学博士。</span> </section></li> </ul> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">直接回答的答案:</span></strong><span leaf="">1954 年 8 月至 11 月期间,埃斯特拉・利奥波德就读于威斯康星大学麦迪逊分校。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">回溯问题:</span></strong><span leaf="">埃斯特拉・利奥波德的教育经历是怎样的?</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">回溯答案</span></strong><span leaf="">:</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">最终答案:</span></strong><span leaf="">她 1955 年就读于耶鲁大学植物学博士项目。因此,1954 年 8 月至 11 月期间,埃斯特拉・利奥波德最可能就读于耶鲁大学</span> </section></li> </ul> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">应用场景</span></strong></p> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">复杂推理任务</span></strong><span leaf="">:如 STEM 问题(需公式应用)、时间敏感问题(需整合时间线)。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">多跳推理</span></strong><span leaf="">:通过抽象减少中间步骤的逻辑错误</span> </section></li> </ul> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">prompt举例:</span></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你的任务是分析给定的问题,忽略具体细节,提炼出问题背后涉及的核心概念、原理、知识范畴或通用逻辑。</span><span leaf=""><br></span><span leaf="">这是需要分析的问题:</span><span leaf=""><br></span><span leaf=""> <question></question></span><span leaf=""><br></span><span leaf="">{{question}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">分析时,需要提取出问题的本质,将其转化为对某一概念、原理、知识范畴或通用逻辑的探讨。例如,如果问题是“水加热到&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">100</span></span><span leaf="">℃为什么会沸腾?”,那么分析后的新问题应该是“分析液体沸腾现象的物理原理(如相变、沸点与气压关系、能量传递机制等)”。</span><span leaf=""><br></span><span leaf="">请在&lt;回答&gt;标签内写下你的分析结果。</span><span leaf=""><br></span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">调用样例如下:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/c6730a73e9b7a43e2503dce935f53f38.png" class="rich_pages wxw-img" data-ratio="0.49074074074074076" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000587"></span> </figure> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.1.4 HyDE 混合策略</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在数据库中存储的数据一般都是文档层面上的,文档包含的数据会远远比用户的查询数据要大很多,所以&nbsp;</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">query</span></code><span leaf="">&nbsp;和&nbsp;</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">doc</span></code><span leaf="">&nbsp;之间是不对称检索,能找到的相似性文档相对来说也比较少。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">例如:</span><strong style="font-weight: bold;color: black;"><span leaf="">今天回家的路上看到了美丽的风景,非常开心!想学习 python 该怎么办?</span></strong><span leaf="">这个请求中,前面的风景、开心等词语均为无关信息。会对真实的请求学习 python 产生干扰。如果直接搜索用户的请求,可能会产生不正确或无法回答的 LLM 响应。因此,有必要使得用户查询的语义空间与文档的语义空间保持一致。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">整体流程如下:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/163a7b5c3df52f6ea427b5d3d8fdd0fc.png" class="rich_pages wxw-img" data-ratio="0.14616497829232997" data-type="png" data-w="691" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000585"></span> </figure> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">HyDE 将检索过程分解为两个阶段:</span></p> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">生成假设文档</span></strong><span leaf="">:利用指令遵循的语言模型(如 InstructGPT)根据查询生成虚构但具有相关性的假设文档。生成过程通过自然语言指令(如 “写一个回答问题的段落”)引导,无需标注数据。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">对比编码检索</span></strong><span leaf="">:使用无监督对比学习的编码器(如 Contriever)将生成的假设文档编码为向量,在语料库嵌入空间中检索最相似的真实文档。编码器的密集瓶颈可过滤假设文档中的错误细节,将生成内容与实际语料对齐。</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">关键优势</span></strong></p> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">零样本能力</span></strong><span leaf="">:无需相关性标签或微调,直接利用预训练语言模型和对比编码器的能力。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">跨任务与语言泛化</span></strong><span leaf="">:在 Web 搜索、问答、事实核查等任务及斯瓦希里语、韩语、日语等多语言场景中均表现优异,超越无监督基线 Contriever,并接近有监督微调模型。</span> </section></li> </ul> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/1031864345beae01acb14fe89e317959.png" class="rich_pages wxw-img" data-ratio="0.2712962962962963" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000589"></span> </figure> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">prompt参考:</span></strong></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你的任务是实现HyDE零样本检索策略,根据用户输入的查询生成假设文档。生成的内容要反映相关性模式,同时允许存在虚构细节。</span><span leaf=""><br></span><span leaf="">以下是用户输入的查询:</span><span leaf=""><br></span><span leaf="">&lt;查询&gt;</span><span leaf=""><br></span><span leaf="">{{QUERY}}</span><span leaf=""><br></span><span leaf=""><!--/查询--></span><span leaf=""><br></span><span leaf="">在生成假设文档时,请遵循以下要点:</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1.</span></span><span leaf="">&nbsp;仔细理解查询的核心内容和意图。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">2.</span></span><span leaf="">&nbsp;围绕查询构建文档,让文档与查询具有明显的相关性。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3.</span></span><span leaf="">&nbsp;可以适当添加一些虚构的细节,但不能偏离查询的主题。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">4.</span></span><span leaf="">&nbsp;输出的文档应具有一定的逻辑性和连贯性。</span><span leaf=""><br></span><span leaf="">请在&lt;生成文档&gt;标签内写下你生成的假设文档。</span><span leaf=""><br></span><span leaf="">&lt;生成文档&gt;</span><span leaf=""><br></span><span leaf="">[在此生成假设文档]</span><span leaf=""><br></span><span leaf=""><!--/生成文档--></span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">调用样例如下:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/fd902507b457a1d76d0307cf54ab57b3.png" class="rich_pages wxw-img" data-ratio="0.4787037037037037" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000590"></span> </figure> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">局限性:</span></strong><span leaf="">对于 doc-doc 类型的检索,虽然在语义空间上保持了一致,但是在&nbsp;</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">query-&gt;doc</span></code><span leaf="">&nbsp;的过程中,受限于各种因素,仍然可能产生错误信息。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">例如提问&nbsp;</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">Bel是什么?</span></code><span leaf="">,在没有执行 HyDE 混合策略而是直接查询得到答案如下:</span></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">Bel 是由 Paul Graham 在四年的时间里(2015年3月26日至2019年10月12日),用 Arc 语言编写的一种编程语言。它基于 John McCarthy 最初的 Lisp,但添加了额外的功能。它是一个以代码形式表达的规范,旨在成为计算的形式化模型,是图灵机的一种替代方案。</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">但是执行 HyDE 混合策略生成假设性&nbsp;</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">doc</span></code><span leaf="">&nbsp;如下:</span></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">Bel 是 Paul Graham 的化名,他是这段信息背后的作者,当时需要种子资金以维持生活,并且参与了一项交易,后来成为 Y Combinator 模式的典范。</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在这个例子中,</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">HyDE</span></code><span leaf="">&nbsp;在没有文档上下文的情况下错误地解释了 Bel,这会导致完全检索不到相关的文档信息。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.1.5 混合检索策略</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在查询检索中,常见的两种检索方式分别是</span><strong style="font-weight: bold;color: black;"><span leaf="">稀疏检索器</span></strong><span leaf="">和</span><strong style="font-weight: bold;color: black;"><span leaf="">密集检索器</span></strong><span leaf="">:</span></p> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">稀疏检索器</span></strong><span leaf="">:基于关键词匹配,利用词频(TF)和逆文档频率(IDF)计算文档与查询的相关性。</span> </section></li> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: square;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">优点:非常高效,无需训练、对明确关键词匹配效果好;</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">缺点:无法捕捉语义(如同义词、上下文相关性)</span> </section></li> </ul> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">密集检索器</span></strong><span leaf="">:使用深度学习模型生成密集向量表示,通过向量相似度(如余弦相似度)衡量相关性。</span> </section></li> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: square;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">优点:捕捉语义信息,解决词汇不匹配问题;</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">缺点:需大量训练数据、计算成本高,对生僻词敏感;</span> </section></li> </ul> </ul> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">混合检索策略就是将多种检索方式混合起来,可以利用不同算法的优势,从而获得比任何单一算法更好的性能,这也是常用的检索策略。这个流程如下所示:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/b5ecb7bf7df133a63965c222034fcde5.png" class="rich_pages wxw-img" data-ratio="0.22777777777777777" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000586"></span> </figure> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">WRRF是RRF的加权版本,通过赋予不同检索器的权重,从而影响检索文档的排序。</span> </section></li> </ul> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在Langchain中,代码实现样例如下:</span></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">doc_list = [ &nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"我喜欢苹果"</span></span><span leaf="">, &nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"我喜欢橙子"</span></span><span leaf="">, &nbsp;</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"苹果和橙子是水果"</span></span><span leaf="">, &nbsp;</span><span leaf=""><br></span><span leaf="">] &nbsp;</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 初始化 BM25 检索器和 FAISS 检索器 &nbsp;</span></span><span leaf=""><br></span><span leaf="">bm25_retriever = BM25Retriever.from_texts(doc_list) &nbsp;</span><span leaf=""><br></span><span leaf="">bm25_retriever.k =&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">2</span></span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">embedding = OpenAIEmbeddings() &nbsp;</span><span leaf=""><br></span><span leaf="">faiss_vectorstore = FAISS.from_texts(doc_list, embedding) &nbsp;</span><span leaf=""><br></span><span leaf="">faiss_retriever = faiss_vectorstore.as_retriever(search_kwargs={</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"k"</span></span><span leaf="">:&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">2</span></span><span leaf="">}) &nbsp;</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 初始化集成检索器 &nbsp;</span></span><span leaf=""><br></span><span leaf="">ensemble_retriever = EnsembleRetriever(retrievers=[bm25_retriever, faiss_retriever], weights=[</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">0.5</span></span><span leaf="">,&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">0.5</span></span><span leaf="">]) &nbsp;</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">docs = ensemble_retriever.get_relevant_documents(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"苹果"</span></span><span leaf="">) &nbsp;</span><span leaf=""><br></span></code></pre> <blockquote style="border: none;display: block;font-size: 0.9em;overflow: auto;overflow-scrolling: touch;border-left: 3px solid rgba(0, 0, 0, 0.4);background: rgba(0, 0, 0, 0.05);color: #6a737d;padding-top: 10px;padding-bottom: 10px;padding-left: 20px;padding-right: 10px;margin-bottom: 20px;margin-top: 20px;"> <p style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0px;color: black;line-height: 26px;"><span leaf="">[Document(page_content='我喜欢苹果', metadata={}), &nbsp;Document(page_content='苹果和橙子是水果', metadata={})]</span></p> </blockquote> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 22px;"><span style="display: none;"></span><span leaf="">3.2 路由</span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.2.1 数据源路由</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在 RAG 应用开发中,想根据不同的问题检索不同的向量数据库,其实只需要设定要对应的 Prompt,然后让 LLM 根据传递的问题返回需要选择的向量数据库的名称,然后根据得到的名称选择不同的检索器即可。整体流程如下:</span></p><span leaf=""><img src="/upload/d60826de2d53639fd764c01a9eb1cfb0.png" class="rich_pages wxw-img" data-ratio="0.10555555555555556" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;zoom: 50%;" data-imgfileid="100000591"></span> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">路由数据源的prompt样例如下:</span></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你是一位擅长将用户问题路由到适当数据源的专家。你的任务是根据问题涉及的编程语言,将问题路由到相关的数据源。</span><span leaf=""><br></span><span leaf="">首先,请仔细阅读以下数据源信息:</span><span leaf=""><br></span><span leaf=""> <data_sources></data_sources></span><span leaf=""><br></span><span leaf="">{{DATA_SOURCES}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">现在,请仔细阅读以下用户问题:</span><span leaf=""><br></span><span leaf=""> <question></question></span><span leaf=""><br></span><span leaf="">{{QUESTION}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">为了将问题路由到合适的数据源,请按照以下步骤操作:</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1.</span></span><span leaf="">&nbsp;仔细分析问题,识别其中涉及的编程语言。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">2.</span></span><span leaf="">&nbsp;查看数据源信息,找出与该编程语言相关的数据源。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3.</span></span><span leaf="">&nbsp;如果问题涉及多种编程语言,找出与所有涉及语言都相关或与主要语言相关的数据源。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">4.</span></span><span leaf="">&nbsp;如果没有合适的数据源,指出“没有合适的数据源”。</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">请在&lt;回答&gt;标签内写下路由结果。</span><span leaf=""><br></span><span leaf="">&lt;回答&gt;</span><span leaf=""><br></span><span leaf="">[在此输出路由结果]</span><span leaf=""><br></span><span leaf=""><!--/回答--></span><span leaf=""><br></span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">调用样例如下:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/3daef0a6d5fd350d3b1259a1aff0ec86.png" alt="image-20250405112959522" class="rich_pages wxw-img" data-ratio="0.4898148148148148" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000593"></span> <figcaption style="margin-top: 5px;text-align: center;color: #888;font-size: 14px;"> <span leaf="">image-20250405112959522</span> </figcaption> </figure> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.2.2 prompt路由</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在RAG应用开发中,针对不同场景的问题使用特定化的prompt模板 效果一般都会比通用模板会好一些,例如在教培场景,制作一个可以教学物理的授课机器人,如果使用通用的 prompt模板,会导 prompt编写变得非常复杂;反过来如果prompt写的简单,有可能没法起到很好的回复效果。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">如果能针对用户的提问,例如用户提问的内容是数学相关的则使用数学的模板,提问的内容是物理相关的则使用物理的模板,针对性选择不同的模板,LLM 生成的内容会比使用通用模板会更好,例如下方有两个 prompt模板:</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">物理老师:</span></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你将扮演一位非常聪明的物理教授,以简洁易懂的方式回答物理问题。当你不知道问题的答案时,要坦率承认自己不知道。</span><span leaf=""><br></span><span leaf="">以下是需要你回答的物理问题:</span><span leaf=""><br></span><span leaf=""> <query></query></span><span leaf=""><br></span><span leaf="">{{query}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">在回答问题时,请遵循以下指南:</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1.</span></span><span leaf="">&nbsp;确保回答简洁易懂。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">2.</span></span><span leaf="">&nbsp;如果不知道问题的答案,直接表明“我不知道这个问题的答案”。</span><span leaf=""><br></span><span leaf="">请在&lt;回答&gt;标签内写下你的答案。</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">数学老师:</span></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你将扮演一位非常优秀的数学家,专门负责回答数学问题。你需要将复杂的问题分解成多个小步骤,回答这些小步骤,然后将它们整合起来回答更广泛的问题。</span><span leaf=""><br></span><span leaf="">这是需要你解答的数学问题:</span><span leaf=""><br></span><span leaf="">&lt;问题&gt;</span><span leaf=""><br></span><span leaf="">{{query}}</span><span leaf=""><br></span><span leaf=""><!--/问题--></span><span leaf=""><br></span><span leaf="">在解答问题时,请按照以下步骤进行:</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1.</span></span><span leaf="">&nbsp;仔细阅读问题,理解问题的核心。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">2.</span></span><span leaf="">&nbsp;将问题分解成多个小步骤。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3.</span></span><span leaf="">&nbsp;依次解答每个小步骤。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">4.</span></span><span leaf="">&nbsp;最后将小步骤的解答整合起来,给出完整的答案。</span><span leaf=""><br></span><span leaf="">请在&lt;回答&gt;标签内写下你的答案,确保答案清晰、全面且包含每一个关键步骤。</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">基于文本向量模型,可以根据查询问题的语义,查找到相似度更高的prompt模板,语义的prompt路由流程如下所示:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/dd932d5b0fabccc956444a89c75e4412.png" class="rich_pages wxw-img" data-ratio="0.18469217970049917" data-type="png" data-w="601" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000592"></span> </figure> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 22px;"><span style="display: none;"></span><span leaf="">3.3 问题构建</span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.3.1 自查询</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">检索外部数据时,最后在执行检索的时候使用的都是固定的筛选条件(没有附加过滤的相似性搜索)。但是在某些情况下,用户发起的原始提问其实隐式携带了&nbsp;</span><strong style="font-weight: bold;color: black;"><span leaf="">筛选条件</span></strong><span leaf="">,例如提问:</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">请帮我整理下关于2023年全年关于AI的新闻汇总。</span></code></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在这段 原始提问中,如果执行相应的向量数据库相似性搜索,其实是附加了 筛选条件的,即&nbsp;</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">year=2023</span></code><span leaf="">,但是在普通的相似性搜索中,是不会考虑 2023 年这个条件的(因为没有添加元数据过滤器,2022年和2023年数据在高维空间其实很接近),存在很大概率会将其他年份的数据也检索出来。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">那么有没有一种策略,</span><strong style="font-weight: bold;color: black;"><span leaf="">能根据用户传递的原始问题构建相应的元数据过滤器呢?</span></strong><span leaf="">这样在搜索的时候带上对应的元数据过滤器,不仅可以压缩检索范围,还能提升搜索的准确性。这个思想其实就是 查询构建或者称为 自查询。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">并且除了 向量数据库,类比映射到 关系型数据库、图数据库也是同样的操作技巧,即:</span></p> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">关系型数据库自查询:</span></strong><span leaf="">使用 LLM 将自然语言转换成 SQL 过滤语句。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">图数据库自查询:</span></strong><span leaf="">使用 LLM 将自然语言转换成图查询语句。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">向量数据库:</span></strong><span leaf="">使用 LLM 将自然语言转换成元数据过滤器/向量检索器。</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在Langchain中,封装了一个自查询检索器(SelfQueryRetriever),执行流程如下:</span></p><span leaf=""><img src="/upload/6997912da594ebda9d43c72b921d0620.png" alt="image-20250405155014657" class="rich_pages wxw-img" data-ratio="1.0407407407407407" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;zoom: 40%;" data-imgfileid="100000594"></span> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">将对应的prompt翻译后如下所示:</span></strong></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你的任务是根据提供的信息,生成一个符合特定结构的JSON对象。该JSON对象将用于查询和过滤文档。</span><span leaf=""><br></span><span leaf="">以下是允许使用的比较器和逻辑运算符:</span><span leaf=""><br></span><span leaf=""> <allowed_comparators></allowed_comparators></span><span leaf=""><br></span><span leaf="">{{ALLOWED_COMPARATORS}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf=""> <allowed_operators></allowed_operators></span><span leaf=""><br></span><span leaf="">{{ALLOWED_OPERATORS}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">现在,请根据以下信息构建JSON对象:</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&lt;&lt; Data Source &gt;&gt;</span><span leaf=""><br></span><span leaf="">```json</span><span leaf=""><br></span><span leaf="">{{{{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span leaf="">"content"</span><span leaf="">:&nbsp;</span><span leaf="">"{content}"</span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span leaf="">"attributes"</span><span leaf="">: {attributes}</span><span leaf=""><br></span><span leaf="">}}}}</span><span leaf=""><br></span><span leaf="">```</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">在构建JSON对象时,请遵循以下规则:</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1.</span></span><span leaf="">&nbsp;查询字符串应仅包含预期与文档内容匹配的文本。过滤条件中的任何条件不应在查询中提及。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">2.</span></span><span leaf="">&nbsp;逻辑条件语句由一个或多个比较和逻辑操作语句组成。</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; - 比较语句的形式为:`comp(attr, val)`,其中`comp`为允许的比较器,`attr`为要应用比较的属性名称,`val`为比较值。</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; - 逻辑操作语句的形式为:`op(statement1, statement2, ...)`,其中`op`为允许的逻辑运算符,`statement1`, `statement2`, ... 为比较语句或逻辑操作语句。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3.</span></span><span leaf="">&nbsp;仅使用上述列出的比较器和逻辑运算符,不使用其他运算符。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">4.</span></span><span leaf="">&nbsp;过滤条件仅引用数据源中存在的属性。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">5.</span></span><span leaf="">&nbsp;过滤条件仅使用应用了函数的属性名称及其函数名。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">6.</span></span><span leaf="">&nbsp;处理日期数据类型的值时,过滤条件仅使用`YYYY - MM - DD`格式。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">7.</span></span><span leaf="">&nbsp;过滤条件仅在需要时使用。如果没有要应用的过滤条件,`filter`的值应返回&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"NO_FILTER"</span></span><span leaf="">。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">8.</span></span><span leaf="">&nbsp;`limit`必须始终为整数类型的值。如果该参数没有意义,请留空。</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">请在&lt;回答&gt;标签内输出符合以下格式的JSON对象:</span><span leaf=""><br></span><span leaf="">```json</span><span leaf=""><br></span><span leaf="">{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"query"</span></span><span leaf="">:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"文本字符串,用于与文档内容进行比较"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"filter"</span></span><span leaf="">:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"用于过滤文档的逻辑条件语句"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"limit"</span></span><span leaf="">: 要检索的文档数量</span><span leaf=""><br></span><span leaf="">}</span><span leaf=""><br></span><span leaf="">```</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">&lt;&lt;样例&gt;&gt;</span><span leaf=""><br></span><span leaf="">Data Source:</span><span leaf=""><br></span><span leaf="">```json</span><span leaf=""><br></span><span leaf="">{{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span leaf="">"content"</span><span leaf="">:&nbsp;</span><span leaf="">"Lyrics of a song"</span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span leaf="">"attributes"</span><span leaf="">: {{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf="">"artist"</span><span leaf="">: {{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf="">"type"</span><span leaf="">:&nbsp;</span><span leaf="">"string"</span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf="">"description"</span><span leaf="">:&nbsp;</span><span leaf="">"Name of the song artist"</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: #98c379;line-height: 26px;"><span leaf="">"length"</span></span><span leaf="">: {{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf="">"type"</span><span leaf="">:&nbsp;</span><span leaf="">"integer"</span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf="">"description"</span><span leaf="">:&nbsp;</span><span leaf="">"Length of the song in seconds"</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: #98c379;line-height: 26px;"><span leaf="">"genre"</span></span><span leaf="">: {{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf="">"type"</span><span leaf="">:&nbsp;</span><span leaf="">"string"</span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span leaf="">"description"</span><span leaf="">:&nbsp;</span><span leaf="">"The song genre, one of \"pop\", \"rock\" or \"rap\""</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; }}</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; }}</span><span leaf=""><br></span><span leaf="">}}</span><span leaf=""><br></span><span leaf="">```</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">User Query:</span><span leaf=""><br></span><span leaf="">What are songs by Taylor Swift&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">or</span></span><span leaf="">&nbsp;Katy Perry about teenage romance under&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3</span></span><span leaf="">&nbsp;minutes long&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf="">&nbsp;the dance pop genre</span><span leaf=""><br></span><span leaf=""><br></span><span leaf="">Structured Request:</span><span leaf=""><br></span><span leaf="">```json</span><span leaf=""><br></span><span leaf="">{{</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span leaf="">"query"</span><span leaf="">:&nbsp;</span><span leaf="">"teenager love"</span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span leaf="">"filter"</span><span leaf="">:&nbsp;</span><span leaf="">"and(or(eq(\\"</span><span leaf="">artist\\</span><span leaf="">", \\"</span><span leaf="">Taylor Swift\\</span><span leaf="">"), eq(\\"</span><span leaf="">artist\\</span><span leaf="">", \\"</span><span leaf="">Katy Perry\\</span><span leaf="">")), lt(\\"</span><span leaf="">length\\</span><span leaf="">", 180), eq(\\"</span><span leaf="">genre\\</span><span leaf="">", \\"</span><span leaf="">pop\\</span><span leaf="">"))"</span><span leaf=""><br></span><span leaf="">}}</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;padding: 0px;font-weight: bold;color: black;font-size: 22px;"><span style="display: none;"></span><span leaf="">3.4 索引</span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.4.1 多表征索引</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">通常我们会为一个文档生成一个向量信息,并存储到向量数据库中。如果能从多个维度记录该文档块的信息,会大大增加该文档块被检索到的概率,</span><strong style="font-weight: bold;color: black;"><span leaf="">多个维度记录信息等同于为文档块生成多个向量。</span></strong><span leaf="">通常建立的维度有以下几种:</span></p> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">把文档切割成更小的块:</span></strong><span leaf="">将一个文档块继续拆分成更小的块,通过检索小的块,定位父文档。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">存储摘要信息:</span></strong><span leaf="">将一个文档通过LLM生成摘要信息,将其和原文档一起存到向量数据库中,只返回原文档。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">假设性问题:</span></strong><span leaf="">使用 LLM 为每个文档块生成适合回答的假设性问题,将其和原文档一起嵌入或者代替,返回时返回原文档。</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">整体流程如下:</span></p><span leaf=""><img src="/upload/97adaba680ea47b3198f2685d730dfa9.png" class="rich_pages wxw-img" data-ratio="0.6314814814814815" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;zoom: 40%;" data-imgfileid="100000595"></span> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.4.2 分层索引</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在传统的 RAG 中,我们通常依靠检索短的连续文本块来进行检索。但是,当我们处理的是长上下文时,我们就不能仅仅将文档分块嵌入到其中,或者仅仅使用上下文填充所有文档。相反,我们希望为 LLM 的长下文找到一种好的最小化分块方法,这就是 RAPTOR 的用武之地,在 RAPTOR 中,均衡了多文档、超长上下文、高准确性、超低成本等特性。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">RAPTOR 其实是一种用树状组织检索的递归抽象处理技术,它采用了一种自下而上的方法,通过对文本片段(块)进行聚类和归纳来形成一种分层结构。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">构建过程如下图所示:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/7d1e02fc70857b722c72639c7e231f86.png" class="rich_pages wxw-img" data-ratio="0.6386333771353482" data-type="png" data-w="761" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000599"></span> </figure> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">对原始文本进行分块,拆分成合适的大小;</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">对拆分的文档块进行嵌入/向量化,向量目前处于高维,并将数据存储到向量数据库;</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">将高维向量进行降维,降低运算成本,例如降低成 2 维或者 3 维;</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">对降维向量进行聚类,找出同一类的文档组;</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">合并文档组的文本,使用 LLM 对合并文档进行摘要汇总得到新的文本,重复2-5的步骤;</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">直到最后只剩下一个文档并且该文档的长度符合大小时,结束整个流程;</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">检索策略分为两种:树遍历检索和折叠树检索。其中树遍历检索流程如下所示:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/d29f20a97b296dc638d7dc6186969697.png" class="rich_pages wxw-img" data-ratio="0.4383916990920882" data-type="png" data-w="771" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000598"></span> </figure> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">从树的根节点开始,检索问题和文档的余弦相似性</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">选择最相关的前 k 个节点</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">将选择的节点的子节点放入候选集中,重复1-3的步骤</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">折叠树检索过程如下图所示:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/9dc04cf8e4e5d8f1d6690ad5194879ff.png" class="rich_pages wxw-img" data-ratio="0.1815823605706874" data-type="png" data-w="771" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000596"></span> </figure> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">将所有的节点都存储在一个向量数据库,折叠为一层</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">对原始问题进行检索,选择最相关的前 k 个节点</span> </section></li> </ol> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.4.3 切块优化</span><span style="display: none;"></span></h3> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 18px;"><span style="display: none;"></span><span leaf="">3.4.3.1 递归字符分割器</span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">字符分割器就是根据指定分割符,将文档切割成多个文档块。它通常会支持控制文档块的大小,避免超出大模型上下文限制。除此之外,还可以控制块与块之间重叠的内容大小,尽可能保留上下文信息。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">但是在划分的过程中,可能会出现文档块过小或者过大的情况,这会让 RAG 变得不可控,例如:</span></p> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">文档块可能会变得非常大</span></strong><span leaf="">:由于切分依赖找到分隔符,如果说两个分割符的间隔非常大,就会导致文档块的大小超出限制的值,极端的情况下某个块的内容长度可能就超过了 LLM 的上下文长度限制,这样这个文本块永远不会被引用到,相当于存储了数据,但是数据又丢失了。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">文档块可能会远远小于窗口大小</span></strong><span leaf="">:如果两个分割符的间隔非常小,则导致文档块的信息密度太低,块内容即使填充到 Prompt 中,LLM 也无法提取出有用的信息。</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">递归字符分割器对大文档块会使用更多的分隔符使其变小,对小文档块进行合并使其保留更多的信息,整体流程如下所示:</span></p><span leaf=""><img src="/upload/1281fb409357bacc682fceab50102104.png" class="rich_pages wxw-img" data-ratio="0.32592592592592595" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;zoom: 40%;" data-imgfileid="100000600"></span> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 18px;"><span style="display: none;"></span><span leaf="">3.4.3.2 语义文档分割器</span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">文档分割器都是使用特定字符对文本进行拆分,这种拆分模式虽然考虑了文档中的上下文切断的问题,但是并没有考虑句子之间的语义相似性,如果有一篇长文本,需要将其分割成语义相关的块,以便更好地理解和处理,这个时候就需要使用语义文档分割器。整体流程如下所示:</span></p><span leaf=""><img src="/upload/5aa964321f4bb09abd074822dc80948e.png" class="rich_pages wxw-img" data-ratio="0.3824074074074074" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;zoom: 40%;" data-imgfileid="100000597"></span> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 18px;"><span style="display: none;"></span><span leaf="">3.4.3.3 文档转换器</span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">除了对文档进行切割的方式,对于结构化数据可以直接使用对应结构化的文档转换器,如HTML文档转换器、代码文档转换器。除此之外,还有两种特殊的转换器:</span></p> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">问答转换器:</span></strong><span leaf="">使用大语言模型,对文档信息进行提取,被生成该信息可能出现问题,如</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">{'question': '产品发布活动的日期是什么时候?', 'answer': '7月15日'}</span></code> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">文档翻译器:</span></strong><span leaf="">其实是将文档转换成另外一种形式的文档,比如将英文的论文翻译成中文。</span> </section></li> </ul> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 22px;"><span style="display: none;"></span><span leaf="">3.5 检索</span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.5.1 ReRank 重排序</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">在完成对问题的改写、不同数据库查询的构建以及路由逻辑、向量数据库索引方面的优化后,我们可以考虑进一步优化&nbsp;</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">筛选阶段</span></code><span leaf="">,一般涵盖了&nbsp;</span><code style="font-size: 14px;word-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0 2px;color: #1e6bb8;background-color: rgba(27,31,35,.05);font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">重排序</span></code><span leaf="">、纠正性RAG 两种策略。</span><strong style="font-weight: bold;color: black;"><span leaf="">其中重排序是使用频率最高,性价比最高,通常与 混合检索一起搭配使用,也是目前主流的优化策略</span></strong><span leaf="">。</span></p> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">重排序的核心思想见字知其意,即对检索到的文档 调整顺序,除此之外,重排序 一般还会增加剔除无关/多余数据的步骤,其中RRF就是重排序中最基础的一种。</span></p><span leaf=""><img src="/upload/3f94fee172a616f873100b672b9ccaab.png" class="rich_pages wxw-img" data-ratio="0.3277777777777778" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;zoom: 40%;" data-imgfileid="100000604"></span> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.5.2 CRAG</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">纠正性检索增强生成(Corrective Retrieval-Augmented Generation,CRAG)是一种先进的自然语言处理技术,旨在提高检索的生成方法的鲁棒性和准确性。在 CRAG 中</span><strong style="font-weight: bold;color: black;"><span leaf="">引入了一个轻量级的检索评估器来评估检索到的文档的质量,并根据评估结果触发不同的知识检索动作</span></strong><span leaf="">,以确保生成结果的准确性。整体流程如下图所示:</span></p> <figure data-tool="mdnice编辑器" style="margin: 0;margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img src="/upload/8440c000527d7f08d4e519e738e86626.png" class="rich_pages wxw-img" data-ratio="0.26944444444444443" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;" data-imgfileid="100000603"></span> </figure> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">检索文档</span></strong><span leaf="">:首先,基于用户的查询,系统执行检索操作以获取相关的文档或信息。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">评估检索质量</span></strong><span leaf="">:CRAG 使用一个轻量级的检索评估器对检索到的每个文档进行质量评估,计算出一个量化的置信度分数。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">触发知识检索动作:</span></strong><span leaf="">根据置信度分数,CRAG 将触发以下二个动作之一:</span> </section></li> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">正确</span></strong><span leaf="">:如果评估器认为文档与查询高度相关,将采用该文档进行知识精炼。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">错误</span></strong><span leaf="">:如果文档被评估为不相关或误导性,CRAG将重写生成一个新的问题,然后利用网络搜索寻找更多知识来源。</span> </section></li> </ul> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">知识精炼</span></strong><span leaf="">:对于评估为正确的文档,CRAG将进行知识精炼,抽取关键信息并过滤掉无关信息。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">问题重写:</span></strong><span leaf="">通过重写一个新的相似问题,来优化答案的检索。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">网络搜索</span></strong><span leaf="">:在需要时,CRAG会执行网络搜索以寻找更多高质量的知识来源,以纠正或补充检索结果。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">生成文本</span></strong><span leaf="">:最后,利用经过优化和校正的知识,传递给 LLM,生成对应文本。</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">评估节点prompt:</span></strong></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你是一名评分员,负责评估检索到的文档与用户问题的相关性。你的任务是根据给定的标准,判断文档是否与问题相关,并给出“yes”或“no”的二元评分。</span><span leaf=""><br></span><span leaf="">以下是用户的问题:</span><span leaf=""><br></span><span leaf=""> <question></question></span><span leaf=""><br></span><span leaf="">{{QUESTION}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">以下是检索到的文档:</span><span leaf=""><br></span><span leaf=""> <document></document></span><span leaf=""><br></span><span leaf="">{{DOCUMENT}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">判断文档是否相关的标准为:如果文档包含与问题相关的关键词或语义含义,则判定为相关。</span><span leaf=""><br></span><span leaf="">首先,在&lt;思考&gt;标签中详细分析文档是否包含与问题相关的关键词或语义含义,说明你的分析过程。然后在&lt;回答&gt;标签中给出最终的二元评分(“yes”或“no”)。</span><span leaf=""><br></span><span leaf="">&lt;思考&gt;</span><span leaf=""><br></span><span leaf="">[在此详细说明你对文档与问题相关性的分析过程]</span><span leaf=""><br></span><span leaf=""><!--/思考--></span><span leaf=""><br></span><span leaf="">&lt;回答&gt;</span><span leaf=""><br></span><span leaf="">[在此给出“yes”或“no”的评分]</span><span leaf=""><br></span><span leaf=""><!--/回答--></span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">问题重写prompt:</span></strong></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你是一个问题改写器,任务是将输入的问题转换为一个更适合网络搜索的优化版本。你需要仔细分析输入问题,挖掘其潜在的语义意图和含义。</span><span leaf=""><br></span><span leaf="">以下是需要改写的问题:</span><span leaf=""><br></span><span leaf=""> <question></question></span><span leaf=""><br></span><span leaf="">{{QUESTION}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">在改写问题时,请遵循以下方法:</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1.</span></span><span leaf="">&nbsp;去除不必要的修饰词和语气词,使问题简洁明了。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">2.</span></span><span leaf="">&nbsp;提取问题的核心内容,突出关键信息。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3.</span></span><span leaf="">&nbsp;调整语序,使问题更符合网络搜索的习惯。</span><span leaf=""><br></span><span leaf="">请在&lt;改写后的问题&gt;标签内写下改写后的问题。</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">知识精炼prompt:</span></strong></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你是一位信息精炼专家,负责从给定文档中提取与特定主题直接相关的关键事实、数据、观点和结论,过滤掉不相关的背景信息、示例和解释。</span><span leaf=""><br></span><span leaf="">请仔细阅读以下文档:</span><span leaf=""><br></span><span leaf=""> <document></document></span><span leaf=""><br></span><span leaf="">{{DOCUMENT}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">需要围绕的主题是:</span><span leaf=""><br></span><span leaf=""> <topic_name></topic_name></span><span leaf=""><br></span><span leaf="">{{TOPIC_NAME}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">在精炼信息时,请遵循以下要求:</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1.</span></span><span leaf="">&nbsp;仅提取与主题直接相关的关键事实、数据、观点和结论。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">2.</span></span><span leaf="">&nbsp;过滤掉所有不相关的背景信息、示例和解释。</span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3.</span></span><span leaf="">&nbsp;输出尽量保持简洁明了。</span><span leaf=""><br></span><span leaf="">请在&lt;回答&gt;标签内写下精炼后的信息。</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">RAG-prompt:</span></strong></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你是一个负责回答问题的助手。你的任务是利用提供的检索到的上下文来回答问题。如果不知道答案,就直接表明不知道。回答最多使用三句话,保持简洁。</span><span leaf=""><br></span><span leaf="">以下是检索到的上下文:</span><span leaf=""><br></span><span leaf=""> <retrieved_context></retrieved_context></span><span leaf=""><br></span><span leaf="">{{RETRIEVED_CONTEXT}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">这是问题:</span><span leaf=""><br></span><span leaf=""> <question></question></span><span leaf=""><br></span><span leaf="">{{QUESTION}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">请在&lt;回答&gt;标签内写下你的答案。</span><span leaf=""><br></span><span leaf="">&lt;回答&gt;</span><span leaf=""><br></span><span leaf="">[在此给出答案]</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;padding: 0px;font-weight: bold;color: black;font-size: 22px;"><span style="display: none;"></span><span leaf="">3.6 生成</span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 20px;"><span style="display: none;"></span><span leaf="">3.6.1 self-RAG</span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">Self-RAG 全称为自我反思 RAG,见名知其意,即对原始查询、检索的内容、生成的内容进行自我反思,根据反思的结果执行不同的操作,例如:</span><strong style="font-weight: bold;color: black;"><span leaf="">直接输出答案、重新检索、剔除不相关的内容、检测生成内容是否存在幻觉、检测生成内容是否有帮助</span></strong><span leaf="">等,可以把 Self-RAG看成是一个拥有自我反思能力的智能体,这个智能体主要用来依据相关知识库回复用户问题,自我迭代,直到输出满意的结果。SELF-RAG训练了一个任意的LLM,使其能够在给定任务输入时反思自己的生成过程,同时生成任务输出和临时的特殊标记(称为反思标记)。这些反思标记分为检索和评论标记,分别表示了是否需要检索以及生成的质量。流程如下图所示:</span></p><span leaf=""><img src="/upload/9ccfde737d6c61e9e3c1fbf8eb6dd601.png" class="rich_pages wxw-img" data-ratio="0.275" data-type="png" data-w="1080" style="display: block;margin: 0 auto;max-width: 100%;zoom: 40%;" data-imgfileid="100000605"></span> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><span leaf="">一个 Self-RAG应用主要有三大步骤组成:</span></p> <ol style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: decimal;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">按需检索(Retrieval as Needed):</span></strong><span leaf="">SELF-RAG在需要的情况下,通过生成一个检索标记,来评估是否需要从相关文本中获取信息。如果需要检索,模型会使用检索器(Retriever)来获取与输入相关的文本段落;相反,当模型被要求写“写一篇关于Python依赖注入的文章”时,大模型会直接生成答案,无需进行检索。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">以并行方式生成内容(Parallel Generation):</span></strong><span leaf="">模型会同时使用 prompt 和检索到的内容来生成模型输出,在整个过程中,会触发多种类型的反思(Reflection),涵盖了:反思文档是否有关联、反思生成内容是否存在幻觉以及是否能回答问题、。</span> </section></li> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">如果不关联则重新检索;</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">如果存在幻觉/支持度不够,则重新生成;</span> </section></li> </ul> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <strong style="font-weight: bold;color: black;"><span leaf="">内容的评估和选择:</span></strong><span leaf="">对步骤 2 中生成的内容进行评估,并选择最佳文档段落作为输出。</span> </section></li> </ol> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">判断是否有幻觉prompt:</span></strong></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你是一名评分员,负责评估大语言模型(LLM)的生成内容是否有一组检索到的事实作为依据。你的任务是根据给定的事实集,判断生成内容是否能得到事实的支持,并给出“是”或“否”的二元评分。“是”表示答案有事实依据,“否”则表示没有。</span><span leaf=""><br></span><span leaf="">首先,请仔细阅读以下检索到的事实集:</span><span leaf=""><br></span><span leaf="">&lt;检索到的事实集&gt;</span><span leaf=""><br></span><span leaf="">{{RETRIEVED_FACTS}}</span><span leaf=""><br></span><span leaf=""><!--/检索到的事实集--></span><span leaf=""><br></span><span leaf="">现在,请仔细阅读以下大语言模型的生成内容:</span><span leaf=""><br></span><span leaf="">&lt;大语言模型生成内容&gt;</span><span leaf=""><br></span><span leaf="">{{LLM_GENERATION}}</span><span leaf=""><br></span><span leaf=""><!--/大语言模型生成内容--></span><span leaf=""><br></span><span leaf="">评估这份生成内容时,请考虑生成内容中的所有陈述是否都能在检索到的事实集中找到支持。</span><span leaf=""><br></span><span leaf="">在&lt;思考&gt;标签中详细分析你的判断依据,然后在&lt;判断&gt;标签中给出“是”或“否”的判断。例如:</span><span leaf=""><br></span><span leaf="">&lt;思考&gt;</span><span leaf=""><br></span><span leaf="">[在此详细说明你做出判断的依据]</span><span leaf=""><br></span><span leaf=""><!--/思考--></span><span leaf=""><br></span><span leaf="">&lt;判断&gt;</span><span leaf=""><br></span><span leaf="">[在此给出“是”或“否”的判断]</span><span leaf=""><br></span><span leaf=""><!--/判断--></span><span leaf=""><br></span><span leaf="">请现在开始你的评估。</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;margin: 0;line-height: 26px;color: black;"><strong style="font-weight: bold;color: black;"><span leaf="">答案评估prompt:</span></strong></p> <pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;"><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 olu121bepgl5soxua8vtvgul3bcqgksbaxpibico4nmxdu6hzqwjcfvgsos6fvu0vou8syqsgnsthh5pu0vfmfby2merzgowdl 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;"><span leaf="">你的任务是评估一个答案是否解决了相应的问题,并给出“yes”或“no”的二元评分。“yes”表示答案解决了问题,“no”表示答案未解决问题。</span><span leaf=""><br></span><span leaf="">以下是问题:</span><span leaf=""><br></span><span leaf=""> <question></question></span><span leaf=""><br></span><span leaf="">{{QUESTION}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">以下是答案:</span><span leaf=""><br></span><span leaf=""> <answer></answer></span><span leaf=""><br></span><span leaf="">{{ANSWER}}</span><span leaf=""><br></span><span leaf=""></span><span leaf=""><br></span><span leaf="">在评估时,请仔细对比答案内容与问题,判断答案是否直接回应并解决了问题。</span><span leaf=""><br></span><span leaf="">请在&lt;判断&gt;标签内给出你的最终判断,使用“yes”或“no”。</span><span leaf=""><br></span><span leaf="">&lt;判断&gt;</span><span leaf=""><br></span><span leaf="">[在此给出“yes”或“no”的判断]</span><span leaf=""><br></span><span leaf=""><!--/判断--></span><span leaf=""><br></span></code></pre> <h1 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;padding: 0px;font-weight: bold;color: black;font-size: 24px;"><span style="display: none;"></span><span leaf="">四、参考资料</span></h1> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;list-style-type: disc;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">RRF(Reciprocal Rank Fusion)重排序:https://plg.uwaterloo.ca/~gvcormac/cormacksigir09-rrf.pdf</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">Step-Back Prompting:https://arxiv.org/pdf/2310.06117</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">HyDE混合策略:https://arxiv.org/pdf/2212.10496</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">RAPTOR分层索引:https://arxiv.org/pdf/2401.18059</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">CRAG:https://arxiv.org/pdf/2401.15884</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">langgraph实现CRAG:https://langchain-ai.github.io/langgraph/tutorials/rag/langgraph_crag/</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">Self-RAG:https://arxiv.org/pdf/2310.11511</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;"> <span leaf="">langgraph实现Self-RAG:https://langchain-ai.github.io/langgraph/tutorials/rag/langgraph_self_rag/</span> </section></li> </ul> </section> <section> <span leaf=""><br></span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

AI 翻唱改词

作者:微信小助手

<p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">今天我的陪伴群里有位小伙伴说想</span></span><span style="color: rgb(31, 35, 41);font-weight: bold;"><span leaf="">改编歌词翻唱歌曲</span></span><span style="color: rgb(31, 35, 41);"><span leaf="">,听起来好像不难,也曾见过很多类似的爆款短视频。</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001475" data-ratio="1.1985294117647058" src="/upload/86800f1c98efcdb3abb7e2242aed4c14.png" data-type="png" data-w="408" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">但脑袋转半天,竟然发现我不会做。</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">这个面子不能丢,必须得满足小伙伴的要求!</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">想要了解 AI 翻唱和声音克隆的看官可以看我之前的两篇文章。</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf=""><a style="" href="https://mp.weixin.qq.com/s?__biz=MzA4NDc2NjM5Mg==&amp;mid=2247485039&amp;idx=1&amp;sn=ff9f0fd90f93c69d3f59265872279d22&amp;scene=21#wechat_redirect" textvalue="AI翻唱,用自己的声音开一场音乐会吧!" data-itemshowtype="0" target="_blank" linktype="text" data-linktype="2">AI翻唱,用自己的声音开一场音乐会吧!</a></span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf=""><a style="" href="https://mp.weixin.qq.com/s?__biz=MzA4NDc2NjM5Mg==&amp;mid=2247484833&amp;idx=1&amp;sn=005f1218d5d7a56b7d594e2343b5eb60&amp;scene=21#wechat_redirect" textvalue="震惊!数字人开演唱会(附保姆级教程)" data-itemshowtype="0" target="_blank" linktype="text" data-linktype="2">震惊!数字人开演唱会(附保姆级教程)</a></span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">先看效果。</span></span></p> <section class="channels_iframe_wrp" nodeleaf=""> <mp-common-videosnap class="js_uneditable custom_select_card channels_iframe videosnap_video_iframe videosnap_video_iframe" data-pluginname="mpvideosnap" data-url="https://findermp.video.qq.com/251/20304/stodownload?encfilekey=oibeqyX228riaCwo9STVsGLPj9UYCicgttvcU0svLm62H1ySRkP6KKiaviayF0YaQgjn6kyEukVGEeVMRzrR2uXrn9icC1FXvsGr1xbpeB4zQc0X9FhMAiaftmgqeBSF4a3Pz6icd7151FD3e6A&amp;token=2lt8WBSnjTkaKAeHHHpFowXIMyXusB5K8GDZMpibMdcOrquwNmHibFbTTDuMVEOcX0cOkAZjMnWXx3biabKF0CYoW00GVtmbicU0Z9C4DtJ3mGBqTvyF0MhW8jQFmbjN5yjNG5EhB6kObDJuWRRZkna8XNdwPhdZEMb4MiafpbEfgk6Q&amp;idx=1&amp;hy=SH&amp;m=b25fd710228675ed20d7461ab11ab583&amp;uzid=1" data-headimgurl="http://wx.qlogo.cn/finderhead/wleInO01fPcDYpYpqUhIdbbRrVibECwJrV6YGx5ibJm2h5HIiacjDaDicrMTX8bYYCgh0zp4uYqlsDM/0" data-username="v2_060000231003b20faec8c4e38110c6d4c60de53cb07727a364d7f85fa546f348036476d2f6a4@finder" data-nickname="风林AI视频" data-desc="#AI翻唱#改歌词 春暖花开" data-nonceid="1453827177339146151" data-width="1920" data-height="1080" data-type="video" data-id="export/UzFfAgtgekIEAQAAAAAA0b4GdNlxVgAAAAstQy6ubaLX4KHWvLEZgBPE4YM0NWIMDvaIzNPgMIuAy-f-3_WRM6YASH16dpML"></mp-common-videosnap> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <h2 style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: 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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-weight: bold;color: rgb(31, 35, 41);font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.578px;margin-top: 0px;margin-bottom: 8px;font-size: 22px;padding-bottom: 12px;><span style="color: rgb(31, 35, 41);"><span leaf="">改编歌词</span></span></h2> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">这里要改编的歌曲是《我期待的不是雪》片段。</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">《我期待的不是雪》片段如下。</span></span></p> <section nodeleaf=""> <mp-common-mpaudio class="js_editor_audio res_iframe js_uneditable custom_select_card" data-pluginname="insertaudio" name="测试&nbsp;我期待的" author="风林AI视频" src="/cgi-bin/readtemplate?t=tmpl/audio_tmpl&amp;name=%E6%B5%8B%E8%AF%95%26nbsp%3B%E6%88%91%E6%9C%9F%E5%BE%85%E7%9A%84&amp;play_length=30%E7%A7%92" isaac2="0" low_size="480" source_size="480" high_size="480" play_length="30000" data-trans_state="1" data-verify_state="3" voice_encode_fileid="MzA4NDc2NjM5Ml8yMjQ3NDg1MTQy" cover="http://wx.qlogo.cn/mmopen/mONcle9pic3yAvBGHianF1tGakwXTgAw5y8frSPny4Fz3E2X1RZ06VLcMljhPYPjYreCsGXUFFjIUeJ9JlJVCZsR1Pa2QMaHFdRjibElTsicAdHibEXa9Nmuqgdc91IB6Br6A/0"></mp-common-mpaudio> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">先把「原歌曲片段」导入剪映,识别歌词。</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001473" data-ratio="0.6827586206896552" src="/upload/c10b8a010a0332768f8e9d1d32d00e40.png" data-type="png" data-w="290" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">并把歌词导出为 .txt 格式</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001474" data-ratio="0.6827586206896552" src="/upload/c10b8a010a0332768f8e9d1d32d00e40.png" data-type="png" data-w="290" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <section style="color: rgb(0, 0, 0);font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: flex;place-items: flex-start;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;background-color: rgb(255, 245, 235);margin-bottom: 20px;padding: 16px 10px;border: 1px solid rgb(254, 212, 164);border-radius: 8px;text-align: left;> <section style=""> <p style="font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">因为我的原歌曲片段已经是改编歌曲,所以先用剪映识别了歌词。</span></span></p> <p style="font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">但如果你用的是未改编的原歌曲,直接在百度搜原歌曲歌词就行,然后复制备用着。</span></span></p> </section> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001476" data-ratio="1.069219440353461" src="/upload/b8351a2145dd3370be309be447b231aa.png" data-type="png" data-w="679" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">然后打开 DeepSeek,让 DeepSeek 帮你写新歌词。</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;margin-top: 12px;margin-bottom: 12px;> <span style="display: block;height: 30px;background-color: rgb(40, 44, 52);border-top-left-radius: 5px;border-top-right-radius: 5px;margin: 0px;color: rgb(0, 0, 0);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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="height: 30px;line-height: 30px;margin-left: 10px;display: flex;"><span style="width: 10px;height: 10px;border-radius: 50%;background-color: rgb(255, 95, 86);margin-right: 8px;margin-top: 10px;"></span><span style="width: 10px;height: 10px;border-radius: 50%;background-color: rgb(255, 189, 46);margin-right: 8px;margin-top: 10px;"></span><span style="width: 10px;height: 10px;border-radius: 50%;background-color: rgb(39, 201, 63);margin-top: 10px;"></span></span></span> <pre style="margin: 0px;"><code style="color: rgb(171, 178, 191);background: rgb(40, 44, 52);padding: 4px 15px 15px;display: block;overflow-x: auto;border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;font-family: Consolas, Monaco, Menlo, monospace;font-size: 14px;line-height: 1.5;"><span leaf="">请将“原歌词”改写,生成一段关于主题“春暖花开”的新歌词,改写后的歌词字数和结构必须和“原歌词”一模一样,并且保持原歌词中的关键词“我期待的”:</span><span leaf=""><br></span><span leaf="">原歌词:</span><span leaf=""><br></span><span leaf="">我期待的不是雪</span><span leaf=""><br></span><span leaf="">而是有你的冬天</span><span leaf=""><br></span><span leaf="">我期待的不是雪</span><span leaf=""><br></span><span leaf="">而是对你的想念</span><span leaf=""><br></span><span leaf="">我期待的是永远</span><span leaf=""><br></span><span leaf="">没成想你在半途说了再见</span><span leaf=""><br></span><span leaf="">明明爱着要走向终点</span><span leaf=""><br></span><span leaf="">我期待的不是雪</span><span leaf=""><br></span><span leaf="">那是有你的冬天</span><span leaf=""><br></span><span leaf="">我期待的不是雪</span><span leaf=""><br></span><span leaf="">冻结挽留的语言</span><span leaf=""><br></span><span leaf="">我期待的是永远</span><span leaf=""><br></span><span leaf="">时间又冻结在了深夜零点</span></code></pre> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">DeepSeek 给我返的歌词是:</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;margin-top: 12px;margin-bottom: 12px;> <span style="display: block;height: 30px;background-color: rgb(40, 44, 52);border-top-left-radius: 5px;border-top-right-radius: 5px;margin: 0px;color: rgb(0, 0, 0);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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="height: 30px;line-height: 30px;margin-left: 10px;display: flex;"><span style="width: 10px;height: 10px;border-radius: 50%;background-color: rgb(255, 95, 86);margin-right: 8px;margin-top: 10px;"></span><span style="width: 10px;height: 10px;border-radius: 50%;background-color: rgb(255, 189, 46);margin-right: 8px;margin-top: 10px;"></span><span style="width: 10px;height: 10px;border-radius: 50%;background-color: rgb(39, 201, 63);margin-top: 10px;"></span></span></span> <pre style="margin: 0px;"><code style="color: rgb(171, 178, 191);background: rgb(40, 44, 52);padding: 4px 15px 15px;display: block;overflow-x: auto;border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;font-family: Consolas, Monaco, Menlo, monospace;font-size: 14px;line-height: 1.5;"><span leaf="">《春暖花开》</span><span leaf=""><br></span><span leaf="">我期待的不是风</span><span leaf=""><br></span><span leaf="">而是有你的花季</span><span leaf=""><br></span><span leaf="">我期待的不是风</span><span leaf=""><br></span><span leaf="">而是芬芳的印记</span><span leaf=""><br></span><span leaf="">我期待的是永恒</span><span leaf=""><br></span><span leaf="">没成想花期比誓言更绚丽</span><span leaf=""><br></span><span leaf="">明明绽放要共赴朝夕</span><span leaf=""><br></span><span leaf="">我期待的不是风</span><span leaf=""><br></span><span leaf="">那是蝶舞的春意</span><span leaf=""><br></span><span leaf="">我期待的不是风</span><span leaf=""><br></span><span leaf="">吹散离别的愁绪</span><span leaf=""><br></span><span leaf="">我期待的是永恒</span><span leaf=""><br></span><span leaf="">阳光正融化最后一片雪霁</span></code></pre> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <section style="color: rgb(0, 0, 0);font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: flex;place-items: flex-start;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;background-color: rgb(255, 245, 235);margin-bottom: 20px;padding: 16px 10px;border: 1px solid rgb(254, 212, 164);border-radius: 8px;text-align: left;> <span style="display: flex;align-items: center;justify-content: center;"><span style="font-size: 15px;margin-right: 8px;"><span leaf="">🌟</span></span></span> <section style=""> <p style="font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">注意这里一定让新歌词和「原歌曲片段」歌词结构和字数一致,不然后面翻唱对不上节奏。</span></span></p> </section> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <h2 style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: 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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-weight: bold;color: rgb(31, 35, 41);font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.578px;margin-top: 0px;margin-bottom: 8px;font-size: 22px;padding-bottom: 12px;><span style="color: rgb(31, 35, 41);"><span leaf="">人声转 MIDI</span></span></h2> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">什么是 MIDI?</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;text-align: left;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">MIDI 文件就是给电子乐器们看的“乐谱”!而且也很容易转换成人类能阅读的乐谱!</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">就是全民 K 歌里的那个“乐谱”。</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001477" data-ratio="1.7777777777777777" src="/upload/fa685ae6d196c0de503389941454ab79.png" data-type="png" data-w="288" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">先在剪映里把「原歌曲片段」进行人声分离,然后导出「人声音频」,备用着。</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img src="/upload/1f92faf7f0ed34e91587bc4bff881ba5.png" alt="Image" class="rich_pages wxw-img" data-ratio="1.2068181818181818" data-type="png" data-w="440" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;" data-imgfileid="100001482"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001478" data-ratio="0.2952029520295203" src="/upload/63c4baf35e2c21c490dc5230ce5e719a.png" data-type="png" data-w="271" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">安装个电脑软件网易云音乐 x studio(</span></span><span style="color: rgb(31, 35, 41);"><span leaf="">https://xstudio.music.163.com/</span></span><span style="color: rgb(31, 35, 41);"><span leaf="">)。</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">然后点击「文件」-「导入」-「导入音频」,选择之前生成的「人声音频」。</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001479" data-ratio="0.4777227722772277" src="/upload/0ddd317b11dd4f127449bcf900e55d4b.png" data-type="png" data-w="404" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">接着点击「工具」-「人声转 midi」,把「人声音频」再转为 midi,人声可以随意选择。</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img src="/upload/d912899f8bacf020f9ba388e1dadeab0.png" alt="Image" class="rich_pages wxw-img" data-ratio="0.3008130081300813" data-type="png" data-w="615" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;" data-imgfileid="100001480"> </section> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001481" data-ratio="2.520661157024793" src="/upload/f6be3d269e15c6e6ddd58a56b9ebecbe.png" data-type="png" data-w="242" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">这样就得到了一个“乐谱”。</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001487" data-ratio="0.2851851851851852" src="/upload/6b11b4d957699305bb67caf67dbd3eaf.png" data-type="png" data-w="1080" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">仔细一看,“乐谱”上的拼音就是「原歌曲片段」歌词的拼音。</span></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <h2 style="font-style: normal;font-variant-ligatures: normal;font-variant-caps: 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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-weight: bold;color: rgb(31, 35, 41);font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;letter-spacing: 0.578px;margin-top: 0px;margin-bottom: 8px;font-size: 22px;padding-bottom: 12px;><span style="color: rgb(31, 35, 41);"><span leaf="">改歌词</span></span></h2> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">随便选中一个黄色的拼音,点击右键,选择「编辑全部歌词」。</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001483" data-ratio="1.83402489626556" src="/upload/ba9fed498b51072121c14b9e6228ff02.png" data-type="png" data-w="241" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">删掉拼音,粘贴新歌词,点击确定。</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001486" data-ratio="0.5339805825242718" src="/upload/effa043c588d680b1fa1b9b8dda16109.png" data-type="png" data-w="515" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">改编歌词的「新人声」就生成了,点击导出。</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001485" data-ratio="0.509453781512605" src="/upload/d66f0405e97e88ac572dde77dade1804.png" data-type="png" data-w="952" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);"><span leaf="">最后把「新人声」放在剪映里,和「原歌曲片段」的背景音组合一下,就完成了,是不是很简单。</span></span></p> <section style="color: rgb(0, 0, 0);font-family: " microsoft yahei;font-size: medium;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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;margin-bottom: 12px; nodeleaf=""> <img alt="Image" class="rich_pages wxw-img" data-imgfileid="100001484" data-ratio="0.6410256410256411" src="/upload/f50fd691198446e4fd790d8fed3a046d.png" data-type="png" data-w="429" style="display: inline-block;max-width: 100%;height: auto;border-radius: 12px;"> </section> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span leaf=""><br></span></p> <p style="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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 15px;line-height: 2em;font-family: " pingfang sc, system-ui, -apple-system, blinkmacsystemfont, helvetica neue, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(31, 35, 41);margin: 0px 4px;word-break: break-all;min-height: 20px;><span style="color: rgb(31, 35, 41);font-weight: bold;"><span leaf="">把爱好变成副业,就像让热爱成为面包里的酵母——既喂养生活,也发酵梦想。</span></span></p>