文章列表

自动抓取抖音和小红书创作者中心里的视频播放、完播、点击、2s 跳出、播放时长、点赞、分享、评论、收藏、主页访问、粉丝增量等数据。

作者:微信小助手

<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: system-ui, " pingfang sc, stheiti, sans-serif;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;> <section class="mp_profile_iframe_wrp" nodeleaf=""> <mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-nickname="github淘金" data-alias="hello_github" data-from="0" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/cXMobZGibu9YtyOjTMLycobRo96pEDWUETV0icibIWoJSPpNxA6Z669AMYwxUcicfBT3sojCdibE6X0JV8wKqiaqQruw/0?wx_fmt=png" data-signature="打破信息差,不为免费而付费。关注我,每日分享各种有趣,实用的开源项目。" data-id="Mzg2MjY1NDIzNg==" data-is_biz_ban="0" data-service_type="1"></mp-common-profile> </section> <h2 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 16.8px;font-weight: bold;margin: 4em auto 2em;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;display: table;padding: 0px 0.2em;color: rgb(255, 255, 255);background: rgb(15, 76, 129);><span leaf="">xhs_douyin_content</span></h2> <blockquote style="box-sizing: border-box;border-width: 0px 0px 0px 4px;border-style: solid;border-left-color: rgb(15, 76, 129);margin: 0px 0px 1em;text-align: left;line-height: 1.75;font-size: 14px;font-style: normal;padding: 1em;border-radius: 6px;color: rgba(0, 0, 0, 0.5);background: rgb(247, 247, 247);"> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 0px;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: 1em;display: block;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">自动抓取抖音和小红书创作者中心里的每条视频的播放、完播、点击、2s 跳出、播放时长、点赞、分享、评论、收藏、主页访问、粉丝增量等数据。</span></p> </blockquote> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf="">Github地址</span></p> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-weight: bold;">https://github.com/cwjcw/xhs_douyin_content</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/db0967434e200f121b033a78e5fc0985.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.5444444444444444" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="100010205"> </section> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf="">创建项目参数文件夹和文件</span></h3> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">• 新建project_config文件夹,在文件夹内创建project.py文件,输入以下内容:</span> </section></li> </ul> <pre style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;margin: 10px 8px;color: rgb(201, 209, 217);background: rgb(13, 17, 23);text-align: left;line-height: 1.5;overflow-x: auto;border-radius: 8px;padding: 0px !important;><span hidden style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: flex;padding: 10px 14px 0px;"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" width="45px" height="13px" viewbox="0 0 450 130"> <ellipse cx="50" cy="65" rx="50" ry="52" stroke="rgb(220,60,54)" stroke-width="2" fill="rgb(237,108,96)"></ellipse><ellipse cx="225" cy="65" rx="50" ry="52" stroke="rgb(218,151,33)" stroke-width="2" fill="rgb(247,193,81)"></ellipse><ellipse cx="400" cy="65" rx="50" ry="52" stroke="rgb(27,161,37)" stroke-width="2" fill="rgb(100,200,86)"></ellipse> </svg></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: Menlo, " operator mono, consolas, monaco, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;display: -webkit-box;padding: 0.5em 1em 1em;overflow-x: auto;text-indent: 0px;text-align: left;line-height: 1.75;margin: 0px;white-space: nowrap;><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(255, 123, 114);"><span leaf="">import</span></span><span leaf="">&nbsp;os</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(139, 148, 158);"><span leaf=""># 存放excel下载的路径,请注意可以用你自己本地的路径替换</span></span><span leaf=""><br></span><span leaf="">file_path =&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">r'E:\\'</span></span><span leaf=""><br></span><span leaf="">data_path = os.path.join(file_path,</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">'data.xlsx'</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf="">yesterday_data_path = os.path.join(file_path,</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">'yesterday_data.xlsx'</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(139, 148, 158);"><span leaf=""># 存放sql文件的路径,这个是我自己存放sql文件的,可以忽略</span></span><span leaf=""><br></span><span leaf="">custom_count_sql =&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">r'G:\New Code\douyin_video\sql\douyin_customer.sql'</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(139, 148, 158);"><span leaf=""># 字段映射关系(name到label),这个也是我自己用的,可以忽略</span></span><span leaf=""><br></span><span leaf="">video_content = { &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1741257105163"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"账号名称"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1741257105165"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"账号ID"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740798082550"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"是否完整内容"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740798082567"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"完整内容提供"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740798082568"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"半成品内容提供"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740798082569"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"剪辑"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740798082570"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"发布运营"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740646149825"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"正片标题"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740798082556"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"正片链接"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740646149824"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"正片ID"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740646149826"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"提交日期"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1741934971937"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"来源门店/部门"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740655279753"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"正片说明"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740655279752"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"正片封面"</span></span><span leaf="">, &nbsp; &nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"_widget_1740656251325"</span></span><span leaf="">:&nbsp;</span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(165, 214, 255);"><span leaf="">"数量"</span></span><span leaf=""><br></span><span leaf="">}</span></code></pre> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf="">用法</span></h3> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf="">爬虫部分,在spiders文件夹中</span></h4> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">• 如果只是仅仅对抓取抖音和小红书后台内容有兴趣,直接运行spiders文件夹下的douyin.py和xhs.py即可。</span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">• 第一次需要扫码登录,登陆后回到代码界面输入回车,即可继续。</span> </section></li> </ul> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf="">数据处理部分,在data_processing文件夹中</span></h4> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">• 可以先从后台下载对应的excel文件,清空标题以外的内容,命名为yesterday_data.xlsx</span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf="">• 系统会自动下载data.xlsx,并在处理完后,自动将data.xlsx命名为yesterday_data.xlsx</span> </section></li> </ul> </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: system-ui, " pingfang sc, stheiti, sans-serif;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> <span leaf=""><br></span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

Java+RAG开发手册:从文档处理到生成优化的完整代码实现

作者:微信小助手

<h1 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;margin-top: 0px !important;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial; data-pm-slice="0 0 []"><span style="font-size:20px;"><strong><span style="letter-spacing: 2px;"><span leaf="">Java结合RAG:构建智能问答系统的实战指南</span></span></strong></span></h1> <h2 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">引言:当Java遇见RAG技术</span></span></h2> <p style="font-size: 16.002px;line-height: var(--ds-md-line-height);color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">在人工智能技术飞速发展的今天,检索增强生成(Retrieval-Augmented Generation,简称RAG)已成为构建智能问答系统的关键技术。作为企业级应用开发的主力语言,</span><span style="letter-spacing: 2px;color: #1f497d;"><span leaf="">Java与RAG技术的结合为开发者提供了构建高效、可靠智能系统的强大工具组合。本文将深入探讨如何利用Java生态系统结合RAG技术,从原理到实践,手把手带你构建一个完整的智能问答系统。</span></span></span></p> <h2 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"></span></h2> <section data-tools="135编辑器" data-id="117073"> <section style="margin: 20px auto;"> <section style="border: 1px solid #52b2a6;"> <section style="background-color: #52b2a6;display: flex;justify-content: space-between;padding: 3px 0;"> <section style="display: flex;justify-content: space-between;padding: 0 5px;"> <section style="flex-shrink: 0;display: flex;align-items: center;"> <section style="box-sizing:border-box;width: 2px;background-color: #ffffff;height: 70%;"> <span leaf=""><br></span> </section> </section> <section style="font-size: 14px;color: #ffffff;text-align: left;letter-spacing: 1.5px;padding: 0 0 0 5px;"> <strong data-brushtype="text"><span leaf="">第一部分:RAG技术核心解析</span></strong> </section> </section> <section style="display: flex;align-items: center;"> <section style="flex-shrink: 0;padding-right: 5px;"> <section style="box-sizing:border-box;width: 10px;height: 10px;background-color: #ffffff;"> <span leaf=""><br></span> </section> </section> <section style="flex-shrink: 0;padding-right: 5px;"> <section style="box-sizing:border-box;width: 10px;height: 10px;background-color: #ffdc61;"> <span leaf=""><br></span> </section> </section> </section> </section> <section style="padding: 7px 12px;"> <section data-autoskip="1" style="text-align: justify;line-height:1.75em;letter-spacing: 1.5px;font-size:14px;color:#333;background: transparent;"> <p><span leaf="">1 RAG技术架构剖析</span></p> <p><span leaf="">RAG技术通过结合信息检索与文本生成两大模块,有效解决了传统大语言模型的知识更新滞后和"幻觉"问题。其核心工作流程分为三个阶段:</span></p> <p><span style="color: #e36c09;"><span leaf="">检索阶段:根据用户查询从知识库中检索相关文档片段</span></span></p> <p><span style="color: #e36c09;"><span leaf="">增强阶段:将检索结果与原始查询结合形成增强上下文</span></span></p> <p><span style="color: #e36c09;"><span leaf="">生成阶段:基于增强上下文生成最终响应</span></span></p> <p><span leaf="">2 Java在RAG系统中的定位</span></p> <p><span leaf="">Java在RAG系统中主要承担以下关键角色:</span></p> <p><span leaf="">构建高效检索后端</span></p> <p><span leaf="">处理大规模文档预处理</span></p> <p><span leaf="">实现业务逻辑集成</span></p> <p><span leaf="">提供稳定可靠的服务部署</span></p> </section> </section> </section> </section> </section> <p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"></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="typescript"><code><span leaf=""><span class="code-snippet__comment">// 典型Java RAG系统架构示例</span></span></code><code><span leaf=""><span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__keyword">class</span>&nbsp;<span class="code-snippet__title">RAGSystem</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">private</span>&nbsp;<span class="code-snippet__title">DocumentRetriever</span>&nbsp;retriever;</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">private</span>&nbsp;<span class="code-snippet__title">AnswerGenerator</span>&nbsp;generator;</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__title">String</span>&nbsp;<span class="code-snippet__title">answerQuestion</span>(<span class="code-snippet__params"><span class="code-snippet__built_in">String</span></span><span class="code-snippet__params">&nbsp;question</span>) {</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__title">List</span>&lt;<span class="code-snippet__title">Document</span>&gt; relevantDocs = retriever.<span class="code-snippet__title">retrieve</span>(question);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">return</span>&nbsp;generator.<span class="code-snippet__title">generateAnswer</span>(question, relevantDocs);</span></code><code><span leaf="">&nbsp; &nbsp; }</span></code><code><span leaf="">}</span></code></pre> </section> <h2 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">第二部分:Java实现RAG核心组件</span></span></h2> <h3 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">1 文档处理与向量化</span></span></h3> <p style="font-size: 16.002px;line-height: var(--ds-md-line-height);color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">文档处理是RAG系统的基石,Java提供了强大的文本处理库:</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="typescript"><code><span leaf=""><span class="code-snippet__comment">// 使用Lucene进行文档处理</span></span></code><code><span leaf=""><span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__keyword">class</span>&nbsp;<span class="code-snippet__title">DocumentProcessor</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__title">List</span>&lt;<span class="code-snippet__title">DocumentChunk</span>&gt;&nbsp;<span class="code-snippet__title">processDocument</span>(<span class="code-snippet__params"><span class="code-snippet__built_in">String</span></span><span class="code-snippet__params">&nbsp;rawText</span>) {</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__comment">// 文本清洗</span></span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__title">String</span>&nbsp;cleaned =&nbsp;<span class="code-snippet__title">TextCleaner</span>.<span class="code-snippet__title">removeSpecialChars</span>(rawText);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__comment">// 分句处理</span></span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__title">List</span>&lt;<span class="code-snippet__title">String</span>&gt; sentences =&nbsp;<span class="code-snippet__title">SentenceSplitter</span>.<span class="code-snippet__title">split</span>(cleaned);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__comment">// 文本向量化(可集成Python服务)</span></span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">return</span>&nbsp;sentences.<span class="code-snippet__title">stream</span>()</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span class="code-snippet__title">map</span>(sentence -&gt;&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">DocumentChunk</span>(sentence,&nbsp;<span class="code-snippet__title">VectorizationService</span>.<span class="code-snippet__title">toVector</span>(sentence)))</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span class="code-snippet__title">collect</span>(<span class="code-snippet__title">Collectors</span>.<span class="code-snippet__title">toList</span>());</span></code><code><span leaf="">&nbsp; &nbsp; }</span></code><code><span leaf="">}</span></code></pre> </section> <p><span leaf="">2 高效检索实现</span></p> <p style="font-size: 16.002px;line-height: var(--ds-md-line-height);color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">Java生态中有多种高效的检索方案可选:</span></span></p> <ol style="color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;font-size: 16.002px;text-decoration-thickness: initial; class="list-paddingleft-1"> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"><strong><span leaf="">Apache Lucene方案</span></strong><span leaf="">:</span></span></p></li> </ol> <ol style="color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;font-size: 16.002px;text-decoration-thickness: initial; class="list-paddingleft-1"> <li> <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 leaf=""><span class="code-snippet__comment">// 构建内存索引</span></span></code><code><span leaf=""><span class="code-snippet__type">RAMDirectory</span>&nbsp;<span class="code-snippet__variable">directory</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">RAMDirectory</span>();</span></code><code><span leaf=""><span class="code-snippet__type">IndexWriterConfig</span>&nbsp;<span class="code-snippet__variable">config</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">IndexWriterConfig</span>(<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">StandardAnalyzer</span>());</span></code><code><span leaf=""><span class="code-snippet__type">IndexWriter</span>&nbsp;<span class="code-snippet__variable">writer</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">IndexWriter</span>(directory, config);</span></code><code><span leaf=""><span class="code-snippet__comment">// 添加文档</span></span></code><code><span leaf=""><span class="code-snippet__type">Document</span>&nbsp;<span class="code-snippet__variable">doc</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">Document</span>();</span></code><code><span leaf="">doc.add(<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">TextField</span>(<span class="code-snippet__string">"content"</span>, documentText, Field.Store.YES));</span></code><code><span leaf="">writer.addDocument(doc);</span></code><code><span leaf="">writer.close();</span></code><code><span leaf=""><span class="code-snippet__comment">// 执行检索</span></span></code><code><span leaf=""><span class="code-snippet__type">IndexReader</span>&nbsp;<span class="code-snippet__variable">reader</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;DirectoryReader.open(directory);</span></code><code><span leaf=""><span class="code-snippet__type">IndexSearcher</span>&nbsp;<span class="code-snippet__variable">searcher</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">IndexSearcher</span>(reader);</span></code><code><span leaf=""><span class="code-snippet__type">Query</span>&nbsp;<span class="code-snippet__variable">query</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">TermQuery</span>(<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">Term</span>(<span class="code-snippet__string">"content"</span>, searchTerm));</span></code><code><span leaf=""><span class="code-snippet__type">TopDocs</span>&nbsp;<span class="code-snippet__variable">hits</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;searcher.search(query,&nbsp;<span class="code-snippet__number">10</span>);</span></code></pre> </section><p><span leaf=""><br></span></p><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"><strong><span leaf="">向量数据库集成方案</span></strong><span leaf="">:</span></span></p></li> <ul class="list-paddingleft-1"> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> </ul> </ol> <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 leaf=""><span class="code-snippet__comment">// 使用JNI集成Milvus</span></span></code><code><span leaf=""><span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__keyword">class</span>&nbsp;<span class="code-snippet__title">VectorSearcher</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">static</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; System.loadLibrary(<span class="code-snippet__string">"milvus_java_sdk"</span>);</span></code><code><span leaf="">&nbsp; &nbsp; }</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__function"><span class="code-snippet__keyword">public</span></span><span class="code-snippet__function">&nbsp;List <string>&nbsp; </string></span><span class="code-snippet__function"><span class="code-snippet__title">searchSimilarVectors</span></span><span class="code-snippet__function">(</span><span class="code-snippet__function"><span class="code-snippet__params"><span class="code-snippet__built_in">float</span></span></span><span class="code-snippet__function"><span class="code-snippet__params">[] queryVector,&nbsp;</span></span><span class="code-snippet__function"><span class="code-snippet__params"><span class="code-snippet__built_in">int</span></span></span><span class="code-snippet__function"><span class="code-snippet__params">&nbsp;topK</span></span><span class="code-snippet__function">)</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__comment">// 调用本地库进行向量相似度搜索</span></span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__comment">// ...</span></span></code><code><span leaf="">&nbsp; &nbsp; }</span></code><code><span leaf="">}</span></code></pre> </section> <h2 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">第三部分:完整RAG系统实现</span></span></h2> <h3 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">1 系统架构设计</span></span></h3> <p style="font-size: 16.002px;line-height: var(--ds-md-line-height);color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">我们设计一个基于Spring Boot的RAG服务:</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="css"><code><span leaf="">RAG-System</span></code><code><span leaf="">├──&nbsp;<span class="code-snippet__attribute">src</span>/<span class="code-snippet__selector-tag">main</span>/java</span></code><code><span leaf="">│ &nbsp; ├── controller - 对外API接口</span></code><code><span leaf="">│ &nbsp; ├── service &nbsp; &nbsp;- 核心业务逻辑</span></code><code><span leaf="">│ &nbsp; │ &nbsp; ├── retrieval - 检索相关</span></code><code><span leaf="">│ &nbsp; │ &nbsp; ├── generation - 生成相关</span></code><code><span leaf="">│ &nbsp; │ &nbsp; └── knowledge - 知识库管理</span></code><code><span leaf="">│ &nbsp; ├── model &nbsp; &nbsp; - 数据模型</span></code><code><span leaf="">│ &nbsp; └── config &nbsp; &nbsp;- 配置类</span></code><code><span leaf="">├──&nbsp;<span class="code-snippet__attribute">src</span>/<span class="code-snippet__selector-tag">main</span>/resources</span></code><code><span leaf="">│ &nbsp; ├── application<span class="code-snippet__selector-class">.yml</span>&nbsp;- 应用配置</span></code><code><span leaf="">│ &nbsp; └── knowledge-base - 知识库文档</span></code></pre> </section> <section style=";"> <section style="background-color: #ffffff;top: 0px;"> <section style="color: #ffffff;font-size: var(--ds-md-code-block-font-size);line-height: var(--ds-md-code-block-font-size);background: #50505a;justify-content: space-between;display: flex;"> <section style="height: 0px;"> <span leaf=""><br></span> </section> </section> </section> </section> <h3 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">3.2 核心服务实现</span></span></h3> <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="typescript"><code><span leaf=""><span class="code-snippet__meta">@Service</span></span></code><code><span leaf=""><span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__keyword">class</span>&nbsp;<span class="code-snippet__title">RAGService</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__meta">@Autowired</span></span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">private</span>&nbsp;<span class="code-snippet__title">VectorStore</span>&nbsp;vectorStore;</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__meta">@Autowired</span></span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">private</span>&nbsp;<span class="code-snippet__title">LLMIntegration</span>&nbsp;llm;</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__title">AnswerResponse</span>&nbsp;<span class="code-snippet__title">getAnswer</span>(<span class="code-snippet__params">QuestionRequest request</span>) {</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__comment">// 1. 检索阶段</span></span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__title">List</span>&lt;<span class="code-snippet__title">Document</span>&gt; relevantDocs = vectorStore.<span class="code-snippet__title">search</span>(request.<span class="code-snippet__title">getQuestion</span>(),&nbsp;<span class="code-snippet__number">5</span>);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__comment">// 2. 构建提示词</span></span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__title">String</span>&nbsp;prompt =&nbsp;<span class="code-snippet__title">buildPrompt</span>(request.<span class="code-snippet__title">getQuestion</span>(), relevantDocs);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__comment">// 3. 生成回答</span></span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__title">String</span>&nbsp;generatedAnswer = llm.<span class="code-snippet__title">generate</span>(prompt);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">return</span>&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">AnswerResponse</span>(generatedAnswer, relevantDocs);</span></code><code><span leaf="">&nbsp; &nbsp; }</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">private</span>&nbsp;<span class="code-snippet__title">String</span>&nbsp;<span class="code-snippet__title">buildPrompt</span>(<span class="code-snippet__params"><span class="code-snippet__built_in">String</span></span><span class="code-snippet__params">&nbsp;question, List <document> documents </document></span>) {</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__title">StringBuilder</span>&nbsp;context =&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">StringBuilder</span>();</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; context.<span class="code-snippet__title">append</span>(<span class="code-snippet__string">"基于以下上下文回答问题:\n"</span>);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; documents.<span class="code-snippet__title">forEach</span>(doc -&gt; context.<span class="code-snippet__title">append</span>(doc.<span class="code-snippet__title">getContent</span>()).<span class="code-snippet__title">append</span>(<span class="code-snippet__string">"\n"</span>));</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; context.<span class="code-snippet__title">append</span>(<span class="code-snippet__string">"\n问题:"</span>).<span class="code-snippet__title">append</span>(question);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; context.<span class="code-snippet__title">append</span>(<span class="code-snippet__string">"\n回答:"</span>);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">return</span>&nbsp;context.<span class="code-snippet__title">toString</span>();</span></code><code><span leaf="">&nbsp; &nbsp; }</span></code><code><span leaf="">}</span></code></pre> </section> <h3 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">3 生成模块集成</span></span></h3> <p style="font-size: 16.002px;line-height: var(--ds-md-line-height);color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">Java与Python生成服务的典型集成方式:</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="typescript"><code><span leaf=""><span class="code-snippet__meta">@FeignClient</span>(name =&nbsp;<span class="code-snippet__string">"llm-service"</span>, url =&nbsp;<span class="code-snippet__string">"${llm.service.url}"</span>)</span></code><code><span leaf=""><span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__keyword">interface</span>&nbsp;<span class="code-snippet__title">LLMServiceClient</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__meta">@PostMapping</span>(<span class="code-snippet__string">"/generate"</span>)</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__title">String</span>&nbsp;<span class="code-snippet__title">generateText</span>(<span class="code-snippet__meta">@RequestBody</span>&nbsp;<span class="code-snippet__title">GenerationRequest</span>&nbsp;request);</span></code><code><span leaf="">}</span></code><code><span leaf=""><span class="code-snippet__meta">@Service</span></span></code><code><span leaf=""><span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__keyword">class</span>&nbsp;<span class="code-snippet__title">LLMIntegration</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__meta">@Autowired</span></span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">private</span>&nbsp;<span class="code-snippet__title">LLMServiceClient</span>&nbsp;llmClient;</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__title">String</span>&nbsp;<span class="code-snippet__title">generate</span>(<span class="code-snippet__params"><span class="code-snippet__built_in">String</span></span><span class="code-snippet__params">&nbsp;prompt</span>) {</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__title">GenerationRequest</span>&nbsp;request =&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">GenerationRequest</span>(prompt,&nbsp;<span class="code-snippet__number">0.7</span>,&nbsp;<span class="code-snippet__number">100</span>);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">return</span>&nbsp;llmClient.<span class="code-snippet__title">generateText</span>(request);</span></code><code><span leaf="">&nbsp; &nbsp; }</span></code><code><span leaf="">}</span></code></pre> </section> <h2 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">第四部分:性能优化实践</span></span></h2> <h3 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">1 检索性能优化</span></span></h3> <ol style="color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;font-size: 16.002px;text-decoration-thickness: initial; class="list-paddingleft-1"> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"><strong><span leaf="">索引优化技巧</span></strong><span leaf="">:</span></span></p></li> </ol> <ol style="color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;font-size: 16.002px;text-decoration-thickness: initial; class="list-paddingleft-1"> <li> <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 leaf=""><span class="code-snippet__comment">// 使用更高效的索引配置</span></span></code><code><span leaf=""><span class="code-snippet__type">IndexWriterConfig</span>&nbsp;<span class="code-snippet__variable">config</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">IndexWriterConfig</span>(<span class="code-snippet__keyword">new</span>&nbsp;<span class="code-snippet__title">StandardAnalyzer</span>());</span></code><code><span leaf="">config.setUseCompoundFile(<span class="code-snippet__literal">false</span>);&nbsp;<span class="code-snippet__comment">// 提升索引速度</span></span></code><code><span leaf="">config.setRAMBufferSizeMB(<span class="code-snippet__number">256</span>); &nbsp;<span class="code-snippet__comment">// 增加内存缓冲区</span></span></code></pre> </section></li> <ul class="list-paddingleft-1"> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> </ul> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"><strong><span leaf="">缓存策略实现</span></strong><span leaf="">:</span></span></p></li> </ol> <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="swift"><code><span leaf=""><span class="code-snippet__comment">// 使用Caffeine实现查询缓存</span></span></code><code><span leaf=""><span class="code-snippet__type">LoadingCache</span>&lt;<span class="code-snippet__type">String</span>,&nbsp;<span class="code-snippet__type">List</span>&lt;<span class="code-snippet__type">Document</span>&gt;&gt; queryCache&nbsp;<span class="code-snippet__operator">=</span>&nbsp;<span class="code-snippet__type">Caffeine</span>.newBuilder()</span></code><code><span leaf="">&nbsp; &nbsp; .maximumSize(<span class="code-snippet__number">10_000</span>)</span></code><code><span leaf="">&nbsp; &nbsp; .expireAfterWrite(<span class="code-snippet__number">1</span>,&nbsp;<span class="code-snippet__type">TimeUnit</span>.<span class="code-snippet__type">HOURS</span>)</span></code><code><span leaf="">&nbsp; &nbsp; .build(query -&gt; vectorStore.search(query,&nbsp;<span class="code-snippet__number">5</span>));</span></code></pre> </section> <p><span leaf="">2 生成质量提升</span></p> <ol style="color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;font-size: 16.002px;text-decoration-thickness: initial; class="list-paddingleft-1"> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"><strong><span leaf="">提示词工程优化</span></strong><span leaf="">:</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="python"><code><span leaf="">public&nbsp;<span class="code-snippet__keyword">class</span>&nbsp;<span class="code-snippet__title">PromptBuilder</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp; private static final String PROMPT_TEMPLATE =&nbsp;<span class="code-snippet__string">"""</span></span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; 你是一个专业的知识助手,请严格根据提供的上下文回答问题。</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; 上下文:</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; %s</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; 问题:%s</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; 回答要求:</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; - 如果上下文不包含答案,请回答"根据现有信息无法回答此问题"</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; - 保持回答专业、简洁</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; - 使用中文回答</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; 回答:""";</span></code><code><span leaf="">&nbsp; &nbsp; public String build(String question,&nbsp;<span class="code-snippet__type">List</span> <document> context) { </document></span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; String contextStr = context.stream()</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span class="code-snippet__built_in">map</span>(Document::getContent)</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .collect(Collectors.joining(<span class="code-snippet__string">"\n\n"</span>));</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">return</span>&nbsp;String.<span class="code-snippet__built_in">format</span>(PROMPT_TEMPLATE, contextStr, question);</span></code><code><span leaf="">&nbsp; &nbsp; }</span></code><code><span leaf="">}</span></code></pre> </section><p><span leaf=""><br></span></p></li> <ul class="list-paddingleft-1"> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> <li> <section> <span leaf=""><br></span> </section></li> </ul> </ol> <h2 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">第五部分:生产环境部署方案</span></span></h2> <h3 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">1 知识库热更新方案</span></span></h3> <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="typescript"><code><span leaf=""><span class="code-snippet__meta">@Scheduled</span>(fixedRate =&nbsp;<span class="code-snippet__number">6</span>&nbsp;*&nbsp;<span class="code-snippet__number">60</span>&nbsp;*&nbsp;<span class="code-snippet__number">60</span>&nbsp;*&nbsp;<span class="code-snippet__number">1000</span>)&nbsp;<span class="code-snippet__comment">// 每6小时执行一次</span></span></code><code><span leaf=""><span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__built_in">void</span>&nbsp;<span class="code-snippet__title">refreshKnowledgeBase</span>() {</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__title">List</span>&lt;<span class="code-snippet__title">Document</span>&gt; newDocuments = documentLoader.<span class="code-snippet__title">loadLatest</span>();</span></code><code><span leaf="">&nbsp; &nbsp; vectorStore.<span class="code-snippet__title">updateIndex</span>(newDocuments);</span></code><code><span leaf="">&nbsp; &nbsp; logger.<span class="code-snippet__title">info</span>(<span class="code-snippet__string">"知识库更新完成,新增文档:{}"</span>, newDocuments.<span class="code-snippet__title">size</span>());</span></code><code><span leaf="">}</span></code></pre> </section> <h3 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">2 监控与日志</span></span></h3> <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 leaf=""><span class="code-snippet__meta">@Aspect</span></span></code><code><span leaf=""><span class="code-snippet__meta">@Component</span></span></code><code><span leaf=""><span class="code-snippet__meta">@Slf4j</span></span></code><code><span leaf=""><span class="code-snippet__keyword">public</span>&nbsp;<span class="code-snippet__keyword">class</span>&nbsp;<span class="code-snippet__title">RAGMonitoringAspect</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__meta">@Around("execution(* com.example.rag.service..*(..))")</span></span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">public</span>&nbsp;Object&nbsp;<span class="code-snippet__title">monitorPerformance</span><span class="code-snippet__params">(ProceedingJoinPoint joinPoint)</span>&nbsp;<span class="code-snippet__keyword">throws</span>&nbsp;Throwable {</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__type">long</span>&nbsp;<span class="code-snippet__variable">start</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;System.currentTimeMillis();</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">try</span>&nbsp;{</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__type">Object</span>&nbsp;<span class="code-snippet__variable">result</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;joinPoint.proceed();</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__type">long</span>&nbsp;<span class="code-snippet__variable">duration</span>&nbsp;<span class="code-snippet__operator">=</span>&nbsp;System.currentTimeMillis() - start;</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; log.info(<span class="code-snippet__string">"Method {} executed in {} ms"</span>,&nbsp;</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joinPoint.getSignature().getName(), duration);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Metrics.recordLatency(duration);</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">return</span>&nbsp;result;</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;<span class="code-snippet__keyword">catch</span>&nbsp;(Exception e) {</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Metrics.recordError();</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="code-snippet__keyword">throw</span>&nbsp;e;</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></code><code><span leaf="">&nbsp; &nbsp; }</span></code><code><span leaf="">}</span></code></pre> </section> <h2 style="font-weight: var(--ds-font-weight-strong);line-height: 1.5;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">结语:Java在RAG系统中的独特价值</span></span></h2> <p style="font-size: 16.002px;line-height: var(--ds-md-line-height);color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">Java凭借其稳定的性能、丰富的生态系统和强大的企业级支持,成为构建生产级RAG系统的理想选择。通过本文介绍的技术方案,开发者可以:</span></span></p> <ol style="color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;font-size: 16.002px;text-decoration-thickness: initial; class="list-paddingleft-1"> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing: 2px;color: #ff0000;"><span leaf="">实现文档处理流水线</span></span></p></li> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing: 2px;color: #ff0000;"><span leaf="">构建高性能检索模块</span></span></p></li> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing: 2px;color: #ff0000;"><span leaf="">集成大语言模型生成能力</span></span></p></li> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"><span leaf="">部署可靠的生产服务</span></span></p></li> </ol> <p style="font-size: 16.002px;line-height: var(--ds-md-line-height);color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf="">未来,随着向量数据库技术的成熟和Java生态对AI支持增强,Java在RAG领域的应用前景将更加广阔。建议开发者持续关注:</span></span></p> <p style="font-size: 16.002px;line-height: var(--ds-md-line-height);color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;text-decoration-thickness: initial;><span style="letter-spacing:2px;"><span leaf=""><img alt="微信图片_20250324164237.jpg" class="rich_pages wxw-img" data-imgfileid="100009246" data-ratio="0.5611111111111111" src="/upload/5bd0647ae522e447d93100fc881f5181.jpg" data-type="jpeg" data-w="1080" style="vertical-align:baseline;"></span></span></p> <ul style="color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;font-size: 16.002px;text-decoration-thickness: initial; class="list-paddingleft-1"> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"><span leaf="">JDK对向量运算的本地支持</span></span></p></li> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"><span leaf="">Java ML库的持续发展</span></span></p></li> <li><p style="margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"><span leaf="">云原生RAG架构的演进</span></span></p></li> </ul> <blockquote style="border-left: 2px solid rgb(var(--ds-rgb-label-3));margin-top: 0px;margin-right: 0px;margin-bottom: 0px !important;margin-left: 0px;color: #404040;font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, " segoe ui, roboto, noto sans, ubuntu, cantarell, helvetica neue, oxygen, open sans-serif;font-size: 16.002px;text-decoration-thickness: initial;> <p style="margin-bottom: 0px !important;font-size: var(--ds-md-font-size);line-height: var(--ds-md-line-height);"><span style="letter-spacing:2px;"><strong><span leaf="">实战建议</span></strong><span leaf="">:</span><span style="letter-spacing: 2px;color: #92d050;"><span leaf="">从本文的示例代码出发,先构建一个最小可行系统,再逐步扩展功能。可以先使用本地文件作为知识库,再逐步迁移到专业向量数据库;生成模块可以先调用开源模型API,再考虑私有化部署。</span></span></span></p> </blockquote> <p><span leaf=""><br></span></p> <section> <span leaf=""><br></span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

RAG维保案例分享:如何实现"文+图"的答案呈现

作者:微信小助手

<p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;" data-pm-slice="0 0 []"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">RAG一直被看成是大模型在企业应用落地的标准配置,基于企业内部文档的问答,已经解锁出大量使用需求和场景。在这些众多类型的文档中,有相当一部分包含了各类复杂图表,也就是所谓的多模态数据。</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">本篇以近期实施项目中的一个<span textstyle="" style="font-weight: bold;">挖掘机维修场景</span>为例,试图给出一个<span textstyle="" style="text-decoration: none;">针对标准化排版PDF 文档(本文演示的固定格式维修手册),使用基于坐标区域截取方法,结合Markdown 语法在回答中显示图片的示例</span>,供大家参考。</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=rjD5jyTuFrIpZ2ibE8T7YmwgiahniaXswqzwXdyPD0uyUb1hCI1KtKiafSJzx7RyX6d9bqdJmOZZZC8mQictmStut4zo4ibW6YJplAUE3fXoLtuCsiamvyvR7yItA&amp;token=ic1n0xDG6awibicbupmCyBibTR7sYicI4H5eX3rurRm0YKnzAPZ3JBuesOr9uyYVtQ7HS4DVXErYvia7JUfAWkZY7AUImESmauyyDibxdh9CvhzM6yfibMHOticELEtNRXshjpOb0Iv3f0hGMJV6UHWE9QHVWiadCe7epqNmm63wyOcsWicz7Y&amp;idx=1&amp;hy=SH&amp;m=&amp;scene=2" data-headimgurl="http://wx.qlogo.cn/finderhead/Q3auHgzwzM6zZVsTeA1zmzicJIJ9AobllQDxOo7zcQuuCicKOKHDdObg/0" data-username="v2_060000231003b20faec8c5e68e1fc3d1c807ef3db07727a507a7dcba522c09cf23bc31ebbf10@finder" data-nickname="韦东东666" data-desc="RAG维保案例分享:如何实现" 文+图的答案呈现 #rag #维保 data-nonceid="15100747617830451543" data-width="1620" data-height="1080" data-type="video" data-id="export/UzFfAgtgekIEAQAAAAAA7tsoGFpXKgAAAAstQy6ubaLX4KHWvLEZgBPE3KNYC1NqYJaJzNPgMIvUINn8YtyvdGpI6AymbGKX"></mp-common-videosnap> </section> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: center;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf=""><span textstyle="" style="font-size: 14px;color: rgb(178, 178, 178);">演示视频与文章搭配更佳</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf=""><span textstyle="" style="font-style: italic;">以下,enjoy:</span></span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(41, 148, 128);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;box-sizing: border-box !important;padding-left:4px;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">1</span></span></em></strong></p> <h2 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;font-family: PingfangSC-LIGHT,sans-serif;line-height: 9px;color: white;border-radius: 10px;background:linear-gradient(to right,rgb(41, 148, 128) 16.67%,rgb(73, 200, 149) 10%);"><span leaf="">&nbsp; &nbsp;</span></h2> <p style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"> <jncounttag></jncounttag><span leaf="">业务背景</span></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">说起挖掘机不禁让人想到了蓝翔<img src="/upload/f1a91be6100ca406a7a0fe5dd7d752e6.null" class="rich_pages wxw-img" data-ratio="1" data-w="20" style="display:inline-block;width:20px;vertical-align:middle;background-size:cover;">,搜了下说是截止到 23 年年底,全国范围的液压挖掘机保有量在 200 万台左右。对于一名具体机主而言,在实际干活的过程中,可能碰到的来自发动机、电器、液压、工作装置等大大小小几百个故障,这也让专业的挖机维修需求一直很旺盛。</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">但对于维修人员而言,显然有几个一直以来的痛点没有被很好解决,比如设备故障类型繁多,单靠个人经验难以覆盖所有问题。再有就是传统老带新的模式下,培训带教周期过长等。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/a87f8cd9f80967fdd506a4be94752606.png" class="rich_pages wxw-img" data-ratio="1.1818181818181819" data-s="300,640" data-type="png" data-w="605" type="block" data-imgfileid="502125803"> </section> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: center;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf=""><span textstyle="" style="font-size: 12px;color: rgb(178, 178, 178);">注:维修案例示例内容</span></span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">后文会介绍一个基于包含 500 多个维修案例合集,开发的挖掘机故障诊断知识库系统,维修人员只需描述故障现象即可获取相关案例,并支持图文结合的答案呈现,直观展示故障部位和维修方法。</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(41, 148, 128);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;box-sizing: border-box !important;padding-left:4px;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">2</span></span></em></strong></p> <h2 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;font-family: PingfangSC-LIGHT,sans-serif;line-height: 9px;color: white;border-radius: 10px;background:linear-gradient(to right,rgb(41, 148, 128) 33.33%,rgb(73, 200, 149) 10%);"><span leaf="">&nbsp; &nbsp;</span></h2> <p style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"> <jncounttag></jncounttag><span leaf="">系统架构</span></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf=""><span textstyle="" style="font-size: 12px;color: rgb(178, 178, 178);">注:本项目扩展自阿里云官方的 local_rag 示例,添加了本地 PDF 图片提取和显示功能,</span></span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf=""><span textstyle="" style="font-size: 12px;color: rgb(178, 178, 178);">原项目地址:</span></span><span label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="color:#66CCC5;"><span leaf=""><span textstyle="" style="font-size: 12px;color: rgb(178, 178, 178);">https://help.aliyun.com/zh/model-studio/use-cases/build-rag-application-based-on-local-retrieval?spm=a2c4g.11186623.help-menu-2400256.d_2_8.5a6771eeJWalDw#a2b0288504ybg</span></span></span><span leaf=""><span textstyle="" style="font-size: 12px;color: rgb(178, 178, 178);">&nbsp;</span></span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf=""><img src="/upload/74d710f5df3758326fd1e3bff02f3e87.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.54609375" data-s="300,640" data-type="png" data-w="1280" type="block" data-imgfileid="502125800"></span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">📄 支持多种文档类型(PDF、DOCX、TXT、XLSX、CSV)的上传和处理</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">🖼️ 智能 PDF 图片提取与显示</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">🔍 本地知识库构建与管理</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">🤖 集成阿里云通义千问系列大语言模型</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">🔄 支持非结构化数据和结构化数据处理</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">📊 可自定义 RAG 参数(召回数量、相似度阈值等)</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(41, 148, 128);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;box-sizing: border-box !important;padding-left:4px;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">3</span></span></em></strong></p> <h2 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;font-family: PingfangSC-LIGHT,sans-serif;line-height: 9px;color: white;border-radius: 10px;background:linear-gradient(to right,rgb(41, 148, 128) 50%,rgb(73, 200, 149) 10%);"><span leaf="">&nbsp; &nbsp;</span></h2> <p style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"> <jncounttag></jncounttag><span leaf="">核心技术实现</span></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="margin-left: 10px;max-width: 100%;color: rgb(26, 149, 165);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;padding-left:4px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">3.1</span></span></em></strong></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 5px;background:linear-gradient(to right,rgb(26, 149, 165) ,rgb(38, 198, 218));"><span leaf="">&nbsp; &nbsp;</span></h3> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 18px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">文档处理与图片提取</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">系统提供了多种 PDF 图片提取和处理方法,以适应不同场景需求:</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 16px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">1. 基于坐标的区域截取(推荐方法)</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">针对标准化排版的文档(如固定格式的维修手册),使用基于坐标的精确截取:</span></span></p> <pre class="code-snippet__js code-snippet code-snippet_nowrap" data-lang="javascript" style="background: rgba(0,0,0,0.03);border: 1px solid #f0f0f0;border-radius: 3px;color: #333;margin-bottom: 10px;padding: 10px;width:90%;"><code><span leaf="">def extract_images_from_maintenance_pdf(pdf_path, label_name):</span></code><code><span leaf="">&nbsp; &nbsp; image_mapping = {}</span></code><code><span leaf="">&nbsp; &nbsp; doc = fitz.open(pdf_path)</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;</span></code><code><span leaf="">&nbsp; &nbsp; # 根据文档格式定义的图片区域坐标</span></code><code><span leaf="">&nbsp; &nbsp; image_rect = fitz.Rect(400, 160, 750, 320) &nbsp;# 右侧中间区域</span></code><code><span leaf="">&nbsp; &nbsp;&nbsp;</span></code><code><span leaf="">&nbsp; &nbsp; for page_index, page in enumerate(doc):</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; # 直接从固定区域截取图片</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; pix = page.get_pixmap(matrix=fitz.Matrix(2, 2), clip=image_rect)</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; if is_valid_image(pix):</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 保存和映射图片...</span></code></pre> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><strong style="background: linear-gradient(to right,rgb(73, 200, 149),rgb(38, 198, 218));color: white;white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 2px 4px 2px 4px;"><span leaf="">优势:</span></strong><span leaf=""><br></span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf="" style="max-width: 100%;line-height: 28px;letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;">对固定格式文档效果极佳</span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf="" style="max-width: 100%;line-height: 28px;letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;">不受 PDF 内部图像对象表示形式限制</span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf="" style="max-width: 100%;line-height: 28px;letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;">可以捕获矢量图形和复合元素</span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf="" style="max-width: 100%;line-height: 28px;letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;">提高图片提取的准确率和质量</span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 16px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">2. 基于对象标记的提取(备选方法)</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">使用 PyMuPDF 的内置功能识别 PDF 中的图像对象:</span></span></p> <pre class="code-snippet__js code-snippet code-snippet_nowrap" data-lang="javascript" style="background: rgba(0,0,0,0.03);border: 1px solid #f0f0f0;border-radius: 3px;color: #333;margin-bottom: 10px;padding: 10px;width:90%;"><code><span leaf="">def extract_images_from_pdf(pdf_path, label_name):</span></code><code><span leaf="">&nbsp; &nbsp; doc = fitz.open(pdf_path)</span></code><code><span leaf="">&nbsp; &nbsp; for page in doc:</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; image_list = page.get_images(full=True)</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; for img in image_list:</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 提取和处理图片...</span></code></pre> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><strong style="background: linear-gradient(to right,rgb(73, 200, 149),rgb(38, 198, 218));color: white;white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 2px 4px 2px 4px;"><span leaf="">局限性:</span></strong><span leaf=""><br></span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">仅能提取 PDF 中显式存储的图像对象</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">无法提取矢量图形或作为背景的图片</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">可能会提取装饰性元素或无关图形</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 16px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">3. 其他优化方案</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><strong style="background: linear-gradient(to right,rgb(73, 200, 149),rgb(38, 198, 218));color: white;white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 2px 4px 2px 4px;"><span leaf="">基于内容分析的智能提取</span></strong><span leaf="">:结合文本标记定位图片</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><strong style="background: linear-gradient(to right,rgb(73, 200, 149),rgb(38, 198, 218));color: white;white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 2px 4px 2px 4px;"><span leaf="">多模态 LLM 辅助</span></strong><span leaf="">:使用视觉模型辅助识别复杂文档中的图片</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="margin-left: 10px;max-width: 100%;color: rgb(26, 149, 165);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;padding-left:4px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">3.2</span></span></em></strong></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 5px;background:linear-gradient(to right,rgb(26, 149, 165) ,rgb(38, 198, 218));"><span leaf="">&nbsp; &nbsp;</span></h3> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 18px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">图片处理流程</span></span></strong></span></strong></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/2551d160ae37854e8f2cfd54ce476442.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="2.908333333333333" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125801"> </section> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="margin-left: 10px;max-width: 100%;color: rgb(26, 149, 165);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;padding-left:4px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">3.3</span></span></em></strong></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 5px;background:linear-gradient(to right,rgb(26, 149, 165) ,rgb(38, 198, 218));"><span leaf="">&nbsp; &nbsp;</span></h3> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 18px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">RAG 技术实现</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 16px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">分块策略</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">系统针对不同类型的数据采用不同的分块策略:</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><strong style="background: linear-gradient(to right,rgb(73, 200, 149),rgb(38, 198, 218));color: white;white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 2px 4px 2px 4px;"><span leaf="">非结构化文档</span></strong><span leaf="">:</span></span></p> <pre class="code-snippet__js code-snippet code-snippet_nowrap" data-lang="javascript" style="background: rgba(0,0,0,0.03);border: 1px solid #f0f0f0;border-radius: 3px;color: #333;margin-bottom: 10px;padding: 10px;width:90%;"><code><span leaf="">documents = SimpleDirectoryReader(input_files=enhanced_files).load_data()</span></code><code><span leaf="">index = VectorStoreIndex.from_documents(documents)</span></code></pre> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><strong style="background: linear-gradient(to right,rgb(73, 200, 149),rgb(38, 198, 218));color: white;white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 2px 4px 2px 4px;"><span leaf="">结构化数据</span></strong><span leaf="">:</span></span></p> <pre class="code-snippet__js code-snippet code-snippet_nowrap" data-lang="javascript" style="background: rgba(0,0,0,0.03);border: 1px solid #f0f0f0;border-radius: 3px;color: #333;margin-bottom: 10px;padding: 10px;width:90%;"><code><span leaf="">nodes = []</span></code><code><span leaf="">for doc in documents:</span></code><code><span leaf="">&nbsp; &nbsp; doc_content = doc.get_content().split('\n')</span></code><code><span leaf="">&nbsp; &nbsp; for chunk in doc_content:</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; node = TextNode(text=chunk)</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; node.metadata = {'source': doc.get_doc_id()}</span></code><code><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; nodes = nodes + [node]</span></code></pre> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 16px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">嵌入模型</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">默认使用通义千问文档嵌入模型:</span></span></p> <pre class="code-snippet__js code-snippet code-snippet_nowrap" data-lang="javascript" style="background: rgba(0,0,0,0.03);border: 1px solid #f0f0f0;border-radius: 3px;color: #333;margin-bottom: 10px;padding: 10px;width:90%;"><code><span leaf="">EMBED_MODEL = DashScopeEmbedding(</span></code><code><span leaf="">&nbsp; &nbsp; model_name=DashScopeTextEmbeddingModels.TEXT_EMBEDDING_V2,</span></code><code><span leaf="">&nbsp; &nbsp; text_type=DashScopeTextEmbeddingType.TEXT_TYPE_DOCUMENT,</span></code><code><span leaf="">)</span></code><code><span leaf=""><br></span></code><code><span leaf=""># 若使用本地嵌入模型,请取消以下注释:</span></code><code><span leaf=""># from langchain_community.embeddings import ModelScopeEmbeddings</span></code><code><span leaf=""># from llama_index.embeddings.langchain import LangchainEmbedding</span></code><code><span leaf=""># embeddings = ModelScopeEmbeddings(model_id="modelscope/iic/nlp_gte_sentence-embedding_chinese-large")</span></code><code><span leaf=""># EMBED_MODEL = LangchainEmbedding(embeddings)</span></code></pre> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 16px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">检索策略</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">采用两阶段检索策略:</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><strong style="background: linear-gradient(to right,rgb(73, 200, 149),rgb(38, 198, 218));color: white;white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 2px 4px 2px 4px;"><span leaf="">向量相似度初筛</span></strong><span leaf="">:</span></span></p> <pre class="code-snippet__js code-snippet code-snippet_nowrap" data-lang="javascript" style="background: rgba(0,0,0,0.03);border: 1px solid #f0f0f0;border-radius: 3px;color: #333;margin-bottom: 10px;padding: 10px;width:90%;"><code><span leaf="">retriever_engine = index.as_retriever(similarity_top_k=20)</span></code><code><span leaf="">retrieve_chunk = retriever_engine.retrieve(prompt)</span></code></pre> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><strong style="background: linear-gradient(to right,rgb(73, 200, 149),rgb(38, 198, 218));color: white;white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 2px 4px 2px 4px;"><span leaf="">语义重排序</span></strong><span leaf="">:</span></span></p> <pre class="code-snippet__js code-snippet code-snippet_nowrap" data-lang="javascript" style="background: rgba(0,0,0,0.03);border: 1px solid #f0f0f0;border-radius: 3px;color: #333;margin-bottom: 10px;padding: 10px;width:90%;"><code><span leaf="">dashscope_rerank = DashScopeRerank(top_n=chunk_cnt)</span></code><code><span leaf="">results = dashscope_rerank.postprocess_nodes(retrieve_chunk, query_str=prompt)</span></code></pre> <p style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: center;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf="" style="max-width: 100%;line-height: 28px;letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span textstyle="" style="font-size: 12px;color: rgb(178, 178, 178);">注:比较初步的检索策略,可根据实际情况进行调整</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 16px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">4. 图片链接处理</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">只保留最相关文本块中的图片链接</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">移除其他文本块的图片链接</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">使用 Markdown 语法在回答中显示图片</span></span></p> <pre class="code-snippet__js code-snippet code-snippet_nowrap" data-lang="javascript" style="background: rgba(0,0,0,0.03);border: 1px solid #f0f0f0;border-radius: 3px;color: #333;margin-bottom: 10px;padding: 10px;width:90%;"><code><span leaf="">prompt_template = """请参考以下内容,仅使用第一个最相关文本块中的图片链接。</span></code><code><span leaf="">如果在第一个文本块中看到"图片链接:",将其转换为Markdown图片语法。</span></code><code><span leaf="">请忽略其他文本块中的图片链接。</span></code><code><span leaf="">"""</span></code></pre> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(41, 148, 128);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;box-sizing: border-box !important;padding-left:4px;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">4</span></span></em></strong></p> <h2 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;font-family: PingfangSC-LIGHT,sans-serif;line-height: 9px;color: white;border-radius: 10px;background:linear-gradient(to right,rgb(41, 148, 128) 66.67%,rgb(73, 200, 149) 10%);"><span leaf="">&nbsp; &nbsp;</span></h2> <p style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"> <jncounttag></jncounttag><span leaf="">使用指南</span></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="margin-left: 10px;max-width: 100%;color: rgb(26, 149, 165);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;padding-left:4px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">4.1</span></span></em></strong></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 5px;background:linear-gradient(to right,rgb(26, 149, 165) ,rgb(38, 198, 218));"><span leaf="">&nbsp; &nbsp;</span></h3> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 18px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">上传数据</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">系统支持两种文件上传方式:</span><strong style="background: linear-gradient(to right,rgb(73, 200, 149),rgb(38, 198, 218));color: white;white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 2px 4px 2px 4px;"><span leaf="">临时上传</span></strong><span leaf="">:直接在 RAG 问答页面上传文件,临时使用</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><strong style="background: linear-gradient(to right,rgb(73, 200, 149),rgb(38, 198, 218));color: white;white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 2px 4px 2px 4px;"><span leaf="">创建知识库</span></strong><span leaf="">:在"上传数据"页面中上传文件,并在"创建知识库"页面构建永久知识库</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 16px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">支持的文件类型</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">非结构化数据:PDF、DOCX、TXT</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">结构化数据:XLSX、CSV</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/e6f968fa8896d859343ed85cd5a6e22b.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.19444444444444445" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125802"> </section> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="margin-left: 10px;max-width: 100%;color: rgb(26, 149, 165);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;padding-left:4px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">4.2</span></span></em></strong></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 5px;background:linear-gradient(to right,rgb(26, 149, 165) ,rgb(38, 198, 218));"><span leaf="">&nbsp; &nbsp;</span></h3> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 18px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">创建知识库</span></span></strong></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">进入"创建知识库"页面</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">选择已上传的类目或数据表</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">设置知识库名称</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">点击"确认创建知识库"</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="margin-left: 10px;max-width: 100%;color: rgb(26, 149, 165);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;padding-left:4px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">4.3</span></span></em></strong></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 5px;background:linear-gradient(to right,rgb(26, 149, 165) ,rgb(38, 198, 218));"><span leaf="">&nbsp; &nbsp;</span></h3> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(137, 137, 137);font-size: 18px;line-height: 1.5;white-space: normal;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">RAG 问答</span></span></strong></span></strong></p> <pre class="code-snippet__js code-snippet code-snippet_nowrap" data-lang="javascript" style="background: rgba(0,0,0,0.03);border: 1px solid #f0f0f0;border-radius: 3px;color: #333;margin-bottom: 10px;padding: 10px;width:90%;"><code><span leaf="">flowchart TD</span></code><code><span leaf="">&nbsp; &nbsp; A[用户提问] --&gt; B[获取知识库]</span></code><code><span leaf="">&nbsp; &nbsp; B --&gt; C[检索相关文档]</span></code><code><span leaf="">&nbsp; &nbsp; C --&gt; D[重排序文档]</span></code><code><span leaf="">&nbsp; &nbsp; D --&gt; E[构建提示词]</span></code><code><span leaf="">&nbsp; &nbsp; E --&gt; F[调用大语言模型]</span></code><code><span leaf="">&nbsp; &nbsp; F --&gt; G[生成回答]</span></code><code><span leaf="">&nbsp; &nbsp; G --&gt; H[显示回答及图片]</span></code></pre> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(41, 148, 128);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;box-sizing: border-box !important;padding-left:4px;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">5</span></span></em></strong></p> <h2 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;font-family: PingfangSC-LIGHT,sans-serif;line-height: 9px;color: white;border-radius: 10px;background:linear-gradient(to right,rgb(41, 148, 128) 83.33%,rgb(73, 200, 149) 10%);"><span leaf="">&nbsp; &nbsp;</span></h2> <p style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"> <jncounttag></jncounttag><span leaf="">项目结构</span></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">main.py</span></span><span leaf="">&nbsp;- FastAPI 应用入口和 Gradio 界面定义</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">chat.py</span></span><span leaf="">&nbsp;- RAG 问答核心功能和大模型调用</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">upload_file.py</span></span><span leaf="">&nbsp;- 文件上传和处理逻辑,包括 PDF 图片提取</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">create_kb.py</span></span><span leaf="">&nbsp;- 知识库创建和管理</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">html_string.py</span></span><span leaf="">&nbsp;- Web 界面 HTML 模板</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">File/</span></span><span leaf="">&nbsp;- 存放上传的文件</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">VectorStore/</span></span><span leaf="">&nbsp;- 存放向量数据库</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">static/images/</span></span><span leaf="">&nbsp;- 存放提取的图片</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">images/</span></span><span leaf="">&nbsp;- UI 头像图片</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: center;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="" style="max-width: 100%;line-height: 28px;letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;" data-pm-slice="1 1 [" para,{tagname:p,attributes:{label:converted by knb formatter from jason ng https: knb.im mp,style:margin: 20px; max-width: 100%; min-height: 1em; white-space: pre-wrap; color: rgb(43, 43, 43); text-align: justify; line-height: 1.5; box-sizing: border-box !important; overflow-wrap: break-word !important;},namespaceuri:http: www.w3.org 1999 xhtml}]><span textstyle="" style="font-size: 14px;color: rgb(178, 178, 178);font-weight: normal;">注:源码已发布至知识星球,按需加入。</span></span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: center;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="" style="max-width: 100%;line-height: 28px;letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;" data-pm-slice="1 1 [" para,{tagname:p,attributes:{label:converted by knb formatter from jason ng https: knb.im mp,style:margin: 20px; max-width: 100%; min-height: 1em; white-space: pre-wrap; color: rgb(43, 43, 43); text-align: justify; line-height: 1.5; box-sizing: border-box !important; overflow-wrap: break-word !important;},namespaceuri:http: www.w3.org 1999 xhtml}]><span textstyle="" style="font-size: 14px;color: rgb(178, 178, 178);font-weight: normal;">p.s 加入星球后请微信后台私信我加入微信交流群</span></span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/6b0955be81e42a40c8cc94764efb3812.jpg" class="rich_pages wxw-img" data-ratio="0.4542124542124542" data-s="300,640" data-type="jpeg" data-w="819" type="block" data-imgfileid="502125703"> </section> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 25.6px;min-height: 1em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(41, 148, 128);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><em style="max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 24px;box-sizing: border-box !important;padding-left:4px;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"><span leaf="">6</span></span></em></strong></p> <h2 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;font-family: PingfangSC-LIGHT,sans-serif;line-height: 9px;color: white;border-radius: 10px;background:linear-gradient(to right,rgb(41, 148, 128) 100%,rgb(73, 200, 149) 10%);"><span leaf="">&nbsp; &nbsp;</span></h2> <p style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(137, 137, 137);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);line-height: 25.6px;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;font-size: 20px;box-sizing: border-box !important;word-wrap: break-word !important;font-family: PingFangSC-Semibold,sans-serif;"> <jncounttag></jncounttag><span leaf="">自定义与扩展</span></span></strong></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf="" style="max-width: 100%;line-height: 28px;letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span textstyle="" style="font-weight: bold;">修改嵌入模型</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">可以使用本地嵌入模型替代云端 API。</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">在</span><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">create_kb.py</span></span><span leaf="">和</span><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">chat.py</span></span><span leaf="">中取消相关注释并安装额外依赖。</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf="" style="max-width: 100%;line-height: 28px;letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span textstyle="" style="font-weight: bold;">优化提示词模板</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">修改</span><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">chat.py</span></span><span leaf="">中的</span><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">prompt_template</span></span><span leaf="">变量以定制提示词模板。</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf="" style="max-width: 100%;line-height: 28px;letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span textstyle="" style="font-weight: bold;">添加新的文档类型支持</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(43, 43, 43);text-align: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf="">扩展</span><span style="background-color:rgb(238, 253, 247);white-space: pre-wrap;border-width: 0.25em 0;display: inline;font-weight: normal;padding: 0 4px 0 4px;padding:0 2px 0 2px;border:1px solid rgb(73, 200, 149);border-radius:2px;"><span leaf="">upload_file.py</span></span><span leaf="">中的处理逻辑以支持更多文件类型。</span></span></p> <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 class="mp_profile_iframe_wrp" nodeleaf=""> <mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-nickname="韦东东" data-alias="JIBAI_AIGC" data-from="0" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/3OZeSOuRw3f0UfiboA2EooV6gxE23nUmwREHMHWnUmrtWcPHRe5CsMMQwa4c65tXKE39I0n2RKNkwgSZrICrnlg/0?wx_fmt=png" data-signature="这个公众号给大家分享我日常大模型应用学习和开发实践,其中涉及Lora微调、RAG、Text2SQL、Multi-Agent等方法,25年会着重关注有行业Know-how的垂直产业场景应用开发和咨询,欢迎大家交流。" data-id="MzI1ODIxNjk1OQ==" data-is_biz_ban="0" data-service_type="1"></mp-common-profile> </section> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin: 20px 10px;max-width: 100%;min-height: 1em;color: rgb(43, 43, 43);text-align: justify;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;background-color: rgb(238, 253, 247);border-left: 10px solid #49c895;padding: 16px;border-right: 2px solid #6bdeb0;letter-spacing:1px;font-size:15px;font-family: PingfangSC-LIGHT,sans-serif;"><span leaf=""><span textstyle="" style="font-weight: bold;">下一期,结合 RAGFlow 框架展示下如何实现类似图文问答效果。</span></span></p> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

实时互动系统支持接入dify知识库

作者:微信小助手

<section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000994" data-s="300,640" src="/upload/55bf8a1f1167420f1d9521489fadcee0.png" data-type="png" type="block"> </section> <section> <span leaf="">目前在实时互动系统中支持接入各大厂商的大语言模型并可以上传私有知识。</span> </section> <section> <span leaf="">只需要将文件内容放在相应的文件夹目录下即可。</span> </section> <section> <span leaf="">但是对于更复杂的知识库管理,建议走dify。</span> </section> <section> <span leaf="">这样系统支持的大语言模型厂商就分为两大类:</span> </section> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li> <section> <span leaf="">OpenAI兼容协议系列:大语言模型厂商模型都支持openai兼用的协议接口,这样的服务商包括deepseek,kimi,通一千问,腾讯hunyuan等,当然也包括openai。</span> </section></li> <li> <section> <span leaf="">dify协议:dify不兼容openai,它是在各大模型厂商基础上封装了一套独立的协议接口。</span> </section></li> </ul> <section> <span leaf="">所在在使用大模型知识库的时候,可以这样用:</span> </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="makefile"><code><span leaf=""><span class="code-snippet__section">llm_venture: dify or openai</span></span></code><code><span leaf=""><span class="code-snippet__section">llm_base_url: https://api.dify.ai/v1</span></span></code><code><span leaf=""><span class="code-snippet__section">llm_api_key: app-UD8ASjzl1wb2L*******</span></span></code></pre> </section> <p data-pm-slice="0 0 []"><span leaf="">比如如果想使用deepseek大模型可以这样用:</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="nginx"><code><span leaf=""><span class="code-snippet__attribute">llm_venture</span>&nbsp;配置为openai</span></code></pre> </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="">llm_base_url配置为:<span class="code-snippet__attr">https</span>:<span class="code-snippet__comment">//api.deepseek.com</span></span></code><code><span leaf=""><br></span></code></pre> </section> <section> <span leaf="">另外还有一些参数可以配置llm的具体选择模型,以及是否使用流响应等。</span> </section> <section> <span leaf="">详见文档:</span> </section> <section> <span leaf="">https://df58aaahqa.feishu.cn/docx/OWZ3dSAZ0oiOahxBVgScDaLQngf</span> </section> <section> <span leaf="">下面多讲讲dify。</span> </section> <section> <span leaf="">dify集成了多家大语言模型厂商:</span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000998" data-s="300,640" src="/upload/f9e405488638b2be75bc4ab3e7a0186e.png" data-type="png" type="block"> </section> <section> <span leaf="">在dify的工作室中可以创建多个应用:</span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000996" data-s="300,640" src="/upload/594969af7a455e7b5411904e5d9c7cad.png" data-type="png" type="block"> </section> <section> <span leaf="">每个应用都可以配置独立的大语言模型厂商:</span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000997" data-s="300,640" src="/upload/ae4360c651977ffb0c4b9c03ba38968a.png" data-type="png" type="block"> </section> <section> <span leaf="">在这里可以设置各种参数,添加知识库等。</span> </section> <section> <span leaf="">还可以设置该应用使用的大语言模型厂商,比如接入腾讯hunyuan或者openai,可以这样绑定自己的密钥:</span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000999" data-s="300,640" src="/upload/c7fe82887bfcdea972e4870babe507c9.png" data-type="png" type="block"> </section> <section> <span leaf="">创建了应用就可以在线跟他互动聊天:</span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100001000" data-s="300,640" src="/upload/7ae0d733108cf20af06f64cbadfa552f.png" data-type="png" type="block"> </section> <section> <span leaf="">同时dify也暴露出来了api接口,可以将dify集成到其他平台:</span> </section> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="100000993" data-s="300,640" src="/upload/d459de855a3d19c2548c1f69b86d447b.png" data-type="png" type="block"> </section> <section> <span leaf="">比如我这里将他集成到我们的数字人实时互动系统,只需要填写对应dify的密钥和访问地址,就可以在数字人互动中调用知识库。</span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>

Dify+RAGFlow打造企业级智能知识库:PDF表格秒变结构化数据,检索精准度暴增

作者:微信小助手

<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="" data-pm-slice="0 0 []"> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Dify与RAGFlow结合部署本地知识库并提升检索准确率的详细教程及原理分析:</span></p> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 16px;color: rgb(14, 136, 235);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">一、环境准备与部署架构</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">硬件要求</span></strong><span leaf="">:</span></p> <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: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">CPU≥4核(推荐支持AVX指令集)</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">内存≥16GB</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">磁盘≥50GB(用于存储向量索引)</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">GPU非必需但可加速处理(推荐NVIDIA T4以上)</span> </section></li> </ul> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">软件架构</span></strong><span leaf="">:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg mjzdia7evazyenlhlfrtaibic31jzupnz1trjtdeuesfrjkqynxoqqujo5lhjvcdqsapzvaibx4dcgmeoywibpdv9sfz1pgk2ewmc 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">用户端 → Dify应用层(工作流编排) → RAGFlow引擎(文档解析/检索) → 本地LLM(Ollama等)</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf=""><span textstyle="" style="font-size: 13px;">该架构通过API接口实现Dify与RAGFlow的解耦部署,既保证文档处理的专业性,又保持应用开发的灵活性。</span></span></p> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 16px;color: rgb(14, 136, 235);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">二、部署步骤详解</span></span><span style="display: none;"></span></h3> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">1. RAGFlow部署(文档处理层)</span></span><span style="display: none;"></span></h4> <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 mjzdia7evazyenlhlfrtaibic31jzupnz1trjtdeuesfrjkqynxoqqujo5lhjvcdqsapzvaibx4dcgmeoywibpdv9sfz1pgk2ewmc 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 克隆仓库并启动容器(需预先安装Docker)</span></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/infiniflow/ragflow.git</span><span leaf=""><br></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">cd</span></span><span leaf="">&nbsp;ragflow/deploy/docker</span><span leaf=""><br></span><span leaf="">docker-compose up -d</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><em style="color: rgb(14, 136, 235);font-style: italic;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">关键配置</span></em><span leaf="">:</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">修改</span><code style=""><span leaf="">docker-compose.yml</span></code><span leaf="">中</span><code style=""><span leaf="">MINIO_ROOT_PASSWORD</span></code><span leaf="">(对象存储密钥)</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">调整</span><code style=""><span leaf="">elasticsearch</span></code><span leaf="">内存分配至8GB以上</span> </section></li> </ul> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">2. Dify部署(应用开发层)</span></span><span style="display: none;"></span></h4> <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 mjzdia7evazyenlhlfrtaibic31jzupnz1trjtdeuesfrjkqynxoqqujo5lhjvcdqsapzvaibx4dcgmeoywibpdv9sfz1pgk2ewmc 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 修改环境变量(关键步骤)</span></span><span leaf=""><br></span><span leaf="">vim dify-main/docker/.env</span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 启用自定义模型并配置Ollama</span></span><span leaf=""><br></span><span leaf="">CUSTOM_MODEL_ENABLED=</span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">true</span></span><span leaf=""><br></span><span leaf="">OLLAMA_API_BASE_URL=http://[本机IP]:11434</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><em style="color: rgb(14, 136, 235);font-style: italic;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">部署命令</span></em><span leaf="">:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg mjzdia7evazyenlhlfrtaibic31jzupnz1trjtdeuesfrjkqynxoqqujo5lhjvcdqsapzvaibx4dcgmeoywibpdv9sfz1pgk2ewmc 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;dify-main/docker</span><span leaf=""><br></span><span leaf="">docker compose -p dify_docker up -d</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">该配置实现本地模型调用,避免云端API延迟。</span></p> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 16px;color: rgb(14, 136, 235);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">三、系统整合与配置</span></span><span style="display: none;"></span></h3> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">1. API对接流程</span></span><span style="display: none;"></span></h4> <section data-tool="mdnice编辑器" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;overflow-x: auto;"> <table style="display: table;text-align: left;"> <thead> <tr> <th style="color: rgb(0, 0, 0);font-size: 13px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf="">步骤</span> </section></th> <th style="color: rgb(0, 0, 0);font-size: 13px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf="">Dify操作</span> </section></th> <th style="color: rgb(0, 0, 0);font-size: 13px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf="">RAGFlow操作</span> </section></th> </tr> </thead> <tbody> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(255, 255, 255);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">1</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">创建外部知识库</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">新建知识库并上传文档</span></span> </section></td> </tr> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 248, 248);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">2</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">填写API Endpoint</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">控制台获取</span></span><code><span leaf=""><span textstyle="" style="font-size: 13px;">http://[IP]:9380</span></span></code> </section></td> </tr> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(255, 255, 255);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">3</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">配置API Key</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">后台生成并复制密钥</span></span> </section></td> </tr> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 248, 248);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">4</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">输入知识库ID</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">文档库详情页获取唯一ID</span></span> </section></td> </tr> </tbody> </table> </section> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><em style="color: rgb(14, 136, 235);font-style: italic;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">特别注意</span></em><span leaf="">:需在RAGFlow中预先完成以下处理:</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">PDF文档启用"深度布局解析"模式</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Excel表格选择"单元格级分段"</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">设置多语言支持参数(中文需特别配置)</span> </section></li> </ul> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">2. 混合检索配置</span></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">在Dify工作流中设置:</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 mjzdia7evazyenlhlfrtaibic31jzupnz1trjtdeuesfrjkqynxoqqujo5lhjvcdqsapzvaibx4dcgmeoywibpdv9sfz1pgk2ewmc 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: #d19a66;line-height: 26px;"><span leaf="">retrieval_strategy:</span></span><span leaf=""><br></span><span leaf="">&nbsp;&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">-</span></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">vector_search:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">model:</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">jina-embeddings-v2-base-zh</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">top_k:</span></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">8</span></span><span leaf=""><br></span><span style="color: #61aeee;line-height: 26px;"><span leaf="">-</span></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">full_text:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">analyzer:</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">ik_max_word</span></span><span leaf=""><br></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">rerank:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">model:</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">bge-reranker-large</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp;&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">score_threshold:</span></span><span style="color: #d19a66;line-height: 26px;"><span leaf="">0.35</span></span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">该配置融合语义检索与关键词匹配,经测试可使表格类数据召回率提升</span></p> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 16px;color: rgb(14, 136, 235);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">四、准确率提升核心策略</span></span><span style="display: none;"></span></h3> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">1. 文档解析优化</span></span><span style="display: none;"></span></h4> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">布局感知技术</span></strong><span leaf="">:RAGFlow通过CV算法识别PDF中的表格位置,避免传统OCR的错位问题(测试显示扫描件表格解析完整度提升62%)</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">智能分块算法</span></strong><span leaf="">:</span> </section></li> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">中文使用"。"分段(比换行符准确率提高28%)</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">表格采用"标题+单元格"关联存储</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">图片自动生成AltText并建立跨模态索引</span> </section></li> </ul> </ul> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">2. 检索增强机制</span></span><span style="display: none;"></span></h4> <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: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">多路召回策略</span></strong><span leaf="">:</span> </section></li> <ol style="list-style-type: decimal;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">向量检索:捕获语义相似性</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">全文检索:确保关键词匹配</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">图召回:基于文档内部关联扩展</span> </section></li> </ol> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">动态重排序</span></strong><span leaf="">:使用BGE模型对Top50结果重排,消除"语义漂移"现象</span> </section></li> </ul> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">3. 工作流优化</span></span></h4> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-ratio="2.317365269461078" data-s="300,640" data-type="png" data-w="668" style="width: 176px;height: auto !important;" type="block" data-imgfileid="100000311" src="/upload/7cfc4e4fcb30e0b860cfa621c00be20c.png"> </section> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf=""><br></span></span></h4> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 16px;color: rgb(14, 136, 235);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">五、效果验证与调优</span></span><span style="display: none;"></span></h3> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">1. 案例对比</span></span><span style="display: none;"></span></h4> <section data-tool="mdnice编辑器" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;overflow-x: auto;"> <table style="display: table;text-align: left;"> <thead> <tr> <th style="color: rgb(0, 0, 0);font-size: 13px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">查询类型</span></span> </section></th> <th style="color: rgb(0, 0, 0);font-size: 13px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">单独Dify</span></span> </section></th> <th style="color: rgb(0, 0, 0);font-size: 13px;line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);height: auto;border-style: solid;border-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;padding: 5px 10px;min-width: 85px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">Dify+RAGFlow</span></span> </section></th> </tr> </thead> <tbody> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(255, 255, 255);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">"2024Q3销售数据表格"</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">漏检37%单元格</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">完整召回</span></span> </section></td> </tr> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(248, 248, 248);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">"专利权利要求中的技术特征"</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">误匹配率42%</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">精准定位条款</span></span> </section></td> </tr> <tr style="color: rgb(0, 0, 0);background-attachment: scroll;background-clip: border-box;background-color: rgb(255, 255, 255);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;"> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">扫描版合同关键条款</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">无法解析</span></span> </section></td> <td style="padding-top: 5px;padding-right: 10px;padding-bottom: 5px;padding-left: 10px;min-width: 85px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(204, 204, 204, 0.4);border-bottom-color: rgba(204, 204, 204, 0.4);border-left-color: rgba(204, 204, 204, 0.4);border-right-color: rgba(204, 204, 204, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"> <section> <span leaf=""><span textstyle="" style="font-size: 13px;">结构化提取</span></span> </section></td> </tr> </tbody> </table> </section> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">2. 参数调优指南</span></span><span style="display: none;"></span></h4> <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: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">TopK动态调整</span></strong><span leaf="">:根据文档平均长度设置(建议6-12区间)</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Score阈值</span></strong><span leaf="">:从0.3开始测试,每0.05为步长调整</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">分段重叠率</span></strong><span leaf="">:设置10-15%避免信息割裂</span> </section></li> </ul> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 16px;color: rgb(14, 136, 235);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">六、准确率提升原理总结</span></span><span style="display: none;"></span></h3> <ol style="list-style-type: decimal;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li style="font-size:13px;"> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf=""><span textstyle="" style="font-size: 13px;">深度文档理解</span></span></strong><span leaf=""><span textstyle="" style="font-size: 13px;">:RAGFlow的布局解析算法突破传统NLP工具的限制,特别在处理扫描件、复杂表格时展现优势</span></span> </section></li> <li style="font-size:13px;"> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf=""><span textstyle="" style="font-size: 13px;">混合检索机制</span></span></strong><span leaf=""><span textstyle="" style="font-size: 13px;">:结合Dify的灵活工作流编排,实现"关键词+语义+关联"的三维匹配</span></span> </section></li> <li style="font-size:13px;"> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf=""><span textstyle="" style="font-size: 13px;">动态优化策略</span></span></strong><span leaf=""><span textstyle="" style="font-size: 13px;">:基于重排序模型和参数自适应的持续优化闭环</span></span> </section></li> <li style="font-size:13px;"> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf=""><span textstyle="" style="font-size: 13px;">本地化部署</span></span></strong><span leaf=""><span textstyle="" style="font-size: 13px;">:消除API传输损耗,确保原始数据安全性</span></span> </section></li> </ol> <hr style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: solid;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 1px;"> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 15px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(14, 136, 235);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">操作文档参考</span></strong><span leaf="">:</span></p> <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: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">RAGFlow官方部署指南</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Dify外部知识库配置手册</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 13px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">混合检索参数优化白皮书</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>

音频处理大杀器!Nexa AI 的 OmniAudio - 2.6B 如何让边缘设备 “耳聪目明”?

作者:微信小助手

<section data-mpa-powered-by="yiban.io" style="margin-bottom: 8px;letter-spacing: 0.578px;"> <span leaf=""><img src="/upload/c5c780a2c64d6e2e2e4836ded931f97f.jpg" class="rich_pages wxw-img" data-ratio="0.06444444444444444" data-s="300,640" data-type="jpeg" data-w="900" data-imgfileid="100001759"></span><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:22.0000pt;"> <o:p></o:p></span></b> </section> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">在当今数字化时代,音频语言模型的需求日益增长,<span textstyle="" style="text-decoration: underline;">尤其是在边缘设备上实现高效、准确的音频处理更是备受关注。</span></span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">Nexa AI</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">推出的</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">OmniAudio-2.6B</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">为这一领域带来了新的突破和可能性。</span>本文将对</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">OmniAudio-2.6B</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">进行全面深入的介绍,包括项目概述、技术原理、功能特点、应用场景、快速使用等方面,帮助</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">大家</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">更好地了解和应用这一先进的音频语言模型。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <h1 style="margin-bottom: 8px;letter-spacing: 0.578px;" data-mpa-action-id="m6lp38z521kz"><b><font face="宋体"><span leaf="" style="font-size: 17px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;" mpa-font-style="m6lp38yq1mku"><span textstyle="" style="color: rgb(123, 12, 0);">一、</span></span></font></b><b style="font-size: 17px;" mpa-font-style="m6lp38yqw8c"><font face="宋体"><span leaf="" style="letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="color: rgb(123, 12, 0);">项目概述</span></span></font></b><b style="mso-bidi-font-weight: normal;font-size: 17px;" mpa-font-style="m6lp38yq48j"><span style="font-family: Calibri;"> <o:p></o:p></span></b></h1> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="color: rgb(123, 12, 0);">OmniAudio - 2.6B&nbsp;</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="color: rgb(123, 12, 0);">是一款高性能的多模态音频语言模型,参数量为&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="color: rgb(123, 12, 0);">2.6B</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="color: rgb(123, 12, 0);">,能够高效处理文本和音频输入</span><span textstyle="" style="color: rgb(123, 12, 0);text-decoration: underline;">。</span><span textstyle="" style="text-decoration: underline;">它将&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">Gemma - 2 - 2B</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">、</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">WhisperTurbo&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">以及定制的&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">Projector&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">模块集成到一个统一框架中,突破了传统模型串联&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">ASR</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">(自动语音识别)和&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">LLM</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">(大语言模型)的架构限制,</span>实现了更低延迟、更高效能的音频&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">-&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">文本一体化处理。这种一体化的设计使得音频信息能够直接在模型内部进行处理和转换,避免了传统架构中多次数据传输和处理带来的延迟和资源浪费。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/8e34ef27cc8079f530591e7a0b102634.png" class="rich_pages wxw-img" data-ratio="0.4958490566037736" data-s="300,640" data-type="png" data-w="1325" type="block" data-imgfileid="100003172"> </section> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"> <o:p> <span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">&nbsp;</span> </o:p></p> <h1 style="margin-bottom: 8px;letter-spacing: 0.578px;"><span leaf="" style="font-size: 17px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;" mpa-font-style="m6lp46mmo41" data-mpa-action-id="m6lp46mu1eiw"><span textstyle="" style="color: rgb(123, 12, 0);font-weight: bold;">二、技术原理</span></span><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:22.0000pt;"> <o:p></o:p></span></b></h1> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">1</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">模型架构</span></font></b><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Arial;mso-fareast-font-family:黑体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></b></h2> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">Gemma - 2 - 2B</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">:作为负责文本处理的基础语言模型,它拥有强大的语言理解和生成能力。</span>其内部的神经网络结构经过精心设计和训练,能够对音频文本转换后的文本进行深入分析和理解。例如,在处理复杂的语义关系时,</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">Gemma - 2 - 2B&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">可以准确地识别出词汇之间的逻辑联系,从而为后续的语言生成提供准确的基础。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><p style="margin-bottom: 8px;letter-spacing: 0.578px;text-align: left;"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">WhisperTurbo</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">:</span>是优化后的音频编码器,能够生成高质量的音频嵌入。它通过对音频信号进行特征提取和编码,将音频信息转化为模型可处理的形式。</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">WhisperTurbo&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">在处理音频信号时,能够捕捉到音频中的细微特征,如语音的语调、语速变化等,这些特征对于准确理解音频内容至关重要。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p></li> <li><p style="margin-bottom: 8px;letter-spacing: 0.578px;text-align: left;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">定制</span></span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">Projector</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">模块</span>:将&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">Whisper&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">的音频&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">token&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">转化为与&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">Gemma&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">文本嵌入对齐的序列,确保音频&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">-&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">文本模态的高效融合。它通过一种特殊的映射机制,使得音频和文本在向量空间中能够准确对应,同时保持语言模型的原始性能。这种对齐方式使得模型在处理音频输入时,能够像处理文本输入一样高效地进行语言理解和生成。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p></li> </ul> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">2</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">训练方法</span></font></b><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Arial;mso-fareast-font-family:黑体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></b></h2> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><p style="margin-bottom: 8px;letter-spacing: 0.578px;text-align: left;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">预训练阶段:</span>基于</span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">&nbsp;MLSEnglish10K&nbsp;</span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">转录数据集进行基础的音频&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">-&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">文本对齐能力训练。为了支持多任务应用,数据集中引入了特殊的&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">&lt;|trans**cribe|&gt;token</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">,<span textstyle="" style="text-decoration: underline;">用以区分语音转文本和内容补全任务,确保模型在不同场景下性能的一致性。</span>在预训练过程中,模型通过大量的音频&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">-&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">文本对数据学习,逐渐掌握音频和文本之间的对应关系,形成初步的音频处理和语言理解能力。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p></li> <li><p style="margin-bottom: 8px;letter-spacing: 0.578px;text-align: left;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">监督微调阶段(</span></span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">SFT</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">):</span><span textstyle="" style="text-decoration: underline;">使用合成数据集进行指令调优。数据集同样以&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">MLSEnglish10K&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">为基础,结合专有模型对上下文进行扩展,生成丰富的&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">“</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">音频&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">-&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">文本</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">”&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">对。通过这种方式</span>,模型具备了更强的音频输入语义理解和会话生成能力。例如,在处理特定领域的音频数据时,模型能够根据微调数据中的领域知识,准确理解音频中的专业术语和特定表达方式。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p></li> <li><p style="margin-bottom: 8px;letter-spacing: 0.578px;text-align: left;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">直接偏好优化(</span></span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">DPO</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">):</span>利用&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">GPT - 4O API&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">对模型初始输出进行评估,标注不正确的输出为&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">“</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">拒绝</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">”</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">(</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">rejected</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">),并生成替代答案作为&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">“</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">偏好</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">”</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">(</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">preferred</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">)参考。<span textstyle="" style="text-decoration: underline;">为了保持&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">Gemma - 2&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">的文本处理性能,额外增加了偏好训练步骤,使用&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">Gemma - 2&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">的原始文本作为</span>&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">“</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">标准</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">”&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">训练模型,在处理音频输入时匹配其高水平表现。通过&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">DPO</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">,模型能够不断优化自己的输出,使其更加符合人类的语言习惯和实际需求。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p></li> </ul> <h1 style="margin-bottom: 8px;letter-spacing: 0.578px;margin-top: 24px;" data-mpa-action-id="m6lp72m21nfv"><b><font face="宋体"><span leaf="" style="font-size: 17px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;" mpa-font-style="m6lp72lp1prg"><span textstyle="" style="color: rgb(123, 12, 0);">三、</span></span></font></b><b style="font-size: 17px;" mpa-font-style="m6lp72lpko1"><font face="宋体"><span leaf="" style="letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="color: rgb(123, 12, 0);">功能特点</span></span></font></b><b style="mso-bidi-font-weight: normal;font-size: 17px;" mpa-font-style="m6lp72lpwm5"><span style="font-family: Calibri;"> <o:p></o:p></span></b></h1> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">1</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">处理速度快</span></font></b><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Arial;mso-fareast-font-family:黑体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></b></h2> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">在</span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">&nbsp;2024 Mac Mini M4 Pro&nbsp;</span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">上,<span textstyle="" style="text-decoration: underline;">使用&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">Nexa SDK&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">并采用&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">FP16 GGUF&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">格式时,模型可实现每秒&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">35.23&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">个令牌的处理速度,而在&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">Q4_K_M GGUF&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">格式下,可处理每秒&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">66&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">个令牌</span>。相比之下,</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">Qwen2 - Audio - 7B&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">在相似硬件上只能处理每秒&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">6.38&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">个令牌,展示出显著的速度优势,能够满足实时音频处理的需求。例如,在实时语音翻译场景中,快速的处理速度可以确保翻译结果几乎与语音同步输出,大大提高了沟通效率。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">2</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">资源效率高</span></font></b></h2> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">模型的紧凑设计有效减少了对云资源的依赖,使其成为功率和带宽受限的可穿戴设备、汽车系统及物联网设备的理想选择</span>,降低了设备的运行成本和对网络的依赖。在一些网络信号不稳定的偏远地区,或者在电池续航有限的可穿戴设备上,</span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">OmniAudio - 2.6B&nbsp;</span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">能够凭借其低资源消耗的特点,稳定地运行并提供准确的音频处理服务。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">3</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">高准确性和灵活性</span></font></b><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Arial;mso-fareast-font-family:黑体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></b></h2> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">尽管</span></span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">&nbsp;OmniAudio - 2.6B&nbsp;</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">专注于速度和效率,但其在准确性方面也表现不俗,适用于转录、翻译、摘要等多种任务。</span>无论是实时语音处理还是复杂的语言任务,</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">OmniAudio - 2.6B&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">都能够提供精准的结果。例如,在处理学术讲座的音频转录时,模型能够准确识别专业术语和复杂的句子结构,生成高质量的文字转录稿。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <h1 style="margin-bottom: 8px;letter-spacing: 0.578px;margin-top: 24px;" data-mpa-action-id="m6lp82e2ife"><b><font face="宋体"><span leaf="" style="font-size: 17px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;" mpa-font-style="m6lp82dr7v0"><span textstyle="" style="color: rgb(123, 12, 0);">四、</span></span></font></b><b style="font-size: 17px;" mpa-font-style="m6lp82drewu"><font face="宋体"><span leaf="" style="letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="color: rgb(123, 12, 0);">应用场景</span></span></font></b><b style="mso-bidi-font-weight: normal;font-size: 17px;" mpa-font-style="m6lp82dr1y0e"><span style="font-family: Calibri;"> <o:p></o:p></span></b></h1> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">1</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">智能家居</span></font></b><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Arial;mso-fareast-font-family:黑体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></b></h2> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">可以集成到智能家居设备中,如智能音箱、智能家电等,<span textstyle="" style="text-decoration: underline;">实现语音控制和交互。用户可以通过语音指令控制家电的开关、调节温度、查询信息等</span>,提供更加便捷的智能家居体验。例如,用户只需说出</span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">&nbsp;</span><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">“</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">打开客厅的灯</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">”</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">,智能音箱中的&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">OmniAudio - 2.6B&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">模型就能准确识别指令并控制灯光设备,让家居生活更加智能和便捷。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">2</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">车载系统</span></font></b><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Arial;mso-fareast-font-family:黑体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></b></h2> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">在汽车中,</span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">OmniAudio - 2.6B&nbsp;</span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">可以用于语音导航、语音娱乐系统、车辆状态查询等功能。驾驶员可以通过语音与车辆进行交互,提高驾驶安全性和便利</span>性。比如,驾驶员在行驶过程中无需手动操作,只需说出&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">“</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">导航到最近的加油站</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">”</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">,车载系统就能快速响应并规划路线,避免了分心驾驶带来的安全隐患。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">3</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">远程医疗</span></font></b><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Arial;mso-fareast-font-family:黑体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></b></h2> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">在远程医疗领域,该模型可以用于实时转录医生与患者的对话、翻译医疗文件和语音指令等,提高医疗服务的效率和质量,方便医患之间的沟通</span>。例如,在跨国远程会诊中,</span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">OmniAudio - 2.6B&nbsp;</span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">可以实时翻译不同语言的对话,让医生和患者能够无障碍交流,确保诊断和治疗的准确性。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">4</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">可穿戴设备</span></font></b><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Arial;mso-fareast-font-family:黑体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></b></h2> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">如智能手表、智能耳机等可穿戴设备可以利用</span></span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">&nbsp;OmniAudio - 2.6B&nbsp;</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">实现语音助手功能,用户可以通过语音查询天气、设置提醒、发送短信等,为用户提供更加便捷的操作方式</span>。比如,用户在运动时双手不方便操作,只需对着智能手表说出&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">“</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">设置明天早上&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">7&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">点的闹钟</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">”</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">,手表就能快速完成设置,提升了用户体验。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <h1 style="margin-bottom: 8px;letter-spacing: 0.578px;margin-top: 24px;" data-mpa-action-id="m6lp91ez165r"><b><font face="宋体"><span leaf="" style="font-size: 17px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;" mpa-font-style="m6lp91el1ks1"><span textstyle="" style="color: rgb(123, 12, 0);">五、</span></span></font></b><b style="font-size: 17px;" mpa-font-style="m6lp91elpjg"><font face="宋体"><span leaf="" style="letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="color: rgb(123, 12, 0);">快速使用</span></span></font></b><b style="mso-bidi-font-weight: normal;font-size: 17px;" mpa-font-style="m6lp91el1vt7"><span style="font-family: Calibri;"> <o:p></o:p></span></b></h1> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">1</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">在线试用</span></font></b><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Arial;mso-fareast-font-family:黑体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></b></h2> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">可以访问</span></span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">&nbsp;Hugging Face Space&nbsp;</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">平台的&nbsp;</span></span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">NexaAIDev/Omni - Audio - Demo&nbsp;</span></span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">进行在线试用,</span>快速体验模型的功能和效果。在这个平台上,用户无需复杂的安装和配置,只需按照界面提示输入音频或文本内容,即可获得模型的处理结果,方便快捷地了解模型的性能。</span></font></p> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="letter-spacing: normal;">https://huggingface.co/spaces/NexaAIDev/omni-audio-demo</span></span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/601f5bdffbbbaa291383dbd746ad765e.png" class="rich_pages wxw-img" data-ratio="0.46111111111111114" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="100003173"> </section> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"> <o:p> <span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">&nbsp;</span> </o:p></p> <h2 style="margin-bottom: 8px;letter-spacing: 0.578px;"><b><font face="Arial"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">2</span></font><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">、</span></font></b><b><font face="黑体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">本地部署</span></font></b><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Arial;mso-fareast-font-family:黑体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></b></h2> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">第</span></span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">&nbsp;1&nbsp;</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">步:</span>安装&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">Nexa-SDK</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">(本地设备端推理框架)</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">Nexa-SDK&nbsp;</span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">是一个开源的本地设备端推理框架,支持文本生成、图像生成、视觉语言模型 (</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">VLM</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">)、音频语言模型、语音转文本 (</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">ASR</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">) 和文本转语音 (</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">TTS</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">) 功能。可通过&nbsp;</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">Python&nbsp;</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">包或可执行安装程序安装。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="color: rgb(123, 12, 0);">安装参考:</span></span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">https://github.com/NexaAI/nexa-sdk?tab=readme-ov-file#install-option-1-executable-installer</span></span><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">第</span></span></font><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">&nbsp;2&nbsp;</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="font-weight: bold;">步:</span>然后在您的终端中运行以下代码</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></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=""><code><span leaf=""><span class="code-snippet__plaintext">nexa run omniaudio -st</span></span></code></pre> </section> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <h1 style="margin-bottom: 8px;letter-spacing: 0.578px;margin-top: 24px;"><span leaf="" style="font-size: 17px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;" mpa-font-style="m6lpab85983" data-mpa-action-id="m6lpab8fkcw"><span textstyle="" style="color: rgb(123, 12, 0);font-weight: bold;">结语</span></span><b style="mso-bidi-font-weight:normal;"><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';mso-ansi-font-weight:bold;font-size:14.0000pt;mso-font-kerning:22.0000pt;"> <o:p></o:p></span></b></h1> <p style="margin-bottom: 8px;letter-spacing: 0.578px;"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">OmniAudio-2.6B</span></span><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;"><span textstyle="" style="text-decoration: underline;">在音频语言建模领域迈出了重要的一步,通过将先进组件集成到一个统一框架中</span>,实现了速度、效率和准确性的平衡,为边缘设备上的音频处理提供了强大的支持。随着技术的不断发展,相信</span></font><font face="Calibri"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">OmniAudio-2.6B</span></font><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;">在未来会有更广泛的应用和进一步的优化升级。</span></font><span style="mso-spacerun:'yes';font-family:Calibri;mso-fareast-font-family:宋体;mso-bidi-font-family:'Times New Roman';font-size:14.0000pt;mso-font-kerning:1.0000pt;"> <o:p></o:p></span></p> <p style="margin-bottom: 8px;letter-spacing: 0.578px;text-align: left;" data-mpa-action-id="m6lpgqqoynj"><font face="宋体"><span leaf="" style="font-size: 15px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;" mpa-font-style="m6lpgqq81lak"><span textstyle="" style="font-weight: bold;">模型地址:</span></span></font><span leaf="" style="font-size: 14px;letter-spacing: 1px;caret-color: transparent;font-family: 宋体;" mpa-font-style="m6lpgqq8pen"><span textstyle="" style="text-decoration: underline;">https://huggingface.co/nexaAIDev/omniaudio-2.6b</span></span></p>

深度剖析 StarRocks 读取 ORC 加密文件背后的技术

作者:微信小助手

<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 互联网大数据团队 - Zheng Xiaofeng</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>本文介绍了StarRocks数据库如何读取ORC加密文件,包括基础概念以及具体实现方案。深入探讨了利用ORC文件的四层结构和三层索引机制,实现高效查询加密数据。希望通过本文对ORC加密文件读取功能的实现细节的剖析,让读者更加深刻理解ORC文件,同时了解StarRocks支持加解密数据分析的方案。</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>为了提升对敏感数据的保护,需要对Hive表一些敏感数据进行加密存储。</p> <p><br></p> <p>Spark组件已经通过引入了Apache ORC项目(Java版本)对ORC格式的Hive表的数据进行加解密。</p> <p><br></p> <p>StarRocks也使用了Apache ORC项目的C++版本读写ORC文件,但是<strong>C++版本没有实现加解密功能</strong>,在使用StarRocks对Hive表进行即席分析时,无法对具有加密列的Hive表进行查询,因此,需要对StarRocks 的Apache ORC模块进行改造,使其支持对ORC格式的Hive加密表数据读取功能,数据架构图如下图所示:</p> </section> <p><br></p> <p>希望通过本文对ORC加密文件读取功能的实现细节的剖析,让读者更加深刻理解ORC文件,同时了解StarRocks支持加解密数据分析的方案。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016548" data-ratio="0.44074074074074077" data-s="300,640" src="/upload/a2a2ade8a9555f0f0eb10bb21c9605f4.png" data-type="png" data-w="1080" style=""></p> <p style="text-align: center;"><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>在正式开启全文的阅读之前,我们首先引入几个问题,然后带着这些问题去阅读后面的内容,将会更有针对性与启发性,通过深入解答这些问题,我们不仅能够更好地理解相关的概念和技术,还能提升分析和解决问题的能力。</p> <p><br></p> <p>问题如下:</p> </section> <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%;"> <ol class="list-paddingleft-1" style="list-style-type: decimal;"> <li><p>程序解压某个文件时,是否需要一次性读取整个文件后再进行解压操作?</p></li> <li><p>ORC 文件究竟是如何做到在不扫描全文件的情况下就能精准查询到想要的数据?</p></li> <li><p>当 SQL 查询条件不符合最左前缀原则时,ORC文件中的索引是否就会失效?</p></li> <li><p>数据加密、解密、解压以及压缩之间的关联关系到底是怎样的?</p></li> <li><p>在写ORC文件时为什么是先压缩后加密,而不是先加密后解压?</p></li> </ol> </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>三、ORC文件介绍</p> </section> </section> <p><br></p> <p>ORC(Optimized Row Columnar)文件格式是一种高度优化的列式存储格式,它主要用于Hadoop生态系统中的大数据处理和分析。ORC文件结构的设计旨在提高I/O效率、减少数据读取时间,并支持复杂的数据类型和压缩算法。</p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">3.1 四层结构 File ,Stripe,Stream,Group</span></p> <p><br></p> <p>一个File中包含多个Stripe,一个Stripe包含多个Steam,一个Stream包含多个Group,每个Group默认存储1万行数据,如下图所示:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016549" data-ratio="1.3305555555555555" data-s="300,640" src="/upload/94a680c1275892c376b01bc845e9053f.png" data-type="png" data-w="1080" style=""></p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">3.2&nbsp;三层索引</span></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;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p><strong>FileStat</strong> :文件级别各列的统计信息,用于判断SQL条件是否下推。</p></li> <li><p><strong>StripeStat</strong>:Stripe级别各列的统计信息,用于判断SQL条件是否下推。</p></li> <li><p><strong>IndexData</strong>:每个Stripe 内部各列的索引信息,用于判断SQL条件是否下推。</p></li> </ul> </section> </section> </section> <section> <p><br></p> <p>在读取文件中数据之前,会先读取以上3类索引数据,根据SQL条件逐层进行比对,来决定是否跳过某些数据的读取,减少数据扫描量,从而提升SQL查询效率。</p> <p><br></p> <p>下表是只包含id和name两列的ORC文件的各层统计信息的案例:</p> </section> <section style="display: flex;flex-flow: row;margin: 10px 0%;text-align: left;justify-content: flex-start;"> <section style="display: inline-block;vertical-align: top;width: auto;flex: 100 100 0%;align-self: flex-start;height: auto;margin-right: 3px;"> <section style="display: flex;flex-flow: row;text-align: center;justify-content: center;"> <section style="display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;border-width: 0px;border-radius: 3px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;align-self: flex-start;"> <section style="padding-right: 3px;padding-left: 3px;"> <p><strong>FileStat</strong></p> </section> </section> </section> <section style="text-align: center;margin-right: 0%;margin-bottom: 10px;margin-left: 0%;isolation: isolate;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img class="rich_pages wxw-img" data-cropselx1="0" data-cropselx2="191" data-cropsely1="0" data-cropsely2="191" data-imgfileid="100016546" data-ratio="1.0386740331491713" data-s="300,640" src="/upload/e82fc672c9cb6ba4ea31d6225d2478e8.png" data-type="jpeg" data-w="362" style="vertical-align: middle;width: 191px;height: auto;"> </section> </section> </section> <section style="display: inline-block;vertical-align: top;width: auto;align-self: flex-start;flex: 100 100 0%;margin-right: 3px;"> <section style="display: flex;flex-flow: row;text-align: center;justify-content: center;"> <section style="display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;border-width: 0px;border-radius: 3px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;align-self: flex-start;"> <section style="padding-right: 3px;padding-left: 3px;text-align: justify;"> <p><strong>StripeStat</strong></p> </section> </section> </section> <section style="text-align: center;margin-right: 0%;margin-bottom: 10px;margin-left: 0%;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img class="rich_pages wxw-img" data-cropselx1="0" data-cropselx2="191" data-cropsely1="0" data-cropsely2="191" data-imgfileid="100016545" data-ratio="1.6206373292867982" data-s="300,640" src="/upload/eef7e11d6a94072d1d1237d98fb69874.png" data-type="jpeg" data-w="659" style="vertical-align: middle;width: 191px;height: 310px;"> </section> </section> </section> <section style="display: inline-block;vertical-align: top;width: auto;align-self: flex-start;flex: 100 100 0%;"> <section style="display: flex;flex-flow: row;text-align: center;justify-content: center;"> <section style="display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;border-width: 0px;border-radius: 3px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;align-self: flex-start;"> <section style="padding-right: 3px;padding-left: 3px;text-align: justify;"> <p><strong>IndexData</strong></p> </section> </section> </section> <section style="text-align: center;margin-right: 0%;margin-bottom: 10px;margin-left: 0%;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img class="rich_pages wxw-img" data-cropselx1="0" data-cropselx2="191" data-cropsely1="0" data-cropsely2="191" data-imgfileid="100016544" data-ratio="2.068762278978389" data-s="300,640" src="/upload/28fc55a961ab7ab04951141cfdeca4cf.png" data-type="jpeg" data-w="509" style="vertical-align: middle;width: 191px;height: 395px;"> </section> </section> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">3.3 ORC文件内部详细结构</span></p> <p><br></p> <p>前面已经大体介绍了ORC文件的结构,下面详细介绍其内部结构,ORC文件由多个逻辑层次组成,每个层次都有特定的作用和结构,下图具体描述了包含2列(id,name)的ORC文件结构图:</p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016553" data-ratio="0.9777777777777777" data-s="300,640" src="/upload/e6804765bf3edd54d1e89faf890f53db.png" data-type="png" data-w="1080" 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;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p><strong>Tail</strong>:存储文件的元数据,如列的压缩信息、统计信息、版本等,包含了三个部分:PostScript、Footer、MetaData。</p></li> <li><p><strong>Body</strong>:实际存储数据的部分,由多个Stripe组成。</p></li> </ul> </section> </section> </section> <p><br></p> <section> <p>下面分别介绍Tail和Body内部包含哪些结构:</p> <p><br></p> <p>Tail文件尾部是读取ORC文件的起点,它包含了文件关键信息:</p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: right;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);height: auto;"> <section style="text-align: left;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p><strong>PostScript</strong>:存储文件的压缩类型、压缩块大小、版本信息,Footer和MetaData的长度等,这部分数据不会被压缩。</p></li> <li><p><strong>Footer</strong>:记录了整个文件所有列的统计信息(FileStat),所有Stripe的元数据信息(stripesList),加密信息(encryption)以及文件body长度。</p></li> <li><p><strong>MetaData</strong>:存储该文件所有Stripe的统计信息(StripeStat)。</p></li> </ul> </section> </section> </section> <p><br></p> <p>Body实际存储数据的部分,由多个Stripe组成,每个Stripe包含多个Stream,先存储索引相关的Stream(index-Stream),后面存储实际数据相关的Stream(data-Stream),每一列包含多个index-Stream和data-Stream,Stripe是ORC文件中数据存储的基本单元,每个Stripe数据大小一般不超过200M,主要包含下面几块内容:</p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: right;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);height: auto;"> <section style="text-align: left;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p><strong>Stripe Footer</strong>:包含所有Stream的元数据(streamsList)和加密信息(encryption)等。</p></li> <li><p><strong>Index-Stream</strong>:存储索引相关数据的Stream,按列存储。</p></li> <li><p><strong style="letter-spacing: 0.034em;">Data-Stream</strong><span style="letter-spacing: 0.034em;">:</span><span style="letter-spacing: 0.034em;">储实际数据相关的Stream,按列存储。</span></p></li> </ul> </section> </section> </section> <p><br></p> <p>ORC文件的读取是从尾部最后一个字节开始的,得到PostScript的长度,读取PostScript,然后根据PostScript中的FooteLength,MetaDataLength信息读取MetaData和Footer,最后根据Footer中的Stripe信息读取具体的数据Stripe,上面的文字介绍可能不是很直观,如果想更细节了解ORC文件结构内容可以参考(<a target="_blank" href="https://www.processon.com/mindmap/6503c70803ab061eb31b80da" textvalue="ORC文件结构思维导图" linktype="text" imgurl="" tab="outerlink" data-linktype="2">ORC文件结构思维导图</a>,<a target="_blank" href="https://orc.apache.org/" textvalue="ORC文件官网介绍" linktype="text" imgurl="" tab="outerlink" data-linktype="2">ORC文件官网介绍</a>)。</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><span style="font-size: 16px;color: rgb(65, 95, 255);">4.1 对称加解密</span></p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016554" data-ratio="0.5212962962962963" data-s="300,640" src="/upload/52dc9b4668acdf75ebe6fac2bce43b12.png" data-type="png" data-w="1080" 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>密钥</strong>:密钥是加密和解密过程中的关键元素,它是由随机数生成的,通常是固定长度的一串二进制数。</p></li> <li><p><strong>明文</strong>:明文是指原始的信息,可以是文本、图片、音频等各种形式的数据。</p></li> <li><p><strong>密文</strong>:密文是经过加密算法处理后的数据,只有知道密钥的人才能解密还原成明文。</p></li> <li><p><strong>加密算法</strong>:加密算法是将明文转换成密文的过程,这个过程通常涉及到一系列的数学运算,比如AEC,RSA等。</p></li> </ul> </section> </section> </section> <p><br></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>注意:对称加密的加密密钥 和 解密密钥是一样的。</p> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.2 文件的压缩和解压缩</span></p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.2.1&nbsp;压缩算法</span></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>无损压缩</strong>:意味着原始数据可以完全从压缩文件中恢复,常用于文本和某些类型的数据文件。</p></li> <li><p><strong>有损压缩</strong>:为了获得更高的压缩率,允许丢失一些数据,常用于图像、音频和视频文件。</p></li> </ul> </section> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.2.2 解压算法</span></p> <p><br></p> <section> <p>解压算法是压缩算法的逆过程,它用于将压缩文件恢复到其原始状态。无损压缩的解压算法能够完全恢复原始数据,而有损压缩的解压算法则可能无法完全恢复所有原始数据。</p> <p><br></p> <p>文件压缩和解压缩简单流程图如下:</p> <p><br></p> </section> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016555" data-ratio="0.4324074074074074" data-s="300,640" src="/upload/02157a59cb95971f18ee58f3aee05b08.png" data-type="png" data-w="1080" style=""></p> <p><br></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>注意:数据的压缩算法和解压算法要一样</p> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.2.3 压缩块</span></p> <p><br></p> <section> <p>文件压缩块是指对文件进行压缩处理后生成的一组连续的数据块。在文件压缩过程中,文件被分割成多个块,每个块都经过压缩算法处理。一般来说,文件压缩块的大小可配置。例如,ZIP压缩的每个压缩块的大小可以达到64KB或更大,而在其他压缩格式如7z中,压缩块的大小可以更大,通常为数MB。这些大小可以根据文件的特性和压缩算法的性能进行调整,以达到更好的压缩比和解压性能。</p> <p><br></p> </section> <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>注意:在解压文件的过程中会从文件中读取整个压缩块数据到内存之后再使用解压算法进行解压处理,所以压缩块越大每次解压读取到内存里的数据会越大。</p> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">4.3 加密压缩文件读写大致流程</span></p> <p><br></p> <p>在掌握了数据加密和压缩的基础知识之后,让我们从宏观的角度了解一下ORC加密文件读写流程,如下图所示:在写入时,内存中的数据首先被序列化,然后压缩以减少体积,最后对数据加密。在读取时,数据首先被解密以恢复原始格式,然后解压数据得到原始数据,最后通过反序列化原始数据转换为内存对象。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016556" data-ratio="0.24537037037037038" data-s="300,640" src="/upload/eb2450d5c21f038961e43e117a55f33e.png" data-type="png" data-w="1080" style=""></p> <p><br></p> <p>详细说明写入和读取过程中的各个步骤:</p> <p><br></p> <p><strong>(1)写入过程(序列化、压缩、加密)</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: center;"> <ul class="list-paddingleft-1" style="list-style-type: disc;"> <li><p style="text-align: left;"><strong>序列化</strong>:在数据写入存储系统之前,首先需要将内存中的对象转换成可以存储或传输的格式,这个过程称为序列化。序列化后的数据通常是一个二进制格式,便于后续的处理。</p></li> <li><p style="text-align: left;"><strong>压缩</strong>:序列化后的数据可能会占用较大的空间。为了减少存储需求和<strong>提升后续数据加密处理效率</strong>,接下来对数据进行压缩。压缩算法会尝试去除数据中的冗余,从而减少数据的体积。</p></li> <li><p style="text-align: left;"><strong>加密</strong>:压缩后的数据需要进行加密,以确保数据的安全性。加密算法会使用密钥对数据进行加密,生成密文。</p></li> <li><p style="text-align: left;"><strong>存入文件中</strong>:加密后的密文被存储在文件中,等待后续的读取或传输。</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><strong>(2)读取过程(解密、解压、反序列化)</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>解密</strong>:当需要读取文件中的数据时,首先需要使用正确的密钥和加密算法对密文进行解密,恢复为压缩前的数据。</p></li> <li><p><strong>解压</strong>:解密后,应用解压算法对数据进行解压,恢复到序列化前的状态。</p></li> <li><p><strong>反序列化</strong>:解压后的数据是一个二进制格式,需要进行反序列化,将其转换为内存中的对象。反序列化是序列化的逆过程,它将二进制数据转换为可读可操作的数据结构。</p></li> <li><p><strong>内存对象</strong>:经过解密、解压和反序列化之后,数据最终以内存对象的形式被程序处理。</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> <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>五、StarRocks 读取 ORC 加密文件实现方案</p> </section> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.1 ORC文件内部数据加密关系</span></p> <p><br></p> <p>首先,介绍几个密钥的含义:</p> <p><br></p> <section> <p><strong>statKey</strong>:用于解密加密列的FileStat,StripeStat的密钥,每个列一个,加密存储在文件Footer里。</p> <p><br></p> <p><strong>dataKey</strong>:用于解密加密列的IndexData 和 RowData,每个Stripe的每一列都有一个,加密存储在Stripe的Footer里。</p> <p><br></p> <p><strong>masterKey</strong>:文件的根密钥,用于解密ORC文件中被加密的statKey 和 dataKey,该密钥没有存储在文件中,一般存储在Hive表属性上。要解密ORC文件中的数据,首先需要获取这个masterKey。然而,masterKey本身也是加密的,因此在读取Hive表之前,必须先从表属性中提取出加密的masterKey,访问密钥管理服务(Key Management Service, KMS),对加密的masterKey进行解密,从而获得可用于实际解密操作的明文masterKey密钥,一旦获得了masterKey的明文形式,就可以用它来解密ORC文件中的dataKey和statKey。</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016557" data-ratio="0.43703703703703706" data-s="300,640" src="/upload/39c21dd10bbf195f1ead8a2ab82ec2ec.png" data-type="png" data-w="1080" style=""></p> <p><br></p> <p>下图是描述了masterKey、statKey,dataKey之间的关系,灰色部分代表是存储在文件中被加密的数据,绿色部分则是解密之后的数据,包括我们解密后的statKey,dataKey。获得这两个密钥之后分别用于解密统计信息和文件中的真实数据。</p> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.2 StarRocks读取ORC加密文件流程</span></p> <p><br></p> <p>在深入掌握了ORC文件中密钥的相互关系和功能后,我们现在转向探讨StarRocks是如何读取ORC加密表的数据。这个过程如下图所示:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016558" data-ratio="0.6620370370370371" data-s="300,640" src="/upload/2da52c31978ab8fece7505bd17e573ea.png" data-type="png" data-w="1080" style=""></p> <p><br></p> <section> <p><strong>1)提交SQL查询</strong>:用户首先通过SQL客户端向StarRocks FE节点提交查询请求。这通常涉及到对Hive表下存储的ORC加密文件进行读取操作。</p> <p><br></p> <p><strong>2)获取解密的masterKey</strong>:查询提交后,系统首要根据SQL获取Hive表中的ORC文件所需的masterKey。这个masterKey一般存储在表属性里,并且是加密存储的,必须调用KMS服务来解密,得到密钥明文。</p> <p><br></p> <p><strong>3)传递masterKey明文</strong>:解密后的masterKey,以明文形式传递给StarRocks BE节点。</p> <p><br></p> <p><strong>4)读取并解密密钥</strong>:BE 拿到已解密的masterKey 之后 读取并解密ORC文件中的statKey和dataKey,这两个密钥分别用于解密统计信息(FileStat,StripeStat)和实际数据内容,为接下来的统计信息和数据解密做准备。</p> <p><br></p> <p><strong>5)使用statKey和dataKey解密数据</strong>:BE使用statKey来解密文件的统计信息(fileStat和StripeStat)同时使用dataKey来解密实际的数据内容。</p> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.3 读取ORC加密文件的关键实现细节</span></p> <p><br></p> <section> <p>通过了解前文StarRocks读取ORC加密文件流程,我们将深入探讨读取ORC加密文件的数据关键实现细节。首先,我们提出一个问题:在物理存储中,文件存储的是什么内容?答案是二进制数据。这些二进制数据通常会经过压缩处理。</p> <p><br></p> <p>ORC文件的读取流程是自外向内的,类似于<strong>剥洋葱的过程</strong>,逐步深入到我们需要读取的目标数据。读取流程可以概括为:首先读取文件元数据,通过元数据获取目标数据的偏移量(offset)和数据长度如下图所示,然后通过流的方式读取目标数据。</p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016559" data-ratio="0.3074074074074074" data-s="300,640" src="/upload/14288426e0757811d4f1429d2f3d7a92.png" data-type="png" data-w="1080" style=""></p> <p><br></p> </section> <p>具体到ORC加密文件的读取实现代码,主要采用了设计模式中的装饰模式方式来组织代码的。在这个模式中,原始的文件流(SeekableFileInputStream)首先被解密流(DecryptionInputStream)所包装,如果是非加密文件就没有这一层,然后解密流又被解压缩流(DecompressionStream)所包装。每一层流都只负责向其包装的流请求数据,并在接收到一定量数据后开始处理自己的逻辑。如下图所示:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016560" data-ratio="0.4648148148148148" data-s="300,640" src="/upload/f9fd706e9d7a1998f761bd2c3d8dee24.png" data-type="png" data-w="1080" style=""></p> <p><br></p> <p>这种分层的方法保证每一层都专注于自己的职责,共同协作完成ORC文件的读取任务。通过这种方式,我们不仅能够高效地读取ORC文件,还能确保数据的安全性和完整性。综上所述,ORC文件的读取流程是一个从文件元数据到具体数据内容的逐步深入过程。</p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.4 加密字段跳读机制</span></p> <p><br></p> <p>为了提升数据的查询效率,查询数据时会根据索引数据跳过不必要的数据读取,下面我们介绍加密列跳读机制,理解了这部分的内容,就能非常清晰的知道,读取加密字段时,对数据解密与解压是怎样协作的。</p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.4.1 加密块与压缩块的关系</span></p> <p><br></p> <p>加密列的数据划分了多个加密块与压缩块,一个压缩块 包含多个加密块,读取数据时,先对每个加密块进行解密,解密多个加密块之后,把这些解密后的数据块合并成一个完整的压缩块,然后对这个压缩块进行解压得到原始数据下图是加密块与压缩块的关系图:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016561" data-ratio="0.31851851851851853" data-s="300,640" src="/upload/079b939f13b3b436e41b2fea58b824f0.png" data-type="png" data-w="1080" style=""></p> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.4.2 ORC文件使用的加解密算法和模式</span></p> <p><br></p> <p>下图描述了具体的数据加解密过程中以及设计到整个过程中各种元素输入输出的关系:</p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016562" data-ratio="0.4046296296296296" data-s="300,640" src="/upload/128173fc3a3aa63e5f8178c07a05df25.png" data-type="png" data-w="1080" style=""></p> <p><br></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>注意:同一个数据块(16字节)加密过程和解密过程中的 密钥、IV值、加密算法和加密模式必须相同。</p> </section> </section> <p><br></p> <section> <p><strong>明文块</strong>:我们对ORC文件加密使用的加密算法是AES-128-CTR/NoPadding,该算法加密数据时 ,会把明文按照16个字节划分多个块,每个块加密之后得到的数据就是加密块。</p> <p><br></p> <p><strong>加密块</strong>:每个明文数据块加密之后得到的数据就是加密块。</p> <p><br></p> <p><strong>初始向量IV</strong>:初始向量IV的作用是使加密更加安全可靠(加盐),我们使用AES加密时需要主动提供这个初始向量IV,而且只需要提供一个初始向量就够了,后面每个数据块的加密向量由加密模式决定,所以每个数据块的加密向量都不一样。初始向量IV的长度规定为128位16个字节,ORC文件解密参数 IV的描述如下:总共16个字节,前面8个字节分别存储:列ID,Stream类型,Stripe的ID ,后面8个字节用于填充min_count,由于我们使用的是CTR加密模式,所以这个min_count就是加密块在整个加密数据中的计数,iv各个内容长度定义如下图:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016563" data-ratio="0.2972972972972973" data-s="300,640" src="/upload/bed7e4bfa84f0df035075e3931c46522.png" data-type="png" data-w="1036" style=""></p> <p><br></p> <p><strong>密钥</strong>:AES要求密钥的长度可以是128位16个字节、192位或者256位,位数越高,加密强度自然越大,但是加密的效率自然会低一些,因此要做好权衡。我们开发通常采用128位16个字节的密钥,我们使用AES加密时需要主动提供密钥,而且只需要提供一个密钥就够了,每个数据块加解密使用的都是同一个密钥。</p> <p><br></p> <p><strong>加密模式</strong>:有5种加密模式,这些加密模式的主要目的是为了<strong>不让重复的明文加密之后得到的密文一样</strong>,提升数据安全性,我们使用的是CTR模式(计数器模式)对数据加密,那解密的时候也需要CTR模式对数据解密,计数器模式介绍请参考链接,CTR模式 的iv参数 包含了 加密块计数(min_count),所以 每次对一个加密块解密时 需要知道 当前加密块的初始计数值。</p> </section> <p><br></p> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.4.3 举例说明跳读流程</span></p> <p><br></p> <p>学习了前面读取加密数据的关键细节之后,举个例子说明跳读ORC文件流程,假设根据索引数据和查询条件确定需要读取某个文件中第1个Strip中第1列的第5个group的数据,那么我们知道group5数据的偏移量offset,文件结构如下图所示:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016564" data-ratio="0.5814814814814815" data-s="300,640" src="/upload/a3eca31d888bf5e11a7da2a470ed33c5.png" data-type="png" data-w="1080" style=""></p> <p><br></p> <p>具体逻辑大体流程如下:</p> <p><br></p> <p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="100016565" data-ratio="0.3175925925925926" data-s="300,640" src="/upload/8209a02e5d567b2ee787fa883d7ef89c.png" data-type="png" data-w="1080" style=""></p> <p><br></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>注意:解压数据块时,必须把当前解压块的所有数据读出来才能使用对应的解压算法解压数据。</p> </section> </section> <section> <p><br></p> <p>1)group5数据的偏移量group_offset计算出 group5数据在哪个压缩块里,计算公式为:<span style="letter-spacing: 0.034em;background-color: rgb(214, 214, 214);">block_index = group_offset/zipBlockSize</span><span style="letter-spacing: 0.034em;">(压缩块大小),并得到该压缩块的起始位置zip_head_offset 公式为:</span><span style="letter-spacing: 0.034em;background-color: rgb(214, 214, 214);">zip_head_offset = block_index*zipBlockSize</span><span style="letter-spacing: 0.034em;">。</span></p> <p><span style="letter-spacing: 0.034em;"></span></p> <p><br></p> <p>2)获取zip_head_offset位置对应的加密块计数,加密块计数值计算公式为:<span style="letter-spacing: 0.034em;background-color: rgb(214, 214, 214);">min_count = zip_head_offset/encrypted-size</span><span style="letter-spacing: 0.034em;">(加密块大小) 更新iv向量的min_count值。</span></p> <p><br></p> <p>3)文件读指针定位到zip_head_offset,开始读取压缩块的数据,这个压缩块的数据全部读出之后,使用解压算法进行解压。</p> <p><br></p> <p>4)通过group5在解压的数据上偏移量和长度,读取group5 数据,然后再对数据进行解码。</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>通过前面对相关内容的讲解,下面我们来解答前文提出的问题:</p> <p><br></p> <p>1)文件解压是否意味着一定是对整个文件进行解压操作?</p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: right;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);height: auto;"> <section style="text-align: left;"> <p>答:不需要,文件是按照一定大小划分出若干个压缩块,只要读出相应的压缩块进行解压就行。</p> </section> </section> </section> <section> <p><br></p> <p>2)ORC 文件究竟是如何做到在不扫描全文件的情况下就能精准查询到想要的数据?</p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: right;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);height: auto;"> <section style="text-align: left;"> <p>答:ORC文件有三层索引,在读取文件数据之前先读取各层级的索引信息,根据过滤条件过滤掉不必要的数据扫描,从而提升数据查询效率。</p> </section> </section> </section> <section> <p><br></p> <p>3)当 SQL 查询条件不符合最左前缀原则时,其索引效果是否就会失效呢?</p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: right;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);height: auto;"> <section style="text-align: left;"> <p>答:不会失效,ORC文件是列式存储的,各列信息都是相互独立的,有自己的索引信息,与行式数据库的索引最左前缀规则不同。</p> </section> </section> </section> <section> <p><br></p> <p>4)数据加密、解密、解压以及压缩之间的关联关系到底是怎样的?</p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: right;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);height: auto;"> <section style="text-align: left;"> <p>答:请参考本文:5.1 ORC文件内部数据加密关系 内容。</p> </section> </section> </section> <section> <p><br></p> <p>5)在写加密列数据时,为什么不是先加密数据再压缩,而是先压缩后加密?</p> </section> <section style="margin-top: 10px;margin-bottom: 10px;text-align: right;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);height: auto;"> <section style="text-align: left;"> <p>答:主要是为了提升加密效率,数据被压缩处理之后,数据量变少了,加密效率就提升了。</p> </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>本文介绍了StarRocks数据库如何读取ORC文件的加密数据,包括相关概念理解、ORC文件介绍、以及StarRocks读取加密ORC文件的具体实现方案。阐述了出于数据安全的需要,对Hive表中的敏感数据进行加密存储的必要性,介绍了对称加密、文件压缩与解压、加密压缩文件读写流程等概念,深入探讨了ORC文件的三层结构和索引机制,以及如何利用这些特性实现高效查询加密数据。还详细描述了StarRocks读取加密ORC文件的流程,包括获取解密的masterKey、使用masterKey解密ORC文件中的密钥、以及使用这些密钥解密数据。</p> <p><br></p> <p>希望通过本文对ORC加密文件读取功能的实现细节,让读者对ORC文件的理解更深刻。最后如果想从代码层面了解ORC文件解密过程可以参考<a target="_blank" href="https://github.com/StarRocks/starrocks/pull/46809" textvalue="开源PR" linktype="text" imgurl="" tab="outerlink" data-linktype="2">开源PR</a>。</p> </section> </section>

99行代码!教会你用Doris+DeepSeek实现AI舆情分析

作者:微信小助手

<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 10px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(90deg, rgba(50, 0, 0, 0.03) 0%, rgba(255, 255, 255, 0) 11.49%), linear-gradient(360deg, rgba(50, 0, 0, 0.04) 0%, rgba(255, 255, 255, 0) 12.16%);background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: repeat, repeat;background-size: 20px 20px, 20px 20px;width: auto;font-family: Optima, PingFangSC-light, serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;overflow-wrap: break-word;text-align: left;"> <blockquote style="margin-top: 20px;margin-bottom: 20px;margin-left: 0px;margin-right: 0px;padding-top: 10px;padding-bottom: 10px;padding-left: 20px;padding-right: 10px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(64, 184, 255, 0.4);border-bottom-color: rgba(64, 184, 255, 0.4);border-left-color: rgba(64, 184, 255, 0.4);border-right-color: rgba(64, 184, 255, 0.4);border-top-left-radius: 8px;border-top-right-radius: 8px;border-bottom-right-radius: 8px;border-bottom-left-radius: 8px;background-attachment: scroll;background-clip: border-box;background-color: rgba(64, 184, 250, 0.1);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;display: block;overflow-x: auto;overflow-y: auto;"> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">你是否曾经历过这样的场景:公司号突然被喷,评论区一片狼藉,客服电话被打爆,老板紧急召集会议,大家手忙脚乱却不知从何入手?&nbsp;</span></p> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">舆情危机好比一场没有预警的暴风雨,瞬间就能让企业陷入困境。对处在风口浪尖的企业来说,拥有一套高效的舆情分析系统简直就是救命稻草。&nbsp;</span></p> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">正巧,一位Doris小伙伴:"WX!!! 急需AI舆情分析。"&nbsp;</span></p> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">"好滴,安排"</span></p> </blockquote> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf=""><img src="/upload/7e7181a95e5df087fef439834f0f794c.png" class="rich_pages wxw-img" data-ratio="0.47135135135135137" data-w="925"></span></p> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz21vjfvy3pmcr7i1u8oricfoxpvbxjxuj0u3zwdcofpbm8anp19upci2cnaadetotft2pl4riaibmhtog 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">舆情分析中的痛点</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">小华是某政务中心的舆情分析师,每天需要处理上千条网络评论。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">传统的舆情分析流程繁琐又耗时:手动筛选关键信息,分析情绪趋势,生成报告,往往一天下来只能处理几百条数据。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">"如果系统能自动识别高风险言论就好了,我也不用天天熬夜加班。"小华经常这样感叹。</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/45f5a2c632e989de02a743dfece4cab6.png" class="rich_pages wxw-img" data-ratio="0.44166666666666665" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003973"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">张总是一家快消品企业的公关部负责人,公司刚上市新产品就遭遇了全网吐槽。面对铺天盖地的负面评论,张总的团队只能疲于奔命地一条条回复。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">"我们需要知道舆情的源头在哪里,是质量问题还是营销策略出了错。可现在的分析速度远跟不上网络传播速度。"</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">......</span></p> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz21vjfvy3pmcr7i1u8oricfoxpvbxjxuj0u3zwdcofpbm8anp19upci2cnaadetotft2pl4riaibmhtog 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">Doris+DeepSeek:舆情分析的黄金组合</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Apache Doris是一款基于 MPP 架构的高性能、实时分析型数据库,能够处理海量数据并提供毫秒级查询性能。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">DeepSeek则是一款强大的大语言模型,拥有出色的语义理解和情感分析能力。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">两者结合,好比给数据分析插上了AI的翅膀。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Doris负责数据存储和快速检索,DeepSeek负责深度解读文本背后的情感和意图。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">这套组合的工作流程:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf=""><img src="/upload/d822c5162a833d57e76150999d760c8d.png" class="rich_pages wxw-img" data-ratio="0.2518518518518518" data-w="1080"></span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 数据采集:通过爬虫收集平台的评论和帖子等内容</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 数据入库:将收集到的数据实时写入Doris</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 大模型分析:DeepSeek对文本进行多维度分析</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">4️⃣ 可视化展示:将分析结果以直观的方式呈现</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">确认好组合思路,接下来就开始撕代码 ⬇️</span></p> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz21vjfvy3pmcr7i1u8oricfoxpvbxjxuj0u3zwdcofpbm8anp19upci2cnaadetotft2pl4riaibmhtog 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">99行代码速通AI舆情分析</span></span></h2> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">环境准备</span></span><span style="display: none;"></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">本文demo环境相对简易,参考</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">DorisAi</span></strong><span leaf="">前文环境即可:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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=""><a style="" href="https://mp.weixin.qq.com/s?__biz=MzI3NjA1MTcyMQ==&amp;mid=2650487577&amp;idx=1&amp;sn=6e7c50529a2c42cf3955570180b8a5d2&amp;scene=21#wechat_redirect" textvalue="3步!教会你用Doris+DeepSeek搭建ChatBI系统(保姆级教程)" data-itemshowtype="0" target="_blank" linktype="text" data-linktype="2">3步!教会你用Doris+DeepSeek搭建ChatBI系统(保姆级教程)</a></span></code></p> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">代码实现</span></span><span style="display: none;"></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">经过一臻和老崔七七四十九秒的编写调试,完整的99行示例代码如下:</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 ufvmvgcvafkp2bijpvoesrlsuhijwyibqpjejbicjttlway8ibckmx1nmjibvkjsujq7ar6sdebu1fdxiciayuxd3uibzhe4cnvriadia 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;pymysql</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;dbutils.pooled_db&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;PooledDB</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;requests</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;langchain.agents&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;initialize_agent, Tool</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf="">&nbsp;langchain_openai&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf="">&nbsp;ChatOpenAI</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""</span><span leaf=""><br></span><span leaf="">AI舆情分析|自动投诉处理系统 v1.0</span><span leaf=""><br></span><span leaf="">Description: 基于LangChain Agent的智能流程自动化系统,替代硬编码方式处理投诉数据</span><span leaf=""><br></span><span leaf="">"""</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 定义Apache Doris数据库查询的Agent Tool</span></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">dorisTool</span></span><span style="line-height: 26px;"><span leaf="">(query)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; POOL_DORIS_OFF = PooledDB(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; user=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'{user}'</span></span><span leaf="">,password=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'{password}'</span></span><span leaf="">,host=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'{host}'</span></span><span leaf="">,port={port},database=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'{database}'</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; charset=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'utf8'</span></span><span leaf="">,creator=pymysql,blocking=</span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">True</span></span><span leaf="">,maxusage=</span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">None</span></span><span leaf="">,setsession=[],maxconnections=</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">30</span></span><span leaf="">,mincached=</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">10</span></span><span leaf="">,ping=</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">0</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; )</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; cursor = POOL_DORIS_OFF.connection().cursor()</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; cursor.execute(query)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; columns = [col[</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">0</span></span><span leaf="">]&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">for</span></span><span leaf="">&nbsp;col&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf="">&nbsp;cursor.description]</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; rs = [dict(zip(columns, row))&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">for</span></span><span leaf="">&nbsp;row&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf="">&nbsp;cursor.fetchall()]</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;rs</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 定义发送钉钉消息的Agent Tool</span></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf="">&nbsp;</span><span style="color: #61aeee;line-height: 26px;"><span leaf="">dingdingTool</span></span><span style="line-height: 26px;"><span leaf="">(msg)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; markdown_message =&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">f"""</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #e06c75;line-height: 26px;"><span leaf="">{msg}</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"""</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; webhook_url = (</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{webhook_url}"</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; headers = {</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'Content-Type'</span></span><span leaf="">:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'application/json'</span></span><span leaf="">}</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; payload = {</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"msgtype"</span></span><span leaf="">:&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"markdown"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"markdown"</span></span><span leaf="">: {</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"title"</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; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"text"</span></span><span leaf="">: markdown_message</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="">&nbsp; &nbsp;&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">try</span></span><span leaf="">:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; response = requests.post(webhook_url, headers=headers, json=payload)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; response.raise_for_status()</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; print(</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: #c678dd;line-height: 26px;"><span leaf="">except</span></span><span leaf="">&nbsp;requests.exceptions.RequestException&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">as</span></span><span leaf="">&nbsp;e:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; print(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">f"钉钉消息推送失败:&nbsp;</span><span style="color: #e06c75;line-height: 26px;"><span leaf="">{e}</span></span><span leaf="">"</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 定义LangChain Agent工具列表</span></span><span leaf=""><br></span><span leaf="">tools = [</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; Tool(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; name=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"执行sql查询doris数据"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; func=dorisTool,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; description=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"根据传入的doris sql直接执行,返回结果集,返回格式为list"</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; ),</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; Tool(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; name=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"推送钉钉消息"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; func=dingdingTool,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; description=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"根据传入的msg通过钉钉机器人的形式推送msg到钉钉群"</span></span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; )</span><span leaf=""><br></span><span leaf="">]</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 初始化LLM</span></span><span leaf=""><br></span><span leaf="">llm = ChatOpenAI(base_url=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'https://ark.cn-beijing.volces.com/api/v3'</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;api_key=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{api_key}"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;model=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'{model}'</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 初始化LangChain Agent</span></span><span leaf=""><br></span><span leaf="">agent = initialize_agent(</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; tools,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; llm,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; agent=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"zero-shot-react-description"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; verbose=</span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">True</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; handle_parsing_errors=</span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">True</span></span><span leaf=""><br></span><span leaf="">)</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 提示模板,指导AI代理如何处理查询</span></span><span leaf=""><br></span><span leaf="">question =&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"请问近30天有关于一臻数据的投诉信息吗"</span></span><span leaf=""><br></span><span leaf="">promptTemplate =&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""</span><span leaf=""><br></span><span leaf="">你是“一臻数据”平台的投诉识别以及处理员,需完成以下任务:</span><span leaf=""><br></span><span leaf="">1. 根据用户的问题,生成一个 SQL 查询,具体查询时间范围以用用户实际问题为准。</span><span leaf=""><br></span><span leaf="">2. 从查询结果中筛选出与“一臻数据”相关的投诉信息。</span><span leaf=""><br></span><span leaf="">3. 将筛选结果汇总为易读的格式,并给出处理建议以及将命中的投诉信息根据你的建议排出一个紧急程度来,尽可能多的挖掘一些信息返回给客户,做专家指导,如“舆情分类”、“定义分类”、“紧急程度”等。</span><span leaf=""><br></span><span leaf="">4. 如果存在与“一臻数据”相关的投诉,将汇总信息和你的处理建议通过钉钉机器人推送到指定群组。</span><span leaf=""><br></span><span leaf="">5. 在推送内容中添加表情符号,增强可读性。</span><span leaf=""><br></span><span leaf="">注意:</span><span leaf=""><br></span><span leaf="">-如需调用工具,根据工具的作用在该任务里调用合适的工具,并根据工具的要求传入需要的参数,要求参数传入格式准确</span><span leaf=""><br></span><span leaf="">-只能从获得的doris库中的数据中做分析,不允许自己fake数据。</span><span leaf=""><br></span><span leaf="">数据库信息:</span><span leaf=""><br></span><span leaf="">- 表名:yz_complaint_detail</span><span leaf=""><br></span><span leaf="">- 字段:complaint_time(投诉时间), detail(具体投诉内容)</span><span leaf=""><br></span><span leaf="">- SQL 查询示例:SELECT detail FROM yz_complaint_detail WHERE complaint_time &gt;= NOW() - INTERVAL 60 DAY;</span><span leaf=""><br></span><span leaf="">"""</span></span><span leaf=""><br></span><span leaf="">prompt =&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">f"</span><span style="color: #e06c75;line-height: 26px;"><span leaf="">{question}</span></span><span leaf="">\n</span><span style="color: #e06c75;line-height: 26px;"><span leaf="">{promptTemplate}</span></span><span leaf="">"</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 运行Agent</span></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">try</span></span><span leaf="">:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; result = agent.run(prompt)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; print(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"Final Result:"</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; print(result)</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">except</span></span><span leaf="">&nbsp;Exception&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">as</span></span><span leaf="">&nbsp;e:</span><span leaf=""><br></span><span leaf="">&nbsp; &nbsp; print(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">f"代理执行出错:&nbsp;</span><span style="color: #e06c75;line-height: 26px;"><span leaf="">{e}</span></span><span leaf="">"</span></span><span leaf="">)</span><span leaf=""><br></span></code></pre> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">代码解析</span></span><span style="display: none;"></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">代码经过精简,很多block没有进行过多地细化深入。主要是为了让大家能够快速熟悉Doris+DeepSeek V3体验AI舆情分析的完整流程,后续可以结合自己需求,按模块进行调整应用。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">代码主流程如下:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf=""><img src="/upload/60443e6d61601acaadce07d7cc5a10a6.png" class="rich_pages wxw-img" data-ratio="0.6722222222222223" data-w="1080"></span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 用户查询:用户向系统提问,例如</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">请问近30天有关于一臻数据的投诉信息吗</span></code></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 任务分析:LangChain Agent接收问题和提示模板</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">prompt</span></code><span leaf="">,将其发送给大语言模型(</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">DeepSeek V3</span></code><span leaf="">)分析。语言模型理解问题意图,确定需要查询近30天的投诉数据</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ Doris数据库查询:Agent决定需要查询数据库,调用</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">dorisTool</span></code><span leaf="">函数,生成对应SQL进行查询并返回查询结果</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">4️⃣ 投诉分析:Agent将Doris查询结果发送给DeepSeek进行分析,DeepSeek筛选出与"一臻数据"相关的投诉,生成</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">分析报告,包括舆情分类、紧急程度</span></code><span leaf="">等信息</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">5️⃣ 结果处理:系统根据分析结果分两种情况处理:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">无投诉</span></strong><span leaf="">:DeepSeek生成一个表明没有发现相关投诉的回复</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">有投诉</span></strong><span leaf="">:Agent调用</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">dingdingTool</span></code><span leaf="">函数,函数将分析报告格式化为Markdown,通过钉钉webhook发送到指定群组,返回发送状态给Agent</span></p> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">其它说明</span></span><span style="display: none;"></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">1. 钉钉告警配置</span></strong></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">🔗 钉钉自定义机器人安全设置:</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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://open.dingtalk.com/document/robots/customize-robot-security-settings#title-7fs-kgs-36x</span></code></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf=""><img src="/upload/8df62d35afc1460b6f4256a490d84908.png" class="rich_pages wxw-img" data-ratio="1.4442231075697212" data-w="1004"></span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 创建一个至少3人行的钉钉群组</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 创建一个机器人</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 初始化机器人信息,并获取</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">Webhook</span></code></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">2. 缺省参数补齐</span></strong></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 补齐</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">dorisTool</span></code><span leaf="">的连接信息</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 补齐</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">dingdingTool</span></code><span leaf="">的</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">Webhook</span></code></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 补齐LLM的</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">api_key</span></code><span leaf="">和</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">model</span></code><span leaf="">,可以参考DorisAi前文获取</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">3. 测试表和数据</span></strong></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">代码所使用的Doris表和测试数据如下:</span></p> <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 ufvmvgcvafkp2bijpvoesrlsuhijwyibqpjejbicjttlway8ibckmx1nmjibvkjsujq7ar6sdebu1fdxiciayuxd3uibzhe4cnvriadia 640?wx_fmt="svg&amp;from=appmsg&quot;);&quot;"></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">-- 测试表</span></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">CREATE</span></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">TABLE</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`yz_complaint_detail`</span></span><span leaf="">&nbsp;(&nbsp;</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`complaint_time`</span></span><span leaf="">&nbsp;datetime&nbsp;</span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">NULL</span></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">COMMENT</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">'投诉时间'</span></span><span leaf="">,</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`detail`</span></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">text</span></span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">NULL</span></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">COMMENT</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">'具体投诉内容'</span></span><span leaf="">,</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">INDEX</span></span><span leaf="">&nbsp;index_complaint_time (</span><span style="color: #98c379;line-height: 26px;"><span leaf="">`complaint_time`</span></span><span leaf="">)&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">USING</span></span><span leaf="">&nbsp;INVERTED )&nbsp;</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">ENGINE</span></span><span leaf="">&nbsp;= OLAP&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">DUPLICATE</span></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">KEY</span></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">`complaint_time`</span></span><span leaf="">)&nbsp;</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">COMMENT</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">'一臻数据投诉信息表'</span></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">DISTRIBUTED</span></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">BY</span></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">HASH</span></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">`complaint_time`</span></span><span leaf="">) BUCKETS&nbsp;</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">30</span></span><span leaf=""><br></span><span leaf="">PROPERTIES (&nbsp;</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">"replication_allocation"</span></span><span leaf="">&nbsp;=&nbsp;</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"tag.location.default: 1"</span></span><span leaf=""><br></span><span leaf="">);</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf="">-- 测试数据</span></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">insert</span></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">into</span></span><span leaf="">&nbsp;yz_complaint_detail&nbsp;</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">values</span></span><span leaf=""><br></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'2025-03-11 15:30:30'</span></span><span leaf="">,</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'一臻数据真垃圾,总是拖稿'</span></span><span leaf="">),</span><span leaf=""><br></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'2025-03-10 13:30:30'</span></span><span leaf="">,</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'一臻数据真不错'</span></span><span leaf="">),</span><span leaf=""><br></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'2025-03-09 15:30:30'</span></span><span leaf="">,</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'一臻数据真垃圾,严重拖稿'</span></span><span leaf="">),</span><span leaf=""><br></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'2025-02-08 15:30:30'</span></span><span leaf="">,</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'一臻数据服务很好'</span></span><span leaf="">),</span><span leaf=""><br></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'2025-02-07 15:30:30'</span></span><span leaf="">,</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'一臻数据不处理问题,客服被投诉!'</span></span><span leaf="">),</span><span leaf=""><br></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'2025-02-06 15:30:30'</span></span><span leaf="">,</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'一臻数据断更被暴利催更'</span></span><span leaf="">),</span><span leaf=""><br></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'2025-02-05 15:30:30'</span></span><span leaf="">,</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'投诉一臻数据,严重拖稿'</span></span><span leaf="">),</span><span leaf=""><br></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'2025-03-00 18:30:30'</span></span><span leaf="">,</span><span style="color: #98c379;line-height: 26px;"><span leaf="">'一臻数据真好'</span></span><span leaf="">)</span><span leaf=""><br></span></code></pre> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">结果验证</span></span><span style="display: none;"></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">配置好<span textstyle="" style="font-weight: bold;">钉钉告警-&gt;补齐缺省参数-&gt;初始化完Doris相关表和测试数据</span>后,直接</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">Run</span></code><span leaf="">,就会在钉钉收到对应的</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">AI舆情分析</span></code><span leaf="">通知:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf=""><img src="/upload/cf66c7505e8ffa3a4586d811a233196f.png" class="rich_pages wxw-img" data-ratio="1.0445544554455446" data-w="606"></span></p> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz21vjfvy3pmcr7i1u8oricfoxpvbxjxuj0u3zwdcofpbm8anp19upci2cnaadetotft2pl4riaibmhtog 640?wx_fmt="png&amp;from=appmsg&quot;);&quot;"></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">结语</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"></span></h2> <section style="text-align: center;" nodeleaf=""> <img src="/upload/986e93f69d7b7db4468ce936b7de696b.png" class="rich_pages wxw-img" data-ratio="0.5527777777777778" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003974"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">随着Doris和大模型技术的进步,未来的舆情分析系统将更加智能化。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">我们可以期待这些趋势:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 多模态分析:不仅分析文字,还能识别图片、视频中的情绪和内容</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 预测性分析:不只是被动应对,而是预测可能出现的舆情风险</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 个性化回应:根据不同用户的特点,生成个性化的回应策略</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">舆情分析不再是简单的数据统计,而是企业和组织必备的</span><code style="color: rgb(53, 148, 247);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-color: rgba(27, 31, 35, 0.05);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;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="">社会雷达</span></code><span leaf="">。Doris+DeepSeek的组合将成为这个领域的有力工具。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">AI赋能舆情分析,让危机变成机遇。你的<span textstyle="" style="color: rgb(0, 128, 255);">99行代码</span>,可能就是阻挡舆情风暴的最后一道防线。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">感兴趣的话,下期我们将深入探讨如何使用Doris+AI处理更复杂的多维数据分析场景,敬请期待!</span></p> </section>

3.4KStar 字节跳动扔出王炸LangManus,自动编程+爬虫二合一

作者:微信小助手

<p style="margin-bottom: 0px;"><span leaf="">LangManus 实现了一个分层的多智能体系统,其中有一个主管智能体协调专门的智能体来完成复杂任务. 其中:</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Qwen:提供开源语言模型</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Tavily:提供搜索能力</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Jina:提供网络爬虫技术</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Browser-use:提供浏览器控制能力</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">LangChain:支撑 LLM 交互和链式操作</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">LangGraph:为复杂多智能体编排提供支持</span> </section></li> </ul> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">LangManus 使用三层 LLM 系统,分别用于推理、基础任务和视觉语言任务。</span></p> <figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;"> <span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100001790" data-type="png" style="display: block;margin: 0px auto;max-width: 100%;border-style: none;border-width: 3px;border-color: rgba(0, 0, 0, 0.4);border-radius: 0px;object-fit: fill;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;height: auto !important;" data-ratio="0.7006937561942518" data-w="1009" src="/upload/a773566343b8838dd7097343df854db1.png"></span> </figure> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">系统由以下智能体协同工作:</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">协调员(Coordinator):工作流程的入口点,处理初始交互并路由任务</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">规划员(Planner):分析任务并制定执行策略</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">主管(Supervisor):监督和管理其他智能体的执行</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">研究员(Researcher):收集和分析信息</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">程序员(Coder):负责代码生成和修改</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">浏览器(Browser):执行网页浏览和信息检索</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">汇报员(Reporter):生成工作流结果的报告和总结</span> </section></li> </ul> <p data-tool="mdnice编辑器" style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">核心智能体角色</span></p> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主管(src/prompts/supervisor.md):通过分析请求并确定由哪个专家处理来协调团队并分配任务。负责决定任务完成情况和工作流转换。</span></p> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">研究员(src/prompts/researcher.md):专门通过网络搜索和数据收集来收集信息。使用 Tavily 搜索和网络爬取功能,避免数学计算或文件操作。</span></p> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">程序员(src/prompts/coder.md):专业软件工程师角色,专注于 Python 和 bash 脚本。处理:</span></p> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Python 代码执行和分析</span></p> </section></li> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">Shell 命令执行</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">技术问题解决和实现</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">文件管理员(src/prompts/file_manager.md):处理所有文件系统操作,重点是正确格式化和保存 markdown 格式的内容。</span> </section></li> </ul> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">浏览器(src/prompts/browser.md):网络交互专家,处理:</span></p> </section></li> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">网站导航</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">页面交互(点击、输入、滚动)</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">从网页提取内容</span> </section></li> </ul> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <p style="color: rgb(0, 0, 0);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">提示系统使用模板引擎(src/prompts/template.py)来:</span></p> </section></li> <ul style="list-style-type: disc;margin-top: 8px;margin-bottom: 8px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 25px;padding-right: 0px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">加载特定角色的 markdown 模板</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">处理变量替换(如当前时间、团队成员信息)</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <span leaf="">为每个智能体格式化系统提示</span> </section></li> <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="">每个智能体的提示都在单独的 markdown 文件中定义,这样无需更改底层代码就可以轻松修改行为和职责。</span> </section></li> </ul> </ul>

《用Coze开发智能体》第15篇 详解Coze工作流:调用DeepSeek R1生成思维导图

作者:微信小助手

<section style="font-style: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(10, 10, 10);font-size: 14px;font-variant-ligatures: normal;orphans: 2;widows: 2;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: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">上一篇文章中,我们分享了如何使用扣子搭建工作流,设计特色文案,并且介绍了用智能体调用工作流的方法。那么扣子的工作流到底怎么用,什么场景下需要使用工作流,如何编排工作流,都是很多初学者想了解的内容。</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">工作流</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">是搭建 Bot 智能体的一种非常重要的技能,稍微复杂或比较实用的 Bot 基本上都使用了工作流。本文从工作流概念讲起,然后介绍扣子工作流的结构,最后以一个示例结尾,学习设计一个调用DeepSeek R1生成思维导图的工作流,便于初学者透彻掌握。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/39be828f0f48537f4ca44cd9cd5a22fd.jpg" class="rich_pages wxw-img" data-ratio="0.562962962962963" data-s="300,640" data-type="jpeg" data-w="1080" type="block" data-imgfileid="100006026"> </section> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">内容如下:</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">1.扣子工作流简介</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">2.扣子工作流能解决什么问题?</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">3.扣子工作流的逻辑结构</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">4.扣子工作流的组成模块</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">5.扣子工作流的示例</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">6.总结</span></span></p> <h2 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 16.8px;font-weight: bold;margin: 4em auto 2em;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;display: table;padding: 0px 0.2em;color: rgb(255, 255, 255);background: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">1. 扣子工作流简介</span></span></h2> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">什么是工作流?</span></span></h3> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">工作流(Workflow)是指一系列相互关联的步骤或任务,这些步骤和任务被设计用来完成特定的业务过程或项目。工作流不仅定义了任务的执行顺序,还明确了每个任务的执行者以及相关的条件和规则,从而确保整个流程的顺利进行并最终达成目标。</span></span></p> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">工作流在日常生活中的应用</span></span></h3> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">在我们的日常工作和生活中,工作流无处不在。以下是一些典型的例子:</span></span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">•&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">财务报销流程</span></span></strong><span leaf=""><span textstyle="" style="font-size: 16px;">:包括填写报销单、提交发票、财务审核、分管领导审核等步骤。</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">•&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">软件开发流水线</span></span></strong><span leaf=""><span textstyle="" style="font-size: 16px;">:从代码提交到最终部署的自动化流程。</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">•&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">客服系统流程</span></span></strong><span leaf=""><span textstyle="" style="font-size: 16px;">:从客户咨询到问题解决的服务流程。</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">•&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">企业人力资源管理系统</span></span></strong><span leaf=""><span textstyle="" style="font-size: 16px;">:如请假、出差、报销等审批流程。</span></span> </section></li> </ul> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">扣子工作流的独特之处</span></span></h3> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">扣子的工作流与传统工作流有相似之处,但也具有其独特性。传统工作流可以是手动执行、自动化执行,或两者结合。而扣子的工作流则是一种完全自动化的流程,旨在通过自动执行多个相关步骤来实现可复用的流程。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">一个Bot可以使用多个工作流,根据用户的行为选择并执行不同的工作流,从而提高Bot的灵活性和适应性。扣子工作流支持通过可视化的方式,将&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">插件</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">、</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">大语言模型</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">、</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">代码块</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">等功能进行组合,实现复杂且稳定的业务流程编排,例如旅行规划、报告分析等。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">通过使用工作流,Bot的可用性和可靠性得到了显著提升。工作流不仅可以简化复杂任务的执行,还能确保每个步骤的准确性和一致性。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">说到这里,有一个很自然的疑问:既然Bot是基于大模型搭建的,为什么大模型不直接把相关的任务执行了,告诉我们结果就行?还要引入一个工作流?</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">原因也很简单,虽然现在的大模型比较智能,但是还没有那么智能!大模型(或者说生成式AI)是基于概率来生成内容,这就意味着它并不是每次都能给出符合要求的结果,特别是在以下几种场景下:</span></span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 对返回结果要求比较精确</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 需要调用多个外部工具或插件</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 需要使用代码加工数据或生成响应</span></span> </section></li> </ul> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">工作流是对当前大模型能力不足的一种补偿机制,在大模型智能化程度还不够高的时候,通过人为编排的工作流(注入人的智能),让智能体具有更高的可用性和可靠性,提升用户体验。</span></span><span leaf=""><br></span><span leaf=""><span textstyle="" style="font-size: 16px;">此外,工作流也可以对代码进行&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">模块化</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">,我们将功能,封装在一个工作流中,对外提供统一的接口,这与现代编程语言中,将代码片段设置为&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">函数</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">,或者&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">类</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">,是一样的道理。</span></span></p> <h2 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 16.8px;font-weight: bold;margin: 4em auto 2em;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;display: table;padding: 0px 0.2em;color: rgb(255, 255, 255);background: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">2. 扣子工作流能解决什么问题?</span></span></h2> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">工作流可以有效解决以下问题:</span></span></p> <ol style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: none;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">1.&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">使用提示词无法达到预期效果</span></span></strong> </section></li> </ol> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">在Coze平台上搭建Bot智能体时,通常从编写提示词开始。然而,有时即便我们按照提示词工程的最佳实践编写了结构化且明确的指令,并经过多次迭代优化,仍然无法达到预期效果。这时,工作流就显得尤为重要。例如,在长文本写作(如调研报告)中,涉及到资料收集、写作大纲生成、章节划分、进一步资料收集、章节内容生成,最后到总结的过程。仅依靠提示词,大模型可能难以生成一篇结构合理、内容详实的文章,而工作流可以帮助实现这一目标。</span></span></p> <ol style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: none;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">2.&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">需要多次调用插件或外部工具的场景</span></span></strong> </section></li> </ol> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">大模型具有Function call能力,可以调用外部工具(插件),这在某些场景下非常有用。但是,如果需要调用多个外部工具,且他们具有严格依赖关系时,大模型可能不是每次都能很好地完成目标。例如,以下是一个典型的场景:</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">假设你需要根据一个url,获取网页内容、总结要点、生成思维导图,整个流程需要按照顺序执行以下步骤:</span></span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">•</span></span> </section></li> <ol style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: none;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">1. “网页内容抓取”:使用插件从url获取网页内容</span></span> </section></li> </ol> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">•</span></span> </section></li> <ol style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: none;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">2. “总结要点”:使用大模型总结网页内容要点</span></span> </section></li> </ol> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">•</span></span> </section></li> <ol style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: none;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">3. “生成思维导图”:使用插件生成思维导图</span></span> </section></li> </ol> </ul> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">这个任务可以通过工作流来实现,使得Bot具有更高的可用性和可靠性,提升用户体验。</span></span></p> <ol style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: none;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">3.&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">需要使用代码加工数据或生成响应</span></span></strong> </section></li> </ol> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">大模型虽然能够产出还不错的内容,但是很难对数据进行精确处理,例如:</span></span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 需要对用户输入的数据进行解析、处理和存储</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 需要对数据进行加密、解密和验证</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 需要对数据进行格式化和转换</span></span> </section></li> </ul> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">在这种情况下,可以使用工作流中的&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">代码节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">来解决。例如,我们可以使用工作流中的代码节点对用户输入的数据进行解析和处理,生成随机数,并将其以Json格式返回给用户。</span></span></p> <ol style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: none;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">4.&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">需要根据某个条件执行不同的分支处理</span></span></strong> </section></li> </ol> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">例如:</span></span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 根据用户的选择,来回复不同的内容</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 根据用户的输入,来判断是否需要继续执行工作流</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 根据已经执行的步骤,来判断是否需要跳过某些步骤在某个工作流中,可能需要某个步骤的输出结果来作为下一个步骤的输入,这时可以使用&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">选择器节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">,在执行流程中引入选择分支,根据条件选择不同的执行步骤</span></span> </section></li> </ul> <ol style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: none;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">5.&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">需要在一次用户请求中多次输出消息</span></span></strong> </section></li> </ol> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">大模型的工作方式是一问一答,即根据输入产生输出。在一些比较复杂的应用中,可能需要对一次用户的问题,回复多条消息。例如:</span></span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 需要对用户的输入进行实时确认和回复</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 需要对用户的输入进行详细的解释和回复</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 需要对用户的输入进行分步骤的回复</span></span> </section></li> </ul> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">可以在工作流中使用&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">问答节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">在执行过程中向用户提问问题,使用&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">输出节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">(原名&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">消息节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">)输出消息。</span></span></p> <h2 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 16.8px;font-weight: bold;margin: 4em auto 2em;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;display: table;padding: 0px 0.2em;color: rgb(255, 255, 255);background: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">3. 扣子工作流的逻辑结构</span></span></h2> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">扣子工作流可以简单地理解为一个有向无环图(DAG),其特征是具有唯一的输入节点和输出节点。每个工作流由一系列节点组成,这些节点通过有序连接来实现特定的功能。每个节点都有其输入和输出参数,如下图所示:</span></span></p> <pre data-processed="true" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, " liberation mono, courier new, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 1em;margin: 0px;> <svg aria-roledescription="flowchart-v2" role="graphics-document document" viewbox="0 0 985.171875 174" style="" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="100%"> <g> <marker orient="auto" markerheight="8" markerwidth="8" markerunits="userSpaceOnUse" refy="5" refx="5" viewbox="0 0 10 10" style="fill: #333333;stroke: #333333;"> <path style="stroke-width: 1;stroke-dasharray: 1, 0;" d="M 0 0 L 10 5 L 0 10 z"></path> </marker> <marker orient="auto" markerheight="8" markerwidth="8" markerunits="userSpaceOnUse" refy="5" refx="4.5" viewbox="0 0 10 10" style="fill: #333333;stroke: #333333;"> <path style="stroke-width: 1;stroke-dasharray: 1, 0;" d="M 0 5 L 10 10 L 10 0 z"></path> </marker> <marker orient="auto" markerheight="11" markerwidth="11" markerunits="userSpaceOnUse" refy="5" refx="11" viewbox="0 0 10 10" style="fill: #333333;stroke: #333333;"> <circle style="stroke-width: 1;stroke-dasharray: 1, 0;" r="5" cy="5" cx="5"></circle> </marker> <marker orient="auto" markerheight="11" markerwidth="11" markerunits="userSpaceOnUse" refy="5" refx="-1" viewbox="0 0 10 10" style="fill: #333333;stroke: #333333;"> <circle style="stroke-width: 1;stroke-dasharray: 1, 0;" r="5" cy="5" cx="5"></circle> </marker> <marker orient="auto" markerheight="11" markerwidth="11" markerunits="userSpaceOnUse" refy="5.2" refx="12" viewbox="0 0 11 11" style="fill: #333333;stroke: #333333;"> <path style="stroke-width: 2;stroke-dasharray: 1, 0;" d="M 1,1 l 9,9 M 10,1 l -9,9"></path> </marker> <marker orient="auto" markerheight="11" markerwidth="11" markerunits="userSpaceOnUse" refy="5.2" refx="-1" viewbox="0 0 11 11" style="fill: #333333;stroke: #333333;"> <path style="stroke-width: 2;stroke-dasharray: 1, 0;" d="M 1,1 l 9,9 M 10,1 l -9,9"></path> </marker> <g> <g></g> <g> <path marker-end="url(#mermaid-1740189724036_flowchart-v2-pointEnd)" style="stroke-width: 1px;stroke-dasharray: 0;stroke: #333333;fill: none;" d="M100,87L104.167,87C108.333,87,116.667,87,124.333,87C132,87,139,87,142.5,87L146,87"></path> <path marker-end="url(#mermaid-1740189724036_flowchart-v2-pointEnd)" style="stroke-width: 1px;stroke-dasharray: 0;stroke: #333333;fill: none;" d="M242,87L246.167,87C250.333,87,258.667,87,266.333,87C274,87,281,87,284.5,87L288,87"></path> <path marker-end="url(#mermaid-1740189724036_flowchart-v2-pointEnd)" style="stroke-width: 1px;stroke-dasharray: 0;stroke: #333333;fill: none;" d="M381.239,60L387.264,55.833C393.29,51.667,405.34,43.333,414.865,39.167C424.391,35,431.391,35,434.891,35L438.391,35"></path> <path marker-end="url(#mermaid-1740189724036_flowchart-v2-pointEnd)" style="stroke-width: 1px;stroke-dasharray: 0;stroke: #333333;fill: none;" d="M542.781,35L546.948,35C551.115,35,559.448,35,567.115,35C574.781,35,581.781,35,585.281,35L588.781,35"></path> <path marker-end="url(#mermaid-1740189724036_flowchart-v2-pointEnd)" style="stroke-width: 1px;stroke-dasharray: 0;stroke: #333333;fill: none;" d="M693.172,35L697.339,35C701.505,35,709.839,35,719.156,38.773C728.474,42.546,738.777,50.091,743.928,53.864L749.079,57.637"></path> <path marker-end="url(#mermaid-1740189724036_flowchart-v2-pointEnd)" style="stroke-width: 1px;stroke-dasharray: 0;stroke: #333333;fill: none;" d="M381.239,114L387.264,118.167C393.29,122.333,405.34,130.667,423.898,134.833C442.456,139,467.521,139,492.586,139C517.651,139,542.716,139,558.749,139C574.781,139,581.781,139,585.281,139L588.781,139"></path> <path marker-end="url(#mermaid-1740189724036_flowchart-v2-pointEnd)" style="stroke-width: 1px;stroke-dasharray: 0;stroke: #333333;fill: none;" d="M693.172,139L697.339,139C701.505,139,709.839,139,719.156,135.227C728.474,131.454,738.777,123.909,743.928,120.136L749.079,116.363"></path> <path marker-end="url(#mermaid-1740189724036_flowchart-v2-pointEnd)" style="stroke-width: 1px;stroke-dasharray: 0;stroke: #333333;fill: none;" d="M835.172,87L839.339,87C843.505,87,851.839,87,859.505,87C867.172,87,874.172,87,877.672,87L881.172,87"></path> </g> <g> <g style="background-color: rgba(232,232,232, 0.8);text-align: center;"> <g transform="translate(0, 0)" style=""> <foreignobject height="0" width="0"> <p><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);background-color: rgba(232, 232, 232, 0.8);text-align: center;"><span leaf=""></span></span></p> </foreignobject> </g> </g> <g style="background-color: rgba(232,232,232, 0.8);text-align: center;"> <g transform="translate(0, 0)" style=""> <foreignobject height="0" width="0"> <p><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);background-color: rgba(232, 232, 232, 0.8);text-align: center;"><span leaf=""></span></span></p> </foreignobject> </g> </g> <g style="background-color: rgba(232,232,232, 0.8);text-align: center;"> <g transform="translate(0, 0)" style=""> <foreignobject height="0" width="0"> <p><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);background-color: rgba(232, 232, 232, 0.8);text-align: center;"><span leaf=""></span></span></p> </foreignobject> </g> </g> <g style="background-color: rgba(232,232,232, 0.8);text-align: center;"> <g transform="translate(0, 0)" style=""> <foreignobject height="0" width="0"> <p><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);background-color: rgba(232, 232, 232, 0.8);text-align: center;"><span leaf=""></span></span></p> </foreignobject> </g> </g> <g style="background-color: rgba(232,232,232, 0.8);text-align: center;"> <g transform="translate(0, 0)" style=""> <foreignobject height="0" width="0"> <p><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);background-color: rgba(232, 232, 232, 0.8);text-align: center;"><span leaf=""></span></span></p> </foreignobject> </g> </g> <g style="background-color: rgba(232,232,232, 0.8);text-align: center;"> <g transform="translate(0, 0)" style=""> <foreignobject height="0" width="0"> <p><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);background-color: rgba(232, 232, 232, 0.8);text-align: center;"><span leaf=""></span></span></p> </foreignobject> </g> </g> <g style="background-color: rgba(232,232,232, 0.8);text-align: center;"> <g transform="translate(0, 0)" style=""> <foreignobject height="0" width="0"> <p><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);background-color: rgba(232, 232, 232, 0.8);text-align: center;"><span leaf=""></span></span></p> </foreignobject> </g> </g> <g style="background-color: rgba(232,232,232, 0.8);text-align: center;"> <g transform="translate(0, 0)" style=""> <foreignobject height="0" width="0"> <p><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);background-color: rgba(232, 232, 232, 0.8);text-align: center;"><span leaf=""></span></span></p> </foreignobject> </g> </g> </g> <g> <g transform="translate(54, 87)"> <rect height="54" width="92" y="-27" x="-46" style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <g transform="translate(-16, -12)" style=""> <rect style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <foreignobject height="24" width="32"> <section xmlns="http://www.w3.org/1999/xhtml" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: table-cell;white-space: nowrap;line-height: 1.5;max-width: 200px;text-align: center;"> <span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);"><span leaf=""><span textstyle="" style="font-size: 16px;">输入</span></span></span> </section> </foreignobject> </g> </g> <g transform="translate(196, 87)"> <rect height="54" width="92" y="-27" x="-46" style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <g transform="translate(-16, -12)" style=""> <rect style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <foreignobject height="24" width="32"> <section xmlns="http://www.w3.org/1999/xhtml" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: table-cell;white-space: nowrap;line-height: 1.5;max-width: 200px;text-align: center;"> <span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);"><span leaf=""><span textstyle="" style="font-size: 16px;">开始</span></span></span> </section> </foreignobject> </g> </g> <g transform="translate(342.1953125, 87)"> <rect height="54" width="100.390625" y="-27" x="-50.1953125" style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <g transform="translate(-20.1953125, -12)" style=""> <rect style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <foreignobject height="24" width="40.390625"> <section xmlns="http://www.w3.org/1999/xhtml" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: table-cell;white-space: nowrap;line-height: 1.5;max-width: 200px;text-align: center;"> <span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);"><span leaf=""><span textstyle="" style="font-size: 16px;">节点1</span></span></span> </section> </foreignobject> </g> </g> <g transform="translate(492.5859375, 35)"> <rect height="54" width="100.390625" y="-27" x="-50.1953125" style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <g transform="translate(-20.1953125, -12)" style=""> <rect style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <foreignobject height="24" width="40.390625"> <section xmlns="http://www.w3.org/1999/xhtml" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: table-cell;white-space: nowrap;line-height: 1.5;max-width: 200px;text-align: center;"> <span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);"><span leaf=""><span textstyle="" style="font-size: 16px;">节点2</span></span></span> </section> </foreignobject> </g> </g> <g transform="translate(642.9765625, 35)"> <rect height="54" width="100.390625" y="-27" x="-50.1953125" style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <g transform="translate(-20.1953125, -12)" style=""> <rect style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <foreignobject height="24" width="40.390625"> <section xmlns="http://www.w3.org/1999/xhtml" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: table-cell;white-space: nowrap;line-height: 1.5;max-width: 200px;text-align: center;"> <span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);"><span leaf=""><span textstyle="" style="font-size: 16px;">节点3</span></span></span> </section> </foreignobject> </g> </g> <g transform="translate(789.171875, 87)"> <rect height="54" width="92" y="-27" x="-46" style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <g transform="translate(-16, -12)" style=""> <rect style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <foreignobject height="24" width="32"> <section xmlns="http://www.w3.org/1999/xhtml" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: table-cell;white-space: nowrap;line-height: 1.5;max-width: 200px;text-align: center;"> <span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);"><span leaf=""><span textstyle="" style="font-size: 16px;">结束</span></span></span> </section> </foreignobject> </g> </g> <g transform="translate(642.9765625, 139)"> <rect height="54" width="100.390625" y="-27" x="-50.1953125" style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <g transform="translate(-20.1953125, -12)" style=""> <rect style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <foreignobject height="24" width="40.390625"> <section xmlns="http://www.w3.org/1999/xhtml" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: table-cell;white-space: nowrap;line-height: 1.5;max-width: 200px;text-align: center;"> <span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);"><span leaf=""><span textstyle="" style="font-size: 16px;">节点4</span></span></span> </section> </foreignobject> </g> </g> <g transform="translate(931.171875, 87)"> <rect height="54" width="92" y="-27" x="-46" style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <g transform="translate(-16, -12)" style=""> <rect style="fill: #ECECFF;stroke: #9370DB;stroke-width: 1px;"></rect> <foreignobject height="24" width="32"> <section xmlns="http://www.w3.org/1999/xhtml" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: table-cell;white-space: nowrap;line-height: 1.5;max-width: 200px;text-align: center;"> <span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));fill: rgb(51, 51, 51);color: rgb(51, 51, 51);"><span leaf=""><span textstyle="" style="font-size: 16px;">输出</span></span></span> </section> </foreignobject> </g> </g> </g> </g> </g> </svg></pre> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">图中展示的是一个示例工作流结构,并不代表所有工作流都包含这些节点和路径。最简单的工作流可能仅包含一个开始节点和一个结束节点。</span></span></p> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">唯一输入与唯一输出</span></span></h3> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">在工作流中,“唯一输入”和“唯一输出”指的是工作流整体上有一个入口和一个出口。这并不意味着工作流只能接受一个输入参数或只能产生一个输出结果。实际上,扣子工作流可以处理多个输入参数,并生成多个输出结果。这样的设计确保了工作流的灵活性和扩展性,能够适应复杂的业务需求。</span></span></p> <h2 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 16.8px;font-weight: bold;margin: 4em auto 2em;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;display: table;padding: 0px 0.2em;color: rgb(255, 255, 255);background: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">4. 扣子工作流的组成模块</span></span></h2> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">扣子工作流是由多个节点组成的有向无环图,图形化的工作流可以帮助你快速地设计和实现复杂的业务逻辑。下面是创建工作流时默认打开的页面:</span></span></p> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/5861525feb0eb98c9715eb4bfbf212e3.png" alt="截屏2025-02-21 20.21.19.png" class="rich_pages wxw-img" data-ratio="0.29074074074074074" data-type="png" data-w="1080" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: block;vertical-align: middle;max-width: 100%;height: auto;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size: 14px;margin: 0.1em auto 0.5em;border-radius: 4px; title="null" data-imgfileid="100006016"></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">开始节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">用于开启触发一个工作流,而&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">结束节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">用于输出工作流的结果。</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">开始节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">和&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">结束节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">是每个工作流中固定且唯一的节点之外,左侧其它节点都是可以任意添加的。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">工作流由多个节点组成,包括开始节点、结束节点、插件节点、大模型节点、代码节点、选择器节点、问答节点和输出节点等,下面将简要介绍这些节点的作用。</span></span></p> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/da433e0a3f3c3bb652f9d2af27c595f0.png" alt="image.png" class="rich_pages wxw-img" data-ratio="1.3257575757575757" data-type="png" data-w="660" style="box-sizing:border-box;border-width:0px;border-style:solid;border-color:hsl(var(--border));display:block;vertical-align:middle;max-width:100%;height:449px;text-align:left;line-height:1.75;font-family:-apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size:14px;margin:0.1em auto 0.5em;border-radius:4px;width:339px; title="null" data-imgfileid="100006018"></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/fa8d178c463bf2408c78b10fa7923be0.png" alt="截屏2025-02-21 20.20.53.png" class="rich_pages wxw-img" data-ratio="1.3404907975460123" data-type="png" data-w="652" style="box-sizing:border-box;border-width:0px;border-style:solid;border-color:hsl(var(--border));display:block;vertical-align:middle;max-width:100%;height:458px;text-align:left;line-height:1.75;font-family:-apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size:14px;margin:0.1em auto 0.5em;border-radius:4px;width:342px; title="null" data-imgfileid="100006015"></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">4.1 开始和结束节点</span></span></h3> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 开始节点</span></span> </section></li> </ul> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">开始节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">是工作流的起始节点,用于设定启动工作流需要的输入信息。开始节点只有输入参数,没有输出参数。开始节点中默认有一个输入参数&nbsp;</span></span><span leaf="" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span textstyle="" style="font-size: 16px;">input</span></span><span leaf=""><span textstyle="" style="font-size: 16px;">,表示用户在本轮对话中输入的原始内容。你也可以按需添加其他参数。</span></span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 结束节点</span></span> </section></li> </ul> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">结束节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">是工作流的最终节点,用于返回工作流运行后的结果。结束节点支持两种返回方式,分别是返回变量和返回文本。</span></span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 返回变量</span></span> </section></li> </ul> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">返回变量模式</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">下,工作流运行结束后会以 JSON 格式输出所有返回参数,适用于工作流绑定卡片或作为子工作流的场景。如果工作流直接绑定了智能体,对话中触发了工作流时,大模型会自动总结 JSON 格式的内容,并以自然语言回复用户。</span></span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 返回文本</span></span> </section></li> </ul> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">返回文本模式</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">下,工作流运行结束后,智能体中的模型将直接使用指定的内容回复对话。回答内容中支持引用输出参数,也可以设置流式输出。</span></span></p> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">4.2 大模型节点</span></span></h3> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">大模型节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">是扣子提供的基础节点之一,可以在该节点使用大语言模型处理任务。</span></span></p> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">节点说明</span></span></h4> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">大模型节点可以调用大型语言模型,根据输入参数和提示词生成回复,通常用于执行文本生成任务,例如文案制作、文本总结、文章扩写等。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">大模型节点依赖大语言模型的语言理解和生成能力,可以处理复杂的自然语言处理任务,你可以根据业务场景的需求选择不同的模型,并配置提示词来定义模型的人设和回复风格。为了更精准地控制模型生成的结果,你还可以在大模型节点中设置模型的参数,从而影响模型回复的文本长度、内容的多样性等。</span></span></p> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">配置大模型节点</span></span></h4> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">*技能</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">支持为大模型节点配置技能,添加插件、工作流或知识库,扩展模型能力的边界。大模型节点运行时,会根据用户提示词自动调用插件、工作流或知识库,综合各类信息输入后输出回复。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">配置技能后,大模型节点的能力更接近一个独立运行的智能体,可以自动进行意图识别,并判断调用技能的时机和方式,大幅度提高此节点的文本处理能力和文本生成效果,简化工作流的节点编排。例如用户需求是某地区的穿搭推荐,通常需要先通过插件节点查询某地天气,再由模型节点根据天气情况生成穿搭推荐,现在你可以直接在大模型节点添加查询天气的插件,大模型会自动调用插件,查询天气并推荐穿搭。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">*模型</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">选择要使用的模型。此节点的输出内容质量很大程度上受模型能力的影响,建议根据实际业务场景选择模型。可选的模型范围取决于当前的账号类型,基础版账号可以使用默认的几类模型,且存在对话数量限制,专业版账号可以使用火山引擎方舟平台的模型。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">你还可以单击配置图标,调整模型配置。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">*输入</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">需要添加到提示词中的动态内容。系统提示词和用户提示词中支持引用输入参数,实现动态调整的效果。添加输入参数时需要设置参数名和变量值,其中变量值支持设置为固定值或引用上游节点的输出参数。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">在多轮对话场景中,你还可以开启智能体对话历史。执行此节点时,扣子会将智能体与当前用户的最近多条对话记录和提示词一起传递给大模型,以供大模型参考上下文语境,生成符合当前对话场景的回复。一问一答场景下通常无需开启此功能。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">*系统提示词</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">模型的系统提示词,用于指定人设和回复风格。支持直接插入提示词库中的提示词模版、插入团队资源库下已创建的提示词,也可以自行编写提示词。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">编写系统提示词时,可以引用输入参数中的变量、已经添加到大模型节点的技能,例如插件工具、工作流、知识库,实现提示词的高效编写。例如{{variable}}表示直接引用变量,{{变量名.子变量名}}表示引用 JSON 的子变量,{{变量名[数组索引]}}表示引用数组中的某个元素。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">*用户提示词</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">模型的用户提示词是用户在本轮对话中的输入,用于给模型下达最新的指令或问题。用户提示词同样可以引用输入参数中的变量。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">*输出</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">指定此节点输出的内容格式与输出的参数。输出格式支持设置为:</span></span></p> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">•&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">文本</span></span></strong><span leaf=""><span textstyle="" style="font-size: 16px;">:纯文本格式。此时大模型节点只有一个输出参数,参数值为模型回复的文本内容。</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">•&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">Markdown</span></span></strong><span leaf=""><span textstyle="" style="font-size: 16px;">:Markdown 格式。此时大模型节点只有一个输出参数,参数值为模型回复的文本内容。</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">•&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">JSON</span></span></strong><span leaf=""><span textstyle="" style="font-size: 16px;">:标准 JSON 格式。你可以直接导入一段 JSON 样例,系统会根据样例格式自动设置输出参数的结构,也可以直接添加多个参数并设置参数类型。</span></span> </section></li> </ul> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">参数的名称和描述有助于模型在参数中正确返回匹配的内容。当存在多个输出参数时,建议为输出参数指定有意义的名称,并设置描述信息。例如用于改写 Query 的模型节点,可以设置输出参数为 new_query,描述是改写后的 Query,另一个参数为 reason,描述是改写原因。</span></span></p> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">异常设置</span></span></h4><span leaf=""><span textstyle="" style="font-size: 16px;">大模型节点支持异常忽略功能。开启此功能后,如果试运行工作流时此节点运行失败,工作流不会中断,而是继续运行后续下游节点。如果下游节点引用了此节点的输出内容,则使用此节点预先配置的默认输出内容。</span></span><span leaf=""><br></span> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/de44ee589da2ef3600574940f03d0c42.png" alt="截屏2025-02-22 09.33.25.png" class="rich_pages wxw-img" data-ratio="0.9632352941176471" data-type="png" data-w="544" style="box-sizing:border-box;border-width:0px;border-style:solid;border-color:hsl(var(--border));display:block;vertical-align:middle;max-width:100%;height:172px;text-align:left;line-height:1.75;font-family:-apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size:14px;margin:0.1em auto 0.5em;border-radius:4px;width:180px; title="null" data-imgfileid="100006014"></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">大模型节点配置技能,和直接使用插件等技能节点有什么区别?</span></span></h4> <ul style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: circle;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 大模型节点配置技能时,模型会根据用户的 Query 自动判断调用技能的时机与方式、判断执行技能时传递给技能的输入,整体流程更加灵活,是模型 Function call 能力的直接体现。</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">• 直接使用插件等技能节点时,工作流是开发者人工设计并配置的执行流程,调用技能的时机和方式是固定的,技能的输入也是开发者的指定输入内容,如果编排合理,相对于模型配置技能的场景整体效果更加稳定。</span></span> </section></li> </ul> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">4.3 插件节点</span></span></h3> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">插件节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">用于在工作流中调用插件,运行指定的工具。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">插件是一系列工具的集合,每个工具都是一个可调用的 API。商店中的上架插件、个人创建的插件,以节点形式被集成到工作流中,拓展智能体的能力边界。</span></span></p> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">输入与输出</span></span></h4> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">插件节点的输入和输出结构取决于插件工具定义的输入输出结构,不支持自定义设置。在插件节点中你需要为必选的输入参数指定数据来源,支持设置为固定值或引用上游节点的输出参数。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">插件节点运行时,会调用工具处理输入参数,并根据工具定义输出处理后的数据。你可以在输出区域右上角单击查看示例,查看输出参数的详细说明、完整的输出示例。</span></span></p> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">模拟集</span></span></h4> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/d5f96926b7648deb1fe2cb9ccd907882.png" class="rich_pages wxw-img" data-ratio="1.0262172284644195" data-type="png" data-w="534" style="box-sizing:border-box;border-width:0px;border-style:solid;border-color:hsl(var(--border));display:block;vertical-align:middle;max-width:100%;height:197px;text-align:left;line-height:1.75;font-family:-apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size:14px;margin:0.1em auto 0.5em;border-radius:4px;width:192px; title="null" data-imgfileid="100006017"></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">试运行工作流时,插件节点的输出默认使用真实的输出数据,你也可以选择使用模拟集的数据。模拟集是插件的模拟输出结果,每次试运行工作流时无需调用插件,直接使用数据集的数据作为后续节点的输入。支持自定义设置或 AI 自动生成模拟集。</span></span></p> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">异常设置</span></span></h4> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">插件节点支持忽略异常功能。开启此功能后,如果试运行工作流时此节点运行失败,工作流不会中断,而是继续运行后续下游节点。如果下游节点引用了此节点的输出内容,则使用此节点预先配置的默认输出内容。</span></span></p> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">4.4 工作流节点</span></span></h3> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">为了实现更复杂的功能组合,扣子提供了&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">工作流节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">,实现工作流嵌套工作流的效果。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">在一个工作流中,你可以将另一个工作流作为其中的一个步骤或节点,实现复杂任务的自动化。例如将常用的、标准化的任务处理流程封装为不同的子工作流,并在主工作流的不同分支内调用这些子工作流执行对应的操作。工作流嵌套可实现复杂任务的模块化拆分和处理,使工作流编排逻辑更加灵活、清晰、更易于管理。</span></span></p> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">4.5 输出节点</span></span></h3> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">输出节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">(原名&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">消息节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">)用于在工作流执行过程中输出指定的消息内容。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">通常情况下,工作流会在执行完毕后通过结束节点输出最终的执行结果。当工作流处理流程较长、运行时间较久时,开发者可以在工作流中添加输出节点,临时输出一段消息,避免用户等待时间过长、放弃对话。例如提示用户任务正在执行中,建议用户耐心等待。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">输出节点也可以用于输出工作流的中间数据,下一篇文章会展示一个示例,把工作流中间生成的&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">思维导图文本</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">,通过输出节点反馈给用户。</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">输出节点支持流式和非流式两种模式,同时支持绑定卡片,展示丰富的交互效果,提升对话过程的用户体验。</span></span></p> <h2 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 16.8px;font-weight: bold;margin: 4em auto 2em;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;display: table;padding: 0px 0.2em;color: rgb(255, 255, 255);background: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">5.扣子工作流的示例</span></span></h2> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">根据上面介绍的知识,我们设计一个工作流,实现的功能是:根据用户输入的网址url获取网页的内容,对网页内容进行分析,总结主要观点,然后生成思维导图,</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: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">这个工作流可以被分解成3个步骤:</span></span></p> <ol style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));list-style: none;margin: 0px;padding: 0px 0px 0px 1em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;color: rgb(63, 63, 63); class="list-paddingleft-1"> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">1.&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">读取url对应的网页内容</span></span></strong><span leaf=""><span textstyle="" style="font-size: 16px;">:使用插件&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">LinkReaderPlugin</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">&nbsp;读取url对应的网页内容。</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">2.&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">总结内容要点</span></span></strong><span leaf=""><span textstyle="" style="font-size: 16px;">:使用大模型&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">DeepSeek-R1</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">&nbsp;对网页内容进行分析,总结要点。</span></span> </section></li> <li style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;text-indent: -1em;display: block;margin: 0.2em 8px;color: rgb(63, 63, 63);> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">3.&nbsp;</span></span><strong style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-weight: bold;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: inherit;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">将要点生成思维导图</span></span></strong><span leaf=""><span textstyle="" style="font-size: 16px;">:使用插件&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">generateTreeMind</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">&nbsp;将要点生成思维导图。</span></span> </section></li> </ol> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">下面逐步完成这个工作流的创建。</span></span></p> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">第一步 搭建工作流</span></span></h3> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">参考上节课内容,搭建工作流的基本逻辑流程,其中包括三个关键节点:</span></span></p> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">1. 链接读取插件&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">LinkReaderPlugin</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">,命名为&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">获取网页内容</span></span></code></h4> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">2. 大模型节点,命名为&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">生成思维导图文本</span></span></code></h4> <h4 style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-size: 14px;font-weight: bold;margin: 2em 8px 0.5em;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;color: rgb(15, 76, 129);><span leaf=""><span textstyle="" style="font-size: 16px;">3. TreeMind树图插件&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">generateTreeMind</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">,命名为&nbsp;</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">生成思维导图</span></span></code></h4><span leaf=""><span textstyle="" style="font-size: 16px;">&nbsp; &nbsp; &nbsp; &nbsp;</span></span> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/bc511a14156cd8ab2865f5acdbf35778.png" alt="截屏2025-02-21 21.28.56.png" class="rich_pages wxw-img" data-ratio="0.3472222222222222" data-type="png" data-w="1080" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: block;vertical-align: middle;max-width: 100%;height: auto;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size: 14px;margin: 0.1em auto 0.5em;border-radius: 4px; title="null" data-imgfileid="100006022"></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">第二步 配置大模型节点</span></span></h3><span leaf=""><span textstyle="" style="font-size: 16px;">大模型节点的模型,设置为</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">DeepSeek-R1 工具调用</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">。</span></span><span leaf=""><br></span><span leaf=""><span textstyle="" style="font-size: 16px;">设置</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">系统提示词</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">为:</span></span><span leaf=""><br></span> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/2d68163cf944891c10d566676e89f736.png" alt="截屏2025-02-21 21.35.09.png" class="rich_pages wxw-img" data-ratio="1.9555555555555555" data-type="png" data-w="540" style="box-sizing:border-box;border-width:0px;border-style:solid;border-color:hsl(var(--border));display:block;vertical-align:middle;max-width:100%;height:366px;text-align:left;line-height:1.75;font-family:-apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size:14px;margin:0.1em auto 0.5em;border-radius:4px;width:187px; title="null" data-imgfileid="100006020"></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure> <pre style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;margin: 10px 8px;color: rgb(201, 209, 217);background: rgb(13, 17, 23);text-align: left;line-height: 1.5;overflow-x: auto;border-radius: 8px;padding: 0px !important;><span hidden style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: flex;padding: 10px 14px 0px;"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" width="45px" height="13px" viewbox="0 0 450 130"> <ellipse cx="50" cy="65" rx="50" ry="52" stroke="rgb(220,60,54)" stroke-width="2" fill="rgb(237,108,96)"></ellipse><ellipse cx="225" cy="65" rx="50" ry="52" stroke="rgb(218,151,33)" stroke-width="2" fill="rgb(247,193,81)"></ellipse><ellipse cx="400" cy="65" rx="50" ry="52" stroke="rgb(27,161,37)" stroke-width="2" fill="rgb(100,200,86)"></ellipse> </svg></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: Menlo, " operator mono, consolas, monaco, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;display: -webkit-box;padding: 0.5em 1em 1em;overflow-x: auto;text-indent: 0px;text-align: left;line-height: 1.75;margin: 0px;white-space: nowrap;><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(139, 148, 158);"><span leaf=""><span textstyle="" style="font-size: 16px;"># 角色</span></span></span><span leaf=""><br></span><span leaf=""><span textstyle="" style="font-size: 16px;">你是一个专业的思维导图生成助手,能够精准分析输入内容{{</span></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(255, 166, 87);"><span leaf=""><span textstyle="" style="font-size: 16px;">input</span></span></span><span leaf=""><span textstyle="" style="font-size: 16px;">}},并将其转化为适合TreeMind使用的文本格式。</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(139, 148, 158);"><span leaf=""><span textstyle="" style="font-size: 16px;">## 技能</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(139, 148, 158);"><span leaf=""><span textstyle="" style="font-size: 16px;">### 技能 1: 生成思维导图文本</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(121, 192, 255);"><span leaf=""><span textstyle="" style="font-size: 16px;">1.</span></span></span><span leaf=""><span textstyle="" style="font-size: 16px;">&nbsp;当用户提供网页内容时,仔细分析内容结构和要点。</span></span><span leaf=""><br></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(121, 192, 255);"><span leaf=""><span textstyle="" style="font-size: 16px;">2.</span></span></span><span leaf=""><span textstyle="" style="font-size: 16px;">&nbsp;按照TreeMind所需的格式,将网页内容转化为清晰、有条理的文本,突出关键信息和层级关系。</span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(139, 148, 158);"><span leaf=""><span textstyle="" style="font-size: 16px;">## 限制:</span></span></span><span leaf=""><br></span><span leaf=""><span textstyle="" style="font-size: 16px;">- 仅围绕网页内容进行思维导图文本的生成,不处理与网页内容无关的任务。</span></span><span leaf=""><br></span><span leaf=""><span textstyle="" style="font-size: 16px;">- 生成的文本必须符合TreeMind的格式要求。&nbsp;</span></span></code></pre> <h3 style="box-sizing: border-box;border-width: 0px 0px 0px 3px;border-style: solid;border-left-color: rgb(15, 76, 129);font-size: 15.4px;font-weight: bold;margin: 2em 8px 0.75em 0px;text-align: left;line-height: 1.2;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;padding-left: 8px;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">第三步 测试工作流</span></span></h3> <p style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));margin: 1.5em 8px;text-align: justify;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-size: 14px;letter-spacing: 0.1em;color: rgb(63, 63, 63);><span leaf=""><span textstyle="" style="font-size: 16px;">输入Coze平台</span></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 12.6px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;><span leaf=""><span textstyle="" style="font-size: 16px;">大模型节点</span></span></code><span leaf=""><span textstyle="" style="font-size: 16px;">的文档链接url</span></span></p> <pre style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, yahei, arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;margin: 10px 8px;color: rgb(201, 209, 217);background: rgb(13, 17, 23);text-align: left;line-height: 1.5;overflow-x: auto;border-radius: 8px;padding: 0px !important;><span hidden style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: flex;padding: 10px 14px 0px;"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" width="45px" height="13px" viewbox="0 0 450 130"> <ellipse cx="50" cy="65" rx="50" ry="52" stroke="rgb(220,60,54)" stroke-width="2" fill="rgb(237,108,96)"></ellipse><ellipse cx="225" cy="65" rx="50" ry="52" stroke="rgb(218,151,33)" stroke-width="2" fill="rgb(247,193,81)"></ellipse><ellipse cx="400" cy="65" rx="50" ry="52" stroke="rgb(27,161,37)" stroke-width="2" fill="rgb(100,200,86)"></ellipse> </svg></span><code style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));font-family: Menlo, " operator mono, consolas, monaco, monospace;font-feature-settings: normal;font-variation-settings: normal;font-size: 14px;display: -webkit-box;padding: 0.5em 1em 1em;overflow-x: auto;text-indent: 0px;text-align: left;line-height: 1.75;margin: 0px;white-space: nowrap;><span leaf=""><span textstyle="" style="font-size: 16px;">https://www.coze.cn/</span></span><span style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));color: rgb(255, 166, 87);"><span leaf=""><span textstyle="" style="font-size: 16px;">open</span></span></span><span leaf=""><span textstyle="" style="font-size: 16px;">/docs/guides/llm_node</span></span></code></pre> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/ce0555f6ec27b63e5f23f02bd70c07fb.png" alt="截屏2025-02-21 21.43.31.png" class="rich_pages wxw-img" data-ratio="0.24259259259259258" data-type="png" data-w="1080" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: block;vertical-align: middle;max-width: 100%;height: auto;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size: 14px;margin: 0.1em auto 0.5em;border-radius: 4px; title="null" data-imgfileid="100006021"></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/78cf309b1795f0cd6fe9dd48d9d676bd.png" alt="截屏2025-02-21 21.45.45.png" class="rich_pages wxw-img" data-ratio="0.5212962962962963" data-type="png" data-w="1080" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: block;vertical-align: middle;max-width: 100%;height: auto;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size: 14px;margin: 0.1em auto 0.5em;border-radius: 4px; title="null" data-imgfileid="100006023"></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/9548c0bb69ddff307fca19ead91188d3.png" alt="截屏2025-02-21 21.46.02.png" class="rich_pages wxw-img" data-ratio="0.7631578947368421" data-type="png" data-w="532" style="box-sizing:border-box;border-width:0px;border-style:solid;border-color:hsl(var(--border));display:block;vertical-align:middle;max-width:100%;height:253px;text-align:left;line-height:1.75;font-family:-apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size:14px;margin:0.1em auto 0.5em;border-radius:4px;width:332px; title="null" data-imgfileid="100006019"></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure><span leaf=""><span textstyle="" style="font-size: 16px;">拷贝输出变量中的图片链接,用浏览器打开:</span></span><span leaf=""><br></span> <figure 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;color: rgb(63, 63, 63);> <span leaf=""><img src="/upload/8c8fab946b48479f9af859aa0095883a.jpg" alt="treemind.jpeg" class="rich_pages wxw-img" data-ratio="1.6185344827586208" data-type="jpeg" data-w="928" style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));display: block;vertical-align: middle;max-width: 100%;height: auto;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, " helvetica neue, pingfang sc, hiragino sans gb, microsoft yahei ui, microsoft yahei, arial, sans-serif;font-size: 14px;margin: 0.1em auto 0.5em;border-radius: 4px; title="null" data-imgfileid="100006025"><span textstyle="" style="font-size: 16px;">下一篇文章,我们继续优化这个工作流,增加信息输出、错误判断等功能。</span></span> <figcaption style="box-sizing: border-box;border-width: 0px;border-style: solid;border-color: hsl(var(--border));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;font-size: 0.8em;color: rgb(136, 136, 136);></figcaption> </figure> </section>