作者:微信小助手
<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> <section 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 leaf="" 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;">前一阵介绍的使用 DeepSeek-R1 部署的 7b 模型,在电脑本地进行 RAG 问答的简单演示项目,目前收获了 72 个 star,下方视频演示了下升级后的支持多文档上传和多轮问答的功能特性。</span> </section> <section> <span leaf=""><a href="https://mp.weixin.qq.com/s?__biz=MzI1ODIxNjk1OQ==&mid=2649609187&idx=1&sn=e0f42140d7045e12dd8c3b44e288d152&scene=21#wechat_redirect" textvalue="无需联网!DeepSeek-R1+本地化RAG,打造私有智能文档助手" data-itemshowtype="0" target="_blank" linktype="text" data-linktype="2">无需联网!DeepSeek-R1+本地化RAG,打造私有智能文档助手</a></span> </section> <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=rjD5jyTuFrIpZ2ibE8T7YmwgiahniaXswqz2iaFfONw2FFOrQz3FY8J9hR8RjL2trHdCc1ZrUE7gwLJcRuI7lh3sfJQsBP7ZLXPciaf6qaiaiazNyeC52qaeqEtuA&token=2lt8WBSnjTkcgCtcCAVJON6ib5MHCcZhgYd1MTpdVQWrHPyOJ43OWj3cZcOiawCe2vpep4LoTU1QmPJFk0zI7VH9O0MBqSTQTTkNsOdvIIxicHAu0jhePImIaILdoicXZq74YTs3UJeylGflAwyxFdeVowJReLraEauyJM3W4TwYibPc&idx=1&hy=SH&m=&scene=2&uzid=2" data-headimgurl="http://wx.qlogo.cn/finderhead/Q3auHgzwzM6zZVsTeA1zmzicJIJ9AobllQDxOo7zcQuuCicKOKHDdObg/0" data-username="v2_060000231003b20faec8c5e68e1fc3d1c807ef3db07727a507a7dcba522c09cf23bc31ebbf10@finder" data-nickname="韦东东666" data-desc="上期视频介绍的使用DeepSeek-R1部署的7b模型在电脑本地进行RAG问答的项目收获了72个star,这期演示下升级后的支持 多文档上传和多轮问答的功能特性,欢迎使用。 #deepseek #rag #deepseer-r1 " data-nonceid="10672186852840090837" data-width="1624" data-height="1080" data-type="video" data-id="export/UzFfAgtgekIEAQAAAAAAP4wHhgDm9wAAAAstQy6ubaLX4KHWvLEZgBPE8aNcbE0Kd6OJzNPgMIsjXtIt_6jkQ0nXkXrybMjW"></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: 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/da79c45d5bc7daa8a911cc98ca73a924.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.20925925925925926" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125634"> </section> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 14px;color: rgb(178, 178, 178);">当前核心代码流程</span></span> </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: 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=""><img src="/upload/074b81841adc872bbc48b59e3dfd5af6.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.1796875" data-s="300,640" data-type="png" data-w="1280" type="block" data-imgfileid="502125635"></span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="text-align: center;"><span leaf=""><span textstyle="" style="font-size: 14px;color: rgb(178, 178, 178);">优化后代码逻辑(基于六点优化建议)</span></span></p> <p><span leaf=""><br></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 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></p> <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="">然后,添加 Re-ranking 机制;</span></p> <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></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=""> </span></span></em></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%;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> <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 leaf=""><br></span></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=""> </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="">现有问题:目前使用的是固定大小的分块策略(chunk_size=800),这可能会切分到语义完整的段落</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> <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=""># 示例:基于语义的分块策略</span></code><code><span leaf="">from langchain.text_splitter import SpacyTextSplitter</span></code><code><span leaf=""># 或使用更轻量的</span></code><code><span leaf="">from nltk.tokenize import sent_tokenize</span></code><code><span leaf=""><br></span></code><code><span leaf="">def semantic_chunk(text):</span></code><code><span leaf=""> sentences = sent_tokenize(text)</span></code><code><span leaf=""> chunks = []</span></code><code><span leaf=""> current_chunk = []</span></code><code><span leaf=""> current_length = 0</span></code><code><span leaf=""> </span></code><code><span leaf=""> for sentence in sentences:</span></code><code><span leaf=""> if current_length + len(sentence) > 800:</span></code><code><span leaf=""> chunks.append(" ".join(current_chunk))</span></code><code><span leaf=""> current_chunk = [sentence]</span></code><code><span leaf=""> current_length = len(sentence)</span></code><code><span leaf=""> else:</span></code><code><span leaf=""> current_chunk.append(sentence)</span></code><code><span leaf=""> current_length += len(sentence)</span></code><code><span leaf=""> </span></code><code><span leaf=""> if current_chunk:</span></code><code><span leaf=""> chunks.append(" ".join(current_chunk))</span></code><code><span leaf=""> return chunks</span></code></pre> <p><span leaf=""><br></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> <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 leaf=""><br></span></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=""> </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></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="">实现混合检索:结合关键词检索(BM25)和向量检索添加 Re-ranking 层:使用交叉编码器对检索结果重新排序引入 MMR(Maximum Marginal Relevance)降低结果冗余度 </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="">from rank_bm25 import BM25Okapi</span></code><code><span leaf="">from sentence_transformers import CrossEncoder</span></code><code><span leaf=""><br></span></code><code><span leaf="">def hybrid_search(query, documents, top_k=5):</span></code><code><span leaf=""> # BM25检索</span></code><code><span leaf=""> bm25 = BM25Okapi(documents)</span></code><code><span leaf=""> bm25_scores = bm25.get_scores(query)</span></code><code><span leaf=""> </span></code><code><span leaf=""> # 向量检索(你现有的方案)</span></code><code><span leaf=""> vector_results = COLLECTION.query(...)</span></code><code><span leaf=""> </span></code><code><span leaf=""> # 结果融合</span></code><code><span leaf=""> combined_results = combine_scores(bm25_scores, vector_results)</span></code><code><span leaf=""> </span></code><code><span leaf=""> # Cross-Encoder重排序</span></code><code><span leaf=""> cross_encoder = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')</span></code><code><span leaf=""> reranked_results = cross_encoder.predict([(query, doc) for doc in combined_results])</span></code><code><span leaf=""> </span></code><code><span leaf=""> return sorted(zip(combined_results, reranked_results), key=lambda x: x[1], reverse=True)[:top_k]</span></code></pre> <p><span leaf=""><br></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> <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 leaf=""><br></span></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=""> </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></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> <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="">from spacy import displacy</span></code><code><span leaf="">import networkx as nx</span></code><code><span leaf=""><br></span></code><code><span leaf="">def build_knowledge_graph():</span></code><code><span leaf=""> # 实体提取</span></code><code><span leaf=""> entities = extract_entities(documents)</span></code><code><span leaf=""> </span></code><code><span leaf=""> # 关系抽取</span></code><code><span leaf=""> relationships = extract_relationships(documents)</span></code><code><span leaf=""> </span></code><code><span leaf=""> # 构建图谱</span></code><code><span leaf=""> G = nx.Graph()</span></code><code><span leaf=""> for entity in entities:</span></code><code><span leaf=""> G.add_node(entity)</span></code><code><span leaf=""> for rel in relationships:</span></code><code><span leaf=""> G.add_edge(rel[0], rel[2], relation=rel[1])</span></code><code><span leaf=""> </span></code><code><span leaf=""> return G</span></code><code><span leaf=""><br></span></code><code><span leaf="">def graph_enhanced_search(query, graph):</span></code><code><span leaf=""> # 基于图谱进行查询扩展</span></code><code><span leaf=""> related_entities = get_related_entities(query, graph)</span></code><code><span leaf=""> expanded_query = expand_query(query, related_entities)</span></code><code><span leaf=""> return search(expanded_query)</span></code></pre> <p><span leaf=""><br></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="">4</span></span></em></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 leaf=""><br></span></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=""> </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></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> <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 optimize_context(query, retrieved_chunks):</span></code><code><span leaf=""> # 计算每个chunk的相关性分数</span></code><code><span leaf=""> relevance_scores = calculate_relevance(query, retrieved_chunks)</span></code><code><span leaf=""> </span></code><code><span leaf=""> # 动态调整上下文窗口</span></code><code><span leaf=""> window_size = adaptive_window_size(relevance_scores)</span></code><code><span leaf=""> </span></code><code><span leaf=""> # 合并相邻的相关chunk</span></code><code><span leaf=""> merged_context = merge_relevant_chunks(retrieved_chunks, window_size)</span></code><code><span leaf=""> </span></code><code><span leaf=""> return merged_context</span></code></pre> <p><span leaf=""><br></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="">5</span></span></em></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 leaf=""><br></span></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=""> </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></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> <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 optimize_query(original_query):</span></code><code><span leaf=""> # 查询意图识别</span></code><code><span leaf=""> intent = classify_intent(original_query)</span></code><code><span leaf=""> </span></code><code><span leaf=""> # 查询改写</span></code><code><span leaf=""> rewritten_query = rewrite_query(original_query, intent)</span></code><code><span leaf=""> </span></code><code><span leaf=""> # 查询扩展</span></code><code><span leaf=""> expanded_query = expand_query(rewritten_query)</span></code><code><span leaf=""> </span></code><code><span leaf=""> return expanded_query</span></code></pre> <p><span leaf=""><br></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="">6</span></span></em></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 leaf=""><br></span></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=""> </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></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="">建立检索质量评估指标(MRR, NDCG 等)实现答案质量评估添加用户反馈机制</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 evaluate_system(queries, ground_truth):</span></code><code><span leaf=""> metrics = {</span></code><code><span leaf=""> 'mrr': calculate_mrr(queries, ground_truth),</span></code><code><span leaf=""> 'ndcg': calculate_ndcg(queries, ground_truth),</span></code><code><span leaf=""> 'precision': calculate_precision(queries, ground_truth)</span></code><code><span leaf=""> }</span></code><code><span leaf=""> return metrics</span></code></pre> <section 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 leaf="" 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> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>
作者:微信小助手
<p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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> <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 leaf=""><br></span></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: 1.5em;color: white;border-radius: 10px;background: linear-gradient(to right, rgb(41, 148, 128) 20%, rgb(73, 200, 149) 10%);"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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.5em;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="">DeepSeek-R1 自从1-20号开源/发布十天以来,鲶鱼效应应接不暇,OpenAI o3-mini 也在 10个小时前向免费用户推送。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="502125534" data-ratio="0.3175925925925926" data-s="300,640" src="/upload/2c4533d43655e2f0f07b5805ef81df94.png" data-type="png" data-w="1080" type="block"> </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: justify;line-height: 1.5em;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="">官方开源的版本除了满血的 671b 外,还有 1.5b,7b,8b,14b,32b,70b 六个蒸馏后的尺寸,笔者使用 Ollama 在电脑本地部署了 7b 的模型,在终端中测试了虽然回答没有满血版的那么惊艳,但凑活能用。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/5b8d175eb6aa17c76f73e7cc3499c07e.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.4925925925925926" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125530"> </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: 1.5em;background-color: rgb(238, 253, 247);border-left: 10px solid rgb(73, 200, 149);padding: 16px;border-right: 2px solid rgb(107, 222, 176);letter-spacing: 1px;font-size: 15px;font-family: PingfangSC-LIGHT, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span leaf="">作为一款高阶模型开源,确实要 salute 一下。不过进一步的问题是,我们面对这样的强思维链模型,除了在官网间或 Chat 一下,如何进一步的将其变成工作或生活场景的生产力工具?本篇试图给出一种基于RAG的回答。</span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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=""><br></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: 1.5em;color: white;border-radius: 10px;background: linear-gradient(to right, rgb(41, 148, 128) 40%, rgb(73, 200, 149) 10%);"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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.5em;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="">本篇主要介绍一个本地RAG问答系统的简要示例,项目已开源在github。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/a8ecc4054400e8b42ec26d529568db0d.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.5574074074074075" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125535"> </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: justify;line-height: 1.5em;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></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.5em;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></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.5em;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></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.5em;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></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.5em;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></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.5em;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></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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> <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 leaf=""><br></span></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: 1.5em;color: white;border-radius: 10px;background: linear-gradient(to right, rgb(41, 148, 128) 60%, rgb(73, 200, 149) 10%);"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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.5em;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="">使用 Ollama 部署的 DeepSeek-r1:7b 作为推理模型,通过 Sentence Transformer (all-MiniLM-L6-v2) 将文本向量化后存储到 ChromaDB 向量数据库,使用 LangChain 的文本分割器处理 PDF 文档,最后用 Gradio 构建了一个支持文件上传和流式问答的 Web 交互界面,整个过程都在本地完成,无需连接外部服务。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/44f03e8ccece2663d80886c7a325e86c.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.5574074074074075" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125531"> </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: justify;line-height: 1.5em;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="">📄 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.5em;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="">🧠 基于 DeepSeek-7B 本地大模型</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.5em;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></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.5em;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></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.5em;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="">🖥️ 友好的 Web 交互界面</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.5em;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=""><img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="502125532" data-ratio="0.82265625" data-s="300,640" src="/upload/2c5fc8b8350824bb3cd4710b423ec600.png" data-type="png" data-w="1280" type="block"></span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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> <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 leaf=""><br></span></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: 1.5em;color: white;border-radius: 10px;background: linear-gradient(to right, rgb(41, 148, 128) 80%, rgb(73, 200, 149) 10%);"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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: 1.5em;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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> <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;"><span leaf=""><br></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 1.5em;background: linear-gradient(to right, rgb(26, 149, 165), rgb(38, 198, 218));"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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.5em;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="">Python 3.9+;内存:至少 8GB;显存:至少 4GB(推荐 8GB)</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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> <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;"><span leaf=""><br></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 1.5em;background: linear-gradient(to right, rgb(26, 149, 165), rgb(38, 198, 218));"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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(137, 137, 137);text-align: justify;line-height: 1.5em;box-sizing: border-box !important;overflow-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.5em;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="">git clone https://github.com/weiwill88/Local_Pdf_Chat_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.5em;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="">cd Local_Pdf_Chat_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(137, 137, 137);text-align: justify;line-height: 1.5em;box-sizing: border-box !important;overflow-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.5em;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="">python -m venv rag_env (windows 命令)</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.5em;box-sizing: border-box !important;overflow-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.5em;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="">.\rag_env\Scripts\activate</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.5em;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="">pip install -r requirements.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(137, 137, 137);text-align: justify;line-height: 1.5em;box-sizing: border-box !important;overflow-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="">安装并启动 Ollama 服务</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.5em;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="">ollama pull deepseek-r1:7b</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.5em;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="">ollama serve & </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.5em;box-sizing: border-box !important;overflow-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.5em;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="">python rag_demo.py</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.5em;box-sizing: border-box !important;overflow-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.5em;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="">通常是 http://localhost:17995 上传 PDF 文档(等待处理完成)、在提问区输入问题、查看实时生成的回答</span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="502125533" data-ratio="0.5574074074074075" data-s="300,640" src="/upload/bf6ac3a0dc761fe9f0c17e46649eab12.png" data-type="png" data-w="1080" type="block"> </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(137, 137, 137);text-align: justify;line-height: 1.5em;box-sizing: border-box !important;overflow-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.5em;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="">修改 rag_demo.py 中第 147 行的模型名称可替换为其他支持的模型</span></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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> <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;"><span leaf=""><br></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 1.5em;background: linear-gradient(to right, rgb(26, 149, 165), rgb(38, 198, 218));"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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(43, 43, 43);text-align: justify;line-height: 1.5em;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></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.5em;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="">根据文档类型调整 chunk_size(技术文档建议 800-1200,对话文本建议 400-600)使用滑动窗口重叠策略保持上下文连贯性</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.5em;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></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.5em;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="">结合 BM25+语义检索的混合搜索添加文档元数据过滤(如章节标题)实现结果重排序(Rerank)提升相关性</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.5em;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></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.5em;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="">问题重写(Query Rewriting)查询扩展(Query Expansion)多轮对话上下文管理</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.5em;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></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.5em;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="">使用量化版嵌入模型(如 all-MiniLM-L6-v2)实现向量索引缓存机制采用批处理加速文档处理</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.5em;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></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.5em;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></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;max-width: 100%;min-height: 1em;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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> <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 leaf=""><br></span></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: 1.5em;color: white;border-radius: 10px;background: linear-gradient(to right, rgb(41, 148, 128) 100%, rgb(73, 200, 149) 10%);"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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: 1.5em;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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="">5.1</span></span></em></strong></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;"><span leaf=""><br></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 1.5em;background: linear-gradient(to right, rgb(26, 149, 165), rgb(38, 198, 218));"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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.5em;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;"><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 leaf="">案件证据材料分散在纸质卷宗/邮件/聊天记录中</span><span leaf=""><br></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.5em;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;"><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 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.5em;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="">诉状要素智能填充:输入"劳动仲裁+工伤赔偿"等标签,自动关联《工伤保险条例》第37条及近三年同类型判决赔偿金中位数</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.5em;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></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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="">5.2</span></span></em></strong></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;"><span leaf=""><br></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 1.5em;background: linear-gradient(to right, rgb(26, 149, 165), rgb(38, 198, 218));"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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.5em;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;"><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 leaf="">设备手册包含 2000+页PDF/图纸,故障代码查询耗时>30分钟</span><span leaf=""><br></span><span leaf="">新人无法理解"主轴轴向窜动≤0.01mm"等专业术语的实操标准 </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.5em;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;"><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 leaf="">多模态知识库:设备文档结构化(按故障代码/维护周期/精度标准打标签)</span><span leaf=""><br></span><span leaf="">实操视频片段索引(关联"E02报警"对应的齿轮箱拆装演示)</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.5em;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></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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="">5.3</span></span></em></strong></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;"><span leaf=""><br></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 1.5em;background: linear-gradient(to right, rgb(26, 149, 165), rgb(38, 198, 218));"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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.5em;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;"><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 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.5em;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></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.5em;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;"><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 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.5em;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="">多模态检索:基于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.5em;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></span></p> <p label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="line-height: 1.5em;min-height: 1em;max-width: 100%;white-space: pre-wrap;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-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="">5.4</span></span></em></strong></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;"><span leaf=""><br></span></p> <h3 label="Converted by KNB Formatter from Jason Ng https://knb.im/mp" style="margin-top: -10px;line-height: 1.5em;background: linear-gradient(to right, rgb(26, 149, 165), rgb(38, 198, 218));"><span leaf=""> </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.5em;box-sizing: border-box !important;overflow-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.5em;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;"><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 leaf="">产品知识分散在 100+份 Excel 参数表/PPT培训材料中</span><span leaf=""><br></span><span leaf="">客户咨询"敏感肌精华成分"时,新人需手动比对10+竞品手册 </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.5em;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;"><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 leaf="">商品知识中枢:</span><span leaf=""><br></span><span leaf="">自动提取产品文档中的成分表/适用肤质/禁忌搭配数据</span><span leaf=""><br></span><span leaf="">构建成分冲突库(含酒精成分产品不可与 A 醇类产品叠加使用)</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.5em;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><span leaf=""><br></span><span leaf="">输入"30 岁油皮夏季护肤",推送控油套装+搭配使用顺序+关联满减方案</span><span leaf=""><br></span><span leaf="">实时竞品对比(展示本方产品 B5 泛醇含量高于竞品 3.2%) </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=rjD5jyTuFrIpZ2ibE8T7YmwgiahniaXswqz2TzwdRMV8uoCXYHdg02UcTAR1QicRZ3ArfWjZ0sGiclvppHnIKo35p9FNIXVyNGvnJY8Ua2uPDtV2Z3G2d9G9gibg&token=ic1n0xDG6awicyg3F1jDWcXUYZkB2by5ShCjEMiajqk3QT1XtticBZHCyrxcIATqD0cibk5pvzLcfibrG3Lk83f7VgEYyt3YTq4rDeBDu3mCdP3Mv6pJ7fORibGbnl3qc3vCO0YTTJmIDFYXYFW41XDteXUXBTJwQCnJLPm8tsGJdP6mQA&idx=1&hy=SH&m=&scene=2&uzid=2" data-headimgurl="http://wx.qlogo.cn/finderhead/Q3auHgzwzM6zZVsTeA1zmzicJIJ9AobllQDxOo7zcQuuCicKOKHDdObg/0" data-username="v2_060000231003b20faec8c5e68e1fc3d1c807ef3db07727a507a7dcba522c09cf23bc31ebbf10@finder" data-nickname="韦东东666" data-desc="无需联网!DeepSeek-R1+本地化RAG,打造私有智能文档助手 #deepseek-r1 #deepseek #rag " data-nonceid="16098083432134057862" data-width="1624" data-height="1080" data-type="video" data-id="export/UzFfAgtgekIEAQAAAAAAZHwuAcsTTwAAAAstQy6ubaLX4KHWvLEZgBPEzaM4Ix5uStWJzNPgMIukQr8V1LZHoZWW-z8GNuVk"></mp-common-videosnap> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>
作者:微信小助手
<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;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 leaf="" 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;">看到一个段子说,春节开工以后,中国有 5000 万家企业老板担心会错过 DeepSeek。虽然感觉有点瞎玩梗,但 DeepSeek 无疑已是当下所谓大模型企业应用落地的"房间里的大象"。</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="">不过想想,其实子弹也才刚刚飞了一个月而已。但 DeepSeek R1 这波多尺寸开源,属实是解锁了更多中小微企业做本地部署的可能性。而其中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></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="">另外还有些是可能内部试错完需要进一步外部技术支持,来找我做具体的部署落地。但是个人精力和经验都有限,回绝了大部分。为了让大家少踩一些坑,我找了比较熟悉的制造行业案例,分享一个基于 DeepSeek-R1:14B 与 RAGFlow 框架下定制的机械加工工厂的知识库落地case,供大家参考。</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="">以下,enjoy:</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> <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 leaf=""><br></span></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) 20%,rgb(73, 200, 149) 10%);"><span leaf=""> </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="">某机械加工制造企业,专注于汽车零部件和工程机械配件的精密加工,主要产品包括液压阀体、传动轴、齿轮箱体等核心零部件。年产值约 5000 万元,员工 200 人左右。</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="">1.1</span></span></em></strong></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;"><span leaf=""><br></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=""> </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="">数控加工设备:20 台(包括加工中心、数控车床、数控铣床等)</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="">普通机床:30 台(普通车床、铣床、钻床等)</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="">检测设备:10 台(三坐标、粗糙度仪、投影仪等)</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="">1.2</span></span></em></strong></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;"><span leaf=""><br></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=""> </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="">1.3</span></span></em></strong></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;"><span leaf=""><br></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=""> </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 格式):约 50 份</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="">工艺文件(Word/Excel):约 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="">维修记录(纸质/电子):近 3 年约 1000 条</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="">设备图纸(CAD/图片):约 30 套</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="">1.4</span></span></em></strong></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;"><span leaf=""><br></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=""> </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(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;"><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="">并发使用规模:日常并发 5-10 人</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="">答案准确性:故障诊断、参数查询等场景要求高准确性</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="">响应速度:常规查询 3 秒内响应</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="">1.5</span></span></em></strong></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;"><span leaf=""><br></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=""> </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(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 设备手册、Excel 记录、Word 文档等</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="">资源规划</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="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> <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 leaf=""><br></span></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) 40%,rgb(73, 200, 149) 10%);"><span leaf=""> </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="">2.1</span></span></em></strong></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;"><span leaf=""><br></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=""> </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="">大模型:DeepSeek-R1-14B(开源、性能优秀、工业场景理解深入)</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="">框架:RAGFlow(灵活、易扩展、部署简单)</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=""><img src="/upload/57bd1a3f5fd8e991d3b7ed752adcb9c7.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.6416666666666667" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125638"></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 leaf="" 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 textstyle="" style="font-size: 12px;color: rgb(136, 136, 136);font-weight: normal;">系统整</span></span><span leaf="" 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 textstyle="" style="font-size: 12px;color: rgb(136, 136, 136);font-weight: normal;">体架构图</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="">2.2</span></span></em></strong></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;"><span leaf=""><br></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=""> </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(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="">采用后端优化方案直接扩展 RAGFlow 功能</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="">功能稳定阶段</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(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;"><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%;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> <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 leaf=""><br></span></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) 60%,rgb(73, 200, 149) 10%);"><span leaf=""> </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> <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;"><span leaf=""><br></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=""> </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/0111095b3eaec32624395d8bda351e5d.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.6407407407407407" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125639"> </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(137, 137, 137);text-align: center;line-height: 1.5;box-sizing: border-box !important;overflow-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 textstyle="" style="font-size: 12px;color: rgb(136, 136, 136);font-weight: normal;">知识处理流程图</span></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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">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 leaf="" 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 textstyle="" style="font-weight: bold;">实际案例:</span></span><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 leaf="" 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 textstyle="" style="font-weight: bold;">问题</span></span><span leaf="" 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 textstyle="" style="font-weight: bold;">:</span></span><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 leaf="" 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 textstyle="" style="font-weight: bold;">解决:</span></span><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 leaf="" 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 textstyle="" style="font-weight: bold;">效果:</span></span><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="">故障诊断准确率从原来的 65%提升到 85%</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">Excel 维修记录处理</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 leaf="" 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 textstyle="" style="font-weight: bold;">实际案例:</span></span><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 leaf="" 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 textstyle="" style="font-weight: bold;">问题:</span></span><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><span leaf="" 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 textstyle="" style="font-weight: bold;"> 解决:</span></span><span leaf="" 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></pre> <pre><span leaf="" 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;"><br></span></pre> <pre><span leaf="" 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 textstyle="" style="font-weight: bold;"> 效果:</span>相似案例匹配率提升 40%</span></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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">Word 工艺文件处理</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 leaf="" 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 textstyle="" style="font-weight: bold;">实际案例</span></span><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 leaf="" 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 textstyle="" style="font-weight: bold;">问题:</span></span><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 leaf="" 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 textstyle="" style="font-weight: bold;">解决</span></span><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 leaf="" 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 textstyle="" style="font-weight: bold;">效果:</span></span><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="">工艺参数查询准确率提升至 90%以上</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="">AB 测试方案:</span></span></strong></span></strong></p> <table style="width:567px;"> <thead> <tr> <th data-colwidth="142" width="142"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 16px;">策略</span></span> </section></th> <th data-colwidth="221" width="221"> <section> <span leaf=""><span textstyle="" style="font-size: 16px;">测试组 A(固定分块)</span></span> </section></th> <th data-colwidth="204" width="204"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 16px;">测试组 B(动态分块)</span></span> </section></th> </tr> </thead> <tbody> <tr> <td data-colwidth="142" width="142"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">分块方式</span></span> </section></td> <td data-colwidth="221" width="221"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">固定字符长度</span></span> </section></td> <td data-colwidth="204" width="204"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">基于文档结构</span></span> </section></td> </tr> <tr> <td data-colwidth="142" width="142"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">图文处理</span></span> </section></td> <td data-colwidth="221" width="221"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">分离处理</span></span> </section></td> <td data-colwidth="204" width="204"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">保持对应关系</span></span> </section></td> </tr> <tr> <td data-colwidth="142" width="142"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">表格处理</span></span> </section></td> <td data-colwidth="221" width="221"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">按行拆分</span></span> </section></td> <td data-colwidth="204" width="204"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">完整保留</span></span> </section></td> </tr> <tr> <td data-colwidth="142" width="142"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">上下文</span></span> </section></td> <td data-colwidth="221" width="221"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">固定重叠</span></span> </section></td> <td data-colwidth="204" width="204"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">动态重叠</span></span> </section></td> </tr> </tbody> </table> <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;"><span leaf="">机械故障:A 组→B 组 提升明显</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="">电气故障:A 组→B 组 提升显著</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="">参数类:A 组→B 组 小幅提升</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> <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;"><span leaf=""><br></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=""> </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/06607b00a86c8c879e922d26effaa5de.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.6444444444444445" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125640"> </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(137, 137, 137);text-align: center;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong><strong><span leaf="" style="max-width: 100%;color: rgb(62, 62, 62);line-height: 1.5;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 18px;font-family: PingFangSC-Semibold,sans-serif;"><span textstyle="" style="font-size: 12px;color: rgb(136, 136, 136);font-weight: normal;">知识处理流程图</span></span></strong></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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">基础索引层:</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="">文档 ID 索引:快速定位源文档</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">语义索引层:</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">混合索引策略:</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="">3.3</span></span></em></strong></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;"><span leaf=""><br></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=""> </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> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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></li> </ul> <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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">精确查询通道:</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">语义查询通道:</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">混合查询策略:</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> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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></li> </ul> <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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">专业术语处理</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">上下文增强</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> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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></li> </ul> <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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">故障诊断场景:</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 leaf="" 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 textstyle="" style="font-weight: bold;">问题:</span></span><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 leaf="" 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 textstyle="" style="font-weight: bold;">优化前:</span></span><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 leaf="" 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 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></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 leaf="" 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 textstyle="" style="font-weight: bold;">效果:</span></span><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="">故障解决时间平均缩短 40%</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">工艺参数查询场景</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 leaf="" 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 textstyle="" style="font-weight: bold;">问题:</span></span><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="">新员工查询"45 号钢齿轮轴粗加工参数"</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 leaf="" 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 textstyle="" style="font-weight: bold;">优化前:</span></span><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 leaf="" 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 textstyle="" style="font-weight: bold;">优</span></span><span leaf="" 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 textstyle="" style="font-weight: bold;">化后</span></span><span leaf="" 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 textstyle="" style="font-weight: bold;">:</span></span></p> <pre 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 leaf="" 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></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;"><span leaf=""><span textstyle="" style="font-weight: bold;">效果:</span>参数查询时间从平均 15 分钟减少到 2 分钟</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.4</span></span></em></strong></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;"><span leaf=""><br></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=""> </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="">4. 嵌入模型选型</span></span></strong></span></strong></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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></li> </ul> <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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">知识库数据量:</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 设备手册:50 份 × 约 5MB = 250MB</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="">工艺文件:200 份 × 约 1MB = 200MB</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="">维修记录:1000 条 × 约 50KB = 50MB</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="">设备图纸:30 套 × 约 20MB = 600MB</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="">总计约 1.1GB 的结构化和非结构化数据</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">数据特点:</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="">定期更新</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;"><strong><strong><span leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);font-weight: normal;">评估维度:</span></span></strong></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> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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></li> </ul> <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="">deepseek-1.5b:轻量但专业能力不足</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="">deepseek-7b:基础场景可用,但专业能力有限</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="text-decoration: underline;">deepseek-14b:推荐方案,性能与资源均衡</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="">deepseek-32b:高端方案,需要更强硬件支持</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="">deepseek-70b:资源要求过高,不建议本地部署</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="">首选:deepseek-14b</span></span></p> <pre 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 leaf="" 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;">较好的性能/资源占用比优秀的工业领域理解能力推理速度快,适合实时交互 硬件要求适中(有条件的使用Unsloth进行微调后效果更好)。</span></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;"><span leaf="">可选升级:deepseek-32b</span></span></p> <pre 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 leaf="" 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></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> <table style="width:548px;"> <thead> <tr> <th data-colwidth="127" width="127"> <section style="text-align: center;"> <span leaf="">模型类型</span> </section></th> <th data-colwidth="108" width="108"> <section style="text-align: center;"> <span leaf="">术语识别</span> </section></th> <th data-colwidth="115" width="115"> <section style="text-align: center;"> <span leaf="">相关性</span> </section></th> <th data-colwidth="96" width="96"> <section style="text-align: center;"> <span leaf="">速度</span> </section></th> <th data-colwidth="102" width="102"> <section style="text-align: center;"> <span leaf="">成本</span> </section></th> </tr> </thead> <tbody> <tr> <td data-colwidth="127" width="127"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">基础模型</span></span> </section></td> <td data-colwidth="108" width="108"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">一般</span></span> </section></td> <td data-colwidth="115" width="115"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">中等</span></span> </section></td> <td data-colwidth="96" width="96"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">快</span></span> </section></td> <td data-colwidth="102" width="102"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">低</span></span> </section></td> </tr> <tr> <td data-colwidth="127" width="127"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">行业模型</span></span> </section></td> <td data-colwidth="108" width="108"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">较好</span></span> </section></td> <td data-colwidth="115" width="115"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">较高</span></span> </section></td> <td data-colwidth="96" width="96"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">中等</span></span> </section></td> <td data-colwidth="102" width="102"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">中</span></span> </section></td> </tr> <tr> <td data-colwidth="127" width="127"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">微调模型</span></span> </section></td> <td data-colwidth="108" width="108"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">优秀</span></span> </section></td> <td data-colwidth="115" width="115"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">高</span></span> </section></td> <td data-colwidth="96" width="96"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">较慢</span></span> </section></td> <td data-colwidth="102" width="102"> <section style="text-align: center;"> <span leaf=""><span textstyle="" style="font-size: 15px;">高</span></span> </section></td> </tr> </tbody> </table> <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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">专业术语理解:</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 leaf="" 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 textstyle="" style="font-weight: bold;">案例:</span></span><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 leaf="" 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 textstyle="" style="font-weight: bold;">效果:</span></span><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="">术语识别准确率提升 35%</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">上下文关联:</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 leaf="" 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 textstyle="" style="font-weight: bold;">案例:</span></span><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><span leaf="" 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 textstyle="" style="font-weight: bold;"> 输入:</span></span><span leaf="" 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></pre> <pre><span leaf="" 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;"><br></span></pre> <pre><span leaf="" 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 textstyle="" style="font-weight: bold;">优化前:</span>简单列举可能原因</span></pre> <pre><span leaf="" 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></pre> <pre><span leaf="" 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 textstyle="" style="font-weight: bold;">优化后</span>:结合转速、切削参数等上下文分析</span></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 leaf="" 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 textstyle="" style="font-weight: bold;">效果:</span></span><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="">原因定位准确率提升 45%</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.5</span></span></em></strong></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;"><span leaf=""><br></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=""> </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 class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="502125641" data-ratio="0.32222222222222224" data-s="300,640" src="/upload/02d5e205835769ecee668e2ae4d97d65.png" data-type="png" data-w="1080" type="block"> </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(137, 137, 137);text-align: center;line-height: 1.5;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong><strong><span leaf="" style="max-width: 100%;color: rgb(62, 62, 62);line-height: 1.5;min-height: 1em;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 18px;font-family: PingFangSC-Semibold,sans-serif;"><span textstyle="" style="font-size: 12px;color: rgb(136, 136, 136);font-weight: normal;">知识处理流程图</span></span></strong></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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">系统层:</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">质量层:</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">业务层:</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(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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">系统性能看板:</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">业</span></span><span leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">务效果看板:</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%;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> <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 leaf=""><br></span></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) 80%,rgb(73, 200, 149) 10%);"><span leaf=""> </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> <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;"><span leaf=""><br></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=""> </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(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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">服务器配置:</span></span></p> <pre 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 leaf="" 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></pre> <pre 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 leaf="" 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;">CPU:32 核心以上 </span></pre> <pre 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 leaf="" 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;">内存:128GB </span></pre> <pre 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 leaf="" 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;">GPU:单张 RTX 4090(24GB)或 A4000(48GB) </span></pre> <pre 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 leaf="" 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;">可选配置(32b 版本):</span></pre> <pre 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 leaf="" 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;">双 GPU 并行或 A6000(48GB) </span></pre> <pre 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 leaf="" 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;">存储设备(企业级 SSD):2TB </span></pre> <pre 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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">终端设备:</span></span><span leaf="" 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></pre> <pre 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 leaf="" 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></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;"><span leaf=""><span textstyle="" style="text-decoration: underline;">预估总投入:15-25 万元</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(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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">云服务器租赁(按需配置)</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> <pre 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 leaf="" 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;">14b 版本:16 核 128G + A10/A30(24GB) </span></pre> <pre 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 leaf="" 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;">32b 版本:32 核 256G + A40/A100(40/80GB)</span></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 leaf="" 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></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 leaf="" 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;">CDN 加速服务</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 textstyle="" style="text-decoration: underline;">14b 方案:6-8 万元/年</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="text-decoration: underline;">32b 方案:12-15 万元/年</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%;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> <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;"><span leaf=""><br></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=""> </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(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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">设备管理优化</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">生产效率提升</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(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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">培训效率提升</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">技术经验沉淀</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">管理效能提升</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> <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;"><span leaf=""><br></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=""> </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="">ROI 分析</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">直接效益:</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">间接效益:</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="">投资回收</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="">预期回收周期:6-12 个月</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 leaf="" 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 textstyle="" style="color: rgb(0, 122, 170);">投资回报方式:</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%;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> <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 leaf=""><br></span></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=""> </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="">5.1</span></span></em></strong></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;"><span leaf=""><br></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=""> </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="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="">5.2</span></span></em></strong></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;"><span leaf=""><br></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=""> </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="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="">5.3</span></span></em></strong></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;"><span leaf=""><br></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=""> </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="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=""><br></span></span></em></strong></p> <section> <span leaf=""><br></span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>
作者:微信小助手
<section data-mpa-template="t" mpa-paragraph-type="ignored" style="margin-bottom: 0px;text-wrap: wrap;letter-spacing: 0.544px;background-color: rgb(255, 255, 255);" data-mpa-powered-by="yiban.io"> <section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin-bottom: 0px;padding-left: 10px;padding-right: 10px;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position: 0% 0%;background-repeat: no-repeat;background-size: auto;width: auto;font-family: PingFangSC-Light;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;text-align: left;"> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">我们知道加密后的数据对模糊查询不是很友好,本篇就针对加密数据模糊查询这个问题来展开讲一讲实现的思路,希望对大家有所启发。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">为了数据安全我们在开发过程中经常会对重要的数据进行加密存储,常见的有:密码、手机号、电话号码、详细地址、银行卡号、信用卡验证码等信息,这些信息对加解密的要求也不一样,比如说密码我们需要加密存储,一般使用的都是不可逆的慢hash算法,慢hash算法可以避免暴力破解(典型的用时间换安全性)。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">在检索时我们既不需要解密也不需要模糊查找,直接使用密文完全匹配,但是手机号就不能这样做,因为手机号我们要查看原信息,并且对手机号还需要支持模糊查找,因此我们今天就针对可逆加解密的数据支持模糊查询来看看有哪些实现方式。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">在网上随便搜索了一下,关于《加密后的模糊查询》 的帖子很多,顺便整理了一下实现的方法,不得不说很多都是不靠谱的做法,甚至有一些沙雕做法,接下来我们就对这些做法来讲讲实现思路和优劣性。</p> <h2 data-tool="mdnice编辑器" style="margin-top: 20px;margin-right: 10px;"><span style="display: none;"></span><span style="font-size: 22px;color: rgb(14, 136, 235);line-height: 1.5em;letter-spacing: 0em;font-weight: bolder;display: inline-block;font-family: STHeitiSC-Light;padding-left: 10px;border-left: 5px solid rgb(14, 136, 235);"><a href="https://mp.weixin.qq.com/s?__biz=MzUzMTA2NTU2Ng==&mid=2247487551&idx=1&sn=18f64ba49f3f0f9d8be9d1fdef8857d9&scene=21#wechat_redirect" style="color: rgb(14, 136, 235);border-style: none none solid;border-width: 3px 3px 0px;border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4) rgb(255, 53, 2);border-radius: 0px;" data-linktype="2">如何对加密后的数据进行模糊查询</a></span><span style="display: none;"></span></h2> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">我整理了一下对加密的数据模糊查询大致分为三类做法,如下所示:</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 沙雕做法(不动脑思考直男的思路,只管实现功能从不深入思考问题) </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 常规做法(思考了查询性能问题,也会使用一些存储空间换性能等做法) </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 超神做法(比较高端的做法从算法层面上思考) </section></li> </ul> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">我们就对这三种实现方法一一来讲讲实现思路和优劣性,首先我们先看沙雕做法。</p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;font-size: 18px;color: rgb(14, 136, 235);"><span style="display: none;"></span><span style="line-height: 1.5em;letter-spacing: 0em;font-weight: bold;display: block;"><a href="https://mp.weixin.qq.com/s?__biz=MzUzMTA2NTU2Ng==&mid=2247487551&idx=1&sn=18f64ba49f3f0f9d8be9d1fdef8857d9&scene=21#wechat_redirect" style="color: rgb(14, 136, 235);border-style: none none solid;border-width: 3px 3px 0px;border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4) rgb(255, 53, 2);border-radius: 0px;font-family: STHeitiSC-Light;" data-linktype="2">沙雕做法</a></span><span style="display: none;"></span></h3> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 将所有数据加载到内存中进行解密,解密后通过程序算法来模糊匹配 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 将密文数据映射一份明文映射表,俗称tag表,然后模糊查询tag来关联密文数据 </section></li> </ul> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;"><span style="display: none;"></span><span style="font-size: 18px;line-height: 1.5em;letter-spacing: 0em;font-weight: bold;display: block;"><a href="https://mp.weixin.qq.com/s?__biz=MzUzMTA2NTU2Ng==&mid=2247487551&idx=1&sn=18f64ba49f3f0f9d8be9d1fdef8857d9&scene=21#wechat_redirect" style="color: rgb(14, 136, 235);border-style: none none solid;border-width: 3px 3px 0px;border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4) rgb(255, 53, 2);border-radius: 0px;font-family: STHeitiSC-Light;" data-linktype="2">沙雕一</a></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">我们先来看看第一个做法,将所有数据加载到内存中进行解密,这个如果数据量小的话可以使用这个方式来做,这样做既简单又实惠,如果数据量大的话那就是灾难,我们来大致算一下。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">一个英文字母(不分大小写)占一个字节的空间,一个中文汉字占两个字节的空间,用DES来举例,<code style="color: rgb(30, 107, 184);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>13800138000</code>加密后的串<code style="color: rgb(30, 107, 184);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>HE9T75xNx6c5yLmS5l4r6Q==</code>占24个字节。</p> <section data-tool="mdnice编辑器" style="overflow-x: auto;"> <table> <thead> <tr> <th style="line-height: 1.5em;letter-spacing: 0em;text-align: left;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);width: auto;height: auto;border-top-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;min-width: 85px;">条数</th> <th style="line-height: 1.5em;letter-spacing: 0em;text-align: left;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);width: auto;height: auto;border-top-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;min-width: 85px;">Bytes</th> <th style="line-height: 1.5em;letter-spacing: 0em;text-align: left;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(240, 240, 240);width: auto;height: auto;border-top-width: 1px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;min-width: 85px;">MB</th> </tr> </thead> <tbody style="line-height: 1.5em;letter-spacing: 0em;border-width: 0px;border-style: initial;border-color: initial;"> <tr style="background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(255, 255, 255);width: auto;height: auto;"> <td style="font-size: 15px;min-width: 85px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;">100w</td> <td style="font-size: 15px;min-width: 85px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;">2400万</td> <td style="font-size: 15px;min-width: 85px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;">22.89</td> </tr> <tr style="background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(248, 248, 248);width: auto;height: auto;"> <td style="font-size: 15px;min-width: 85px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;">1000w</td> <td style="font-size: 15px;min-width: 85px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;">2.4亿</td> <td style="font-size: 15px;min-width: 85px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;">228.89</td> </tr> <tr style="background: none 0% 0% / auto no-repeat scroll padding-box border-box rgb(255, 255, 255);width: auto;height: auto;"> <td style="font-size: 15px;min-width: 85px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;">1亿</td> <td style="font-size: 15px;min-width: 85px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;">24亿</td> <td style="font-size: 15px;min-width: 85px;border-color: rgba(204, 204, 204, 0.4);border-radius: 0px;">2288.89</td> </tr> </tbody> </table> </section> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">轻则上百兆,重则上千兆,这样分分钟给应用程序整成Out of memory,这样做如果数据少只有几百、几千、几万条时是完全可以这样做的,但是数据量大就强烈不建议了。</p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;"><span style="display: none;"></span><span style="font-size: 18px;line-height: 1.5em;letter-spacing: 0em;font-weight: bold;display: block;"><a href="https://mp.weixin.qq.com/s?__biz=MzUzMTA2NTU2Ng==&mid=2247487551&idx=1&sn=18f64ba49f3f0f9d8be9d1fdef8857d9&scene=21#wechat_redirect" style="color: rgb(14, 136, 235);border-style: none none solid;border-width: 3px 3px 0px;border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4) rgb(255, 53, 2);border-radius: 0px;font-family: STHeitiSC-Light;" data-linktype="2">沙雕二</a></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">我们再来看第二个做法,将密文数据映射一份明文映射表,然后模糊查询映射表来关联密文数据,what???!!!那我们为什么要对数据加密呢,直接不加密不是更好么!</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">我们既然对数据加密肯定是有安全诉求才会这样做,增加一个明文的映射表就违背了安全诉求,这样做既不安全也不方便完全是脱裤子放x,多此一举,强且不推荐。</p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;font-size: 18px;color: rgb(14, 136, 235);"><span style="display: none;"></span><span style="line-height: 1.5em;letter-spacing: 0em;font-weight: bold;display: block;"><a href="https://mp.weixin.qq.com/s?__biz=MzUzMTA2NTU2Ng==&mid=2247487551&idx=1&sn=18f64ba49f3f0f9d8be9d1fdef8857d9&scene=21#wechat_redirect" style="color: rgb(14, 136, 235);border-style: none none solid;border-width: 3px 3px 0px;border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4) rgb(255, 53, 2);border-radius: 0px;font-family: STHeitiSC-Light;" data-linktype="2">常规做法</a></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">我们接下来看看常规的做法,也是最广泛使用的方法,此类方法及满足的数据安全性,又对查询友好。</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 在数据库实现加密算法函数,在模糊查询的时候使用<code style="color: rgb(30, 107, 184);font-size: 14px;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>decode(key) like '%partial%</code> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 对密文数据进行分词组合,将分词组合的结果集分别进行加密,然后存储到扩展列,查询时通过<code style="color: rgb(30, 107, 184);font-size: 14px;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>key like '%partial%'</code> </section></li> </ul> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;"><span style="display: none;"></span><span style="font-size: 18px;line-height: 1.5em;letter-spacing: 0em;font-weight: bold;display: block;"><a href="https://mp.weixin.qq.com/s?__biz=MzUzMTA2NTU2Ng==&mid=2247487551&idx=1&sn=18f64ba49f3f0f9d8be9d1fdef8857d9&scene=21#wechat_redirect" style="color: rgb(14, 136, 235);border-style: none none solid;border-width: 3px 3px 0px;border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4) rgb(255, 53, 2);border-radius: 0px;font-family: STHeitiSC-Light;" data-linktype="2">常规一</a></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">在数据库中实现与程序一致的加解密算法,修改模糊查询条件,使用数据库加解密函数先解密再模糊查找,这样做的优点是实现成本低,开发使用成本低,只需要将以往的模糊查找稍微修改一下就可以实现,但是缺点也很明显,这样做无法利用数据库的索引来优化查询,甚至有一些数据库可能无法保证与程序实现一致的加解密算法,但是对于常规的加解密算法都可以保证与应用程序一致。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">如果对查询性能要求不是特别高、对数据安全性要求一般,可以使用常见的加解密算法比如说AES、DES之类的也是一个不错的选择。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">如果公司有自己的算法实现,并且没有提供多端的算法实现,要么找个算法好的人去研究吃透补全多端实现,要么放弃使用这个办法。</p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;"><span style="display: none;"></span><span style="font-size: 18px;line-height: 1.5em;letter-spacing: 0em;font-weight: bold;display: block;"><a href="https://mp.weixin.qq.com/s?__biz=MzUzMTA2NTU2Ng==&mid=2247487551&idx=1&sn=18f64ba49f3f0f9d8be9d1fdef8857d9&scene=21#wechat_redirect" style="color: rgb(14, 136, 235);border-style: none none solid;border-width: 3px 3px 0px;border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4) rgb(255, 53, 2);border-radius: 0px;font-family: STHeitiSC-Light;" data-linktype="2">常规二</a></span><span style="display: none;"></span></h4> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">对密文数据进行分词组合,将分词组合的结果集分别进行加密,然后存储到扩展列,查询时通过key like '%partial%',这是一个比较划算的实现方法,我们先来分析一下它的实现思路。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">先对字符进行固定长度的分组,将一个字段拆分为多个,比如说根据4位英文字符(半角),2个中文字符(全角)为一个检索条件,举个例子:</p> <section data-tool="mdnice编辑器" style="padding-left: 10px;border-left: 3px solid #DBDBDB;color: rgb(14, 136, 235);font-size: 15px;padding-top: 10px;margin: 1em 0;text-indent: 0;margin-top: 20px;margin-bottom: 20px;border-style: none;border-top-width: 3px;border-bottom-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-right-color: rgba(0, 0, 0, 0.4);width: auto;height: auto;overflow: auto;border-left-width: initial;border-left-color: initial;padding-right: 10px;padding-bottom: 10px;line-height: 1.8;border-radius: 0px 0px 10px 10px;background: rgb(255, 255, 255);box-shadow: rgb(132, 161, 168) 0px 10px 15px;"> <span style="letter-spacing: 0em;display: block;font-size: 2em;font-family: Arial, serif;line-height: 1em;font-weight: 700;"></span> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;word-spacing: 0.1em;line-height: 1.8em;letter-spacing: 0em;"><code style="color: rgb(30, 107, 184);font-size: 14px;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>ningyu1</code>使用4个字符为一组的加密方式,第一组ning ,第二组ingy ,第三组ngyu ,第四组gyu1 … 依次类推。</p> </section> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">如果需要检索所有包含检索条件4个字符的数据比如:ingy ,加密字符后通过 <code style="color: rgb(30, 107, 184);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>key like “%partial%”</code> 查库。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">我们都知道加密后长度会增长,增长的这部分长度存储就是我们要花费的额外成本,典型的使用成本来换取速度,密文增长的幅度随着算法不同而不同以DES举例,<code style="color: rgb(30, 107, 184);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>13800138000</code>加密前占11个字节,加密后的串<code style="color: rgb(30, 107, 184);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;height: auto;margin-left: 2px;margin-right: 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;font-family: " operator mono, consolas, monaco, menlo, monospace;word-break: break-all;>HE9T75xNx6c5yLmS5l4r6Q==</code>占24个字节,增长是2.18倍,所以一个优秀的算法是多么的重要,能为公司节省不少成本,但是话又说回来算法工程师的工资也不低,所以我也不知道是节省成本还是增加成本,哈哈哈…你们自己算吧。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">回到主题,这个方法虽然可以实现加密数据的模糊查询,但是对模糊查询的字符长度是有要求的,以我上面举的例子模糊查询字符原文长度必须大于等于4个英文/数字,或者2个汉字,再短的长度不建议支持,因为分词组合会增多从而导致存储的成本增加,反而安全性降低。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">大家是否都对接过 淘宝、拼多多、JD他们的api,他们对平台订单数据中的用户敏感数据就是加密的同时支持模糊查询,使用就是这个方法,下面我整理了几家电商平台的密文字段检索方案的说明,感兴趣的可以查看下面链接。</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 淘宝密文字段检索方案:https://open.taobao.com/docV3.htm?docId=106213&docType=1 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 阿里巴巴文字段检索方案:https://jaq-doc.alibaba.com/docs/doc.htm?treeId=1&articleId=106213&docType=1 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 拼多多密文字段检索方案:https://open.pinduoduo.com/application/document/browse?idStr=3407B605226E77F2 </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 京东密文字段检索方案:https://jos.jd.com/commondoc?listId=345 </section></li> </ul> <section data-tool="mdnice编辑器" style="padding-left: 10px;border-left: 3px solid #DBDBDB;color: rgb(14, 136, 235);font-size: 15px;padding-top: 10px;margin: 1em 0;text-indent: 0;margin-top: 20px;margin-bottom: 20px;border-style: none;border-top-width: 3px;border-bottom-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-right-color: rgba(0, 0, 0, 0.4);width: auto;height: auto;overflow: auto;border-left-width: initial;border-left-color: initial;padding-right: 10px;padding-bottom: 10px;line-height: 1.8;border-radius: 0px 0px 10px 10px;background: rgb(255, 255, 255);box-shadow: rgb(132, 161, 168) 0px 10px 15px;"> <span style="letter-spacing: 0em;display: block;font-size: 2em;font-family: Arial, serif;line-height: 1em;font-weight: 700;"></span> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;word-spacing: 0.1em;line-height: 1.8em;letter-spacing: 0em;">ps. 基本上都是一样的,果然都是互相抄袭,连加密后的数据格式都一致。</p> </section> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">这个方法优点就是实现起来不算复杂,使用起来也较为简单,算是一个折中的做法,因为会有扩展字段存储成本会有升高,但是可利用数据库索引优化查询速度,推荐使用这个方法。</p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;font-size: 18px;color: rgb(14, 136, 235);"><span style="display: none;"></span><span style="line-height: 1.5em;letter-spacing: 0em;font-weight: bold;display: block;"><a href="https://mp.weixin.qq.com/s?__biz=MzUzMTA2NTU2Ng==&mid=2247487551&idx=1&sn=18f64ba49f3f0f9d8be9d1fdef8857d9&scene=21#wechat_redirect" style="color: rgb(14, 136, 235);border-style: none none solid;border-width: 3px 3px 0px;border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4) rgb(255, 53, 2);border-radius: 0px;font-family: STHeitiSC-Light;" data-linktype="2">超神做法</a></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">我们接下来看看优秀的做法,此类做法难度较高,都是从算法层面来考虑,有些甚至会设计一个新算法,虽然已有一些现成的算法参考,但是大多都是半成品无法拿来直接使用,所以还是要有人去深入研究和整合到自己的应用中去。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">从算法层面思考,甚至会设计一个新算法来支持模糊查找</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">这个层面大多是专业算法工程师的研究领域,想要设计一个有序的、非不可逆的、密文长度不能增长过快的算法不是一件简单的事情,大致的思路是这样的,使用译码的方式进行加解密,保留密文和原文一样的顺序,从而支持密文模糊匹配,说的比较笼统因为我也不是这方面的专家没有更深一步的研究过,所以我从网上找了一些资料可以参考一下。</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 数据库中字符数据的模糊匹配加密方法:https://www.jiamisoft.com/blog/6542-zifushujumohupipeijiamifangfa.html </section></li> </ul> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">这里提到的Hill密码处理和模糊匹配加密方法FMES可以重点看看.</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 一种基于BloomFilter的改进型加密文本模糊搜索机制研究:http://kzyjc.cnjournals.com/html/2019/1/20190112.htm </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 支持快速查询的数据库如何加密:https://www.jiamisoft.com/blog/5961-kuaisuchaxunshujukujiami.html </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 基于Lucene的云端搜索与密文基础上的模糊查询:https://www.cnblogs.com/arthurqin/p/6307153.html </section></li> </ul> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">基于Lucene的思路就跟我们上面介绍的常规做法二类似,对字符进行等长度分词,将分词后的结果集加密后存储,只不过存储的db不一样,一个是关系型数据库,一个是es搜索引擎。</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);line-height: 1.8em;letter-spacing: 0em;"> 云存储中一种支持可验证的模糊查询加密方案:http://jeit.ie.ac.cn/fileDZYXXXB/journal/article/dzyxxxb/2017/7/PDF/160971.pdf </section></li> </ul> <section data-tool="mdnice编辑器" style="padding-left: 10px;border-left: 3px solid #DBDBDB;color: rgb(14, 136, 235);font-size: 15px;padding-top: 10px;margin: 1em 0;text-indent: 0;margin-top: 20px;margin-bottom: 20px;border-style: none;border-top-width: 3px;border-bottom-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-right-color: rgba(0, 0, 0, 0.4);width: auto;height: auto;overflow: auto;border-left-width: initial;border-left-color: initial;padding-right: 10px;padding-bottom: 10px;line-height: 1.8;border-radius: 0px 0px 10px 10px;background: rgb(255, 255, 255);box-shadow: rgb(132, 161, 168) 0px 10px 15px;"> <span style="letter-spacing: 0em;display: block;font-size: 2em;font-family: Arial, serif;line-height: 1em;font-weight: 700;"></span> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;word-spacing: 0.1em;line-height: 1.8em;letter-spacing: 0em;">基于 Spring Boot + MyBatis Plus + Vue & Element 实现的后台管理系统 + 用户小程序,支持 RBAC 动态权限、多租户、数据权限、工作流、三方登录、支付、短信、商城等功能</p> <ul style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: rgb(0, 0, 0);" class="list-paddingleft-1"> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;"> 项目地址:https://github.com/YunaiV/ruoyi-vue-pro </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;"> 视频教程:https://doc.iocoder.cn/video/ </section></li> </ul> </section> <h2 data-tool="mdnice编辑器" style="margin-top: 20px;margin-right: 10px;"><span style="display: none;"></span><span style="font-size: 22px;color: rgb(14, 136, 235);line-height: 1.5em;letter-spacing: 0em;font-weight: bolder;display: inline-block;font-family: STHeitiSC-Light;padding-left: 10px;border-left: 5px solid rgb(14, 136, 235);"><a href="https://mp.weixin.qq.com/s?__biz=MzUzMTA2NTU2Ng==&mid=2247487551&idx=1&sn=18f64ba49f3f0f9d8be9d1fdef8857d9&scene=21#wechat_redirect" style="color: rgb(14, 136, 235);border-style: none none solid;border-width: 3px 3px 0px;border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4) rgb(255, 53, 2);border-radius: 0px;" data-linktype="2">总结</a></span><span style="display: none;"></span></h2> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">我们到这里对加密数据的检索方案全部介绍完了,我们首先提到的是网上搜索随处可见的沙雕做法,在这里也讲了不推荐使用这些沙雕做法,尽量使用常规做法,如果公司有专业算法方向人才的话不妨可以考虑基于算法层面的超神做法。</p> <p data-tool="mdnice编辑器" style="font-size: 15px;line-height: 1.75;letter-spacing: 0.2em;text-indent: 0em;padding-top: 8px;padding-bottom: 8px;margin: 10px;word-spacing: 0.1em;">总的来说从投入、产出比、及实现、使用成本来算的话常规做法二是非常推荐的。</p> </section> </section>
作者:微信小助手
<section data-class="_mbEditor" style="margin-bottom: 0px;"> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="display:inline-block;"> <section style="border-width: 1px;border-style: solid;border-color: rgb(32, 87, 146);padding: 2px;"> <section style="display: flex;justify-content: space-between;"> <section style="width: 8px;height: 8px;border-width: 1px;border-style: solid;border-color: rgb(32, 87, 146) transparent transparent rgb(32, 87, 146);"> <span leaf=""><br></span> </section> <section style="width: 8px;height: 8px;border-width: 1px;border-style: solid;border-color: rgb(32, 87, 146) rgb(32, 87, 146) transparent transparent;"> <span leaf=""><br></span> </section> </section> <section style="padding-right: 10px;padding-left: 10px;margin-top: -5px;font-size: 16px;letter-spacing: 2px;color: rgb(0, 0, 0);"> <p style="margin-top: 0px;margin-bottom: 0px;"><span style="font-size: 12px;"><span leaf="">文章底部获取项目地址</span></span></p> </section> <section style="display: flex;justify-content: space-between;margin-top: -5px;"> <section style="width: 8px;height: 8px;border-width: 1px;border-style: solid;border-color: transparent transparent rgb(32, 87, 146) rgb(32, 87, 146);"> <span leaf=""><br></span> </section> <section style="width: 8px;height: 8px;border-width: 1px;border-style: solid;border-color: transparent rgb(32, 87, 146) rgb(32, 87, 146) transparent;"> <span leaf=""><br></span> </section> </section> </section> </section> </section> </section> <section style="margin-bottom: 24px;margin-top: 16px;text-align: left;"> <span leaf=""><span textstyle="" style="font-size: 15px;">AIGCPanel 是一款开源的一站式 AI 虚拟数字人系统,基于 Electron、Vue3、TypeScript 开发,支持视频合成、声音合成和声音克隆等核心功能,支持一键导入和使用 AI 大模型,旨在为用户提供高效、便捷的数字人解决方案。</span></span> </section> <p style="text-align: left;margin-top: 0px;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 15px;">视频合成:</span></span></p> <p style="text-align: left;margin-top: 0px;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 14px;">AIGCPanel 支持视频数字人合成,能够将 AI 生成的数字人形象与视频画面结合。它支持视频画面和声音的换口型匹配,实现智能音视频同步优化,让数字人的表现更加自然流畅。这一功能对于制作高质量的 AI 视频内容至关重要,广泛应用于影视制作、广告宣传等领域。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/829be539ec5f1ccf9f894a00de8c0cdf.png" class="rich_pages wxw-img" data-ratio="0.6147144240077445" data-s="300,640" data-type="png" data-w="1033" type="block" data-imgfileid="100003666"> </section> <p style="text-align: left;margin-top: 0px;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 15px;">声音克隆与合成:</span></span></p> <p style="text-align: left;margin-top: 0px;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 14px;">AIGCPanel 支持声音克隆功能,用户可以通过上传声音样本,利用 AI 技术重塑独特声线,实现声音的复制和还原。无论是名人声音还是个人特色声音,都能通过声音克隆功能进行还原和再现。此外,AIGCPanel 还支持声音合成功能,能够将文字智能转换为逼真语音,声音自然流畅。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/3b982cd85a6b466230c2d87efda5d3a9.png" class="rich_pages wxw-img" data-ratio="0.6197866149369544" data-s="300,640" data-type="png" data-w="1031" type="block" data-imgfileid="100003667"> </section> <p style="text-align: left;margin-top: 0px;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 15px;">模型管理:</span></span></p> <p style="text-align: left;margin-top: 0px;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 14px;">AIGCPanel 支持多模型导入和一键启动,极大地简化了模型的使用流程。它提供了丰富的模型设置选项,用户可以对模型的各项参数进行精细调整。同时,系统还提供模型日志查看功能,方便用户随时了解模型的运行状态和性能表现。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="https://mmbiz.qpic.cn/sz_mmbiz_jpg/P0qk2libhpNFTEicKAbpRAu9WmMzMNXwKrmCvfe6R0h63fTk9xDzeoPuXKgibSeHWAMOpdrCoicaibrzBLkcc0cMEJg/640?wx_fmt=jpeg" class="rich_pages wxw-img" data-ratio="0.26621490803484993" data-s="300,640" data-type="png" data-w="1033" style="width:578px;height:154px;" type="block" src="/upload/925d96ac99d71015cf500985f577cdc0.png" data-cropx2="1033" data-cropy2="275.2283737024221" data-imgfileid="100003668"> </section> <section style="margin-bottom: 24px;"> <span leaf=""><span textstyle="" style="font-size: 15px;">模型配置:</span></span> </section> <section data-tool="markdown编辑器" data-website="https://markdown.com.cn/editor" style="font-size: 16px;color: black;line-height: 1.6;word-spacing: 0px;letter-spacing: 0px;word-break: break-word;word-wrap: break-word;text-align: justify;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;margin-top: -10px;padding: 0;"> <pre data-tool="markdown.com.cn编辑器" style="margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #1E1E1E;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg xcoplcwfzedj0op3ksxsmeerjys60dtibfpcq4htiy0gdmo3lj1y0iabdiczhvpsomuclfwulwn2yzrvzqx5xubyrjhxm07vhl5 640?wx_fmt="svg&from=appmsg");""></span><code style="overflow-x: auto;padding: 16px;color: #DCDCDC;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #1E1E1E;border-radius: 5px;"><span leaf="">{</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"name"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"server-xxx"</span></span><span leaf="">, </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 模型名称</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"version"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"0.1.0"</span></span><span leaf="">, </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 模型版本</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"title"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"语音模型"</span></span><span leaf="">, </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 模型标题</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"description"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"模型描述"</span></span><span leaf="">, </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 模型描述</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"platformName"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"win"</span></span><span leaf="">, </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 支持系统,win, osx, linux</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"platformArch"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"x86"</span></span><span leaf="">, </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 支持架构,x86, arm64</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"entry"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"server/main"</span></span><span leaf="">, </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 入口文件,一键启动包文件</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"functions"</span></span><span leaf="">: [</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"videoGen"</span></span><span leaf="">, </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 支持视频生成</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"soundTTS"</span></span><span leaf="">, </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 支持语音合成</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"soundClone"</span></span><span leaf=""> </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 支持语音克隆</span></span><span leaf=""><br></span><span leaf=""> ],</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"settings"</span></span><span leaf="">: [ </span><span style="color: #57A64A;font-style: italic;line-height: 26px;"><span leaf="">// 模型配置项,可以显示在模型配置页面</span></span><span leaf=""><br></span><span leaf=""> {</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"name"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"port"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"type"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"text"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"title"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"服务端口"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"default"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">""</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"placeholder"</span></span><span leaf="">: </span><span style="color: #D69D85;line-height: 26px;"><span leaf="">"留空会检测使用随机端口"</span></span><span leaf=""><br></span><span leaf=""> }</span><span leaf=""><br></span><span leaf=""> ]</span><span leaf=""><br></span><span leaf="">}</span></code></pre> </section> <section style="margin-bottom: 16px;text-align: left;"> <span leaf=""><span textstyle="" style="font-size: 15px;">功能和特性:</span></span> </section> <p style="text-align: left;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 14px;">视频合成:支持视频画面与声音的智能换口型匹配,确保视频中人物嘴型与语音同步,适用于制作高质量的数字人视频内容。</span></span></p> <p style="text-align: left;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 14px;">声音合成与克隆:提供多种声音参数设置(如音调、语速等),可复制特定人物的声音,实现个性化声音定制。</span></span></p> <p style="text-align: left;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 14px;">模型管理:简化本地模型管理,支持多模型导入和一键启动,提供模型设置和日志查看功能。</span></span></p> <p style="text-align: left;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 14px;">国际化支持:支持简体中文和英语界面。</span></span></p> <p style="text-align: left;margin-bottom: 16px;"><span leaf=""><span textstyle="" style="font-size: 14px;">一键启动包:集成多个成熟模型(如 MuseTalk、cosyvoice)的一键启动包。</span></span></p>
作者:微信小助手
<section class="mp_profile_iframe_wrp" nodeleaf=""> <mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-nickname="视频翻译与配音VideoTrans" data-alias="pyvideotrans" data-from="0" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/ibd7vtHfnZiaqtbmwErA54twV1uS1juxpGEaUtjzSoH733hAd10t0IVBFz8Vb2jhr2vYa5HLLoh7fgGlInApiaicyw/0?wx_fmt=png" data-signature="开源项目“视频翻译配音软件VideoTrans”作者公众号。项目开源主页: github.com/jianchang512/pyvideotrans项目官网: pyvideotrans.com" data-id="MzA5MDgyNjgxOA==" data-is_biz_ban="0" data-service_type="1"></mp-common-profile> </section> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">玩配音的基本都知道,微软的edge-tts是好用免费的语音合成利器,唯一缺点是对国内限流越来越严,不过可以通过部署到 cloudflare 来规避,并且还能白嫖 cloudflare的服务器和带宽资源。</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">先看效果,完成后将有一个配音api接口和一个web配音界面</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/a10a602fc67b18fe353c832d7295275d.png" class="rich_pages wxw-img" data-ratio="0.5425925925925926" data-type="other" data-w="1080" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323195"></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><br></span></p> <p><span style="box-sizing: border-box;top: 2px;right: 8px;z-index: 2;font-size: 12px;font-weight: 500;user-select: none;color: var(--vp-code-lang-color);transition: color 0.4s, opacity 0.4s;"><span leaf="">js</span></span></p> <pre tabindex="0" style="white-space:pre-wrap;box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;overflow: auto;line-height: 1.75;box-shadow: rgba(110, 110, 0.45) 0px 8px;border-radius: 4px;margin: 0px;direction: ltr;text-align: left;word-spacing: normal;word-break: normal;overflow-wrap: normal;tab-size: 4;hyphens: none;z-index: 1;padding: 20px 0px;background: rgb(0, 0, 0);color: rgb(255, 255, 255);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: normal;border-radius: 2px;overflow-x: auto;background: rgb(0, 0, 0);color: rgb(255, 255, 255);font-size: var(--vp-code-font-size);padding: 0px 24px;margin: 0px;display: block;direction: ltr;text-align: left;word-spacing: normal;overflow-wrap: normal;tab-size: 4;hyphens: none;width: fit-content;min-width: 100%;line-height: var(--vp-code-line-height);transition: color 0.5s;><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(198, 120, 221);"><span leaf="">const</span></span><span style="box-sizing: border-box;color: rgb(229, 192, 123);"><span leaf=""> requestBody</span></span><span style="box-sizing: border-box;color: rgb(86, 182, 194);"><span leaf=""> =</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf=""> {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf=""> "model"</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">: </span></span><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf="">"tts-1"</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf=""> "input"</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">: </span></span><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf="">'这是要合成语音的文字'</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf=""> "voice"</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">: </span></span><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf="">'zh-CN-XiaoxiaoNeural'</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf=""> "response_format"</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">: </span></span><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf="">"mp3"</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf=""> "speed"</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">: </span></span><span style="box-sizing: border-box;color: rgb(209, 154, 102);"><span leaf="">1.0</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf=""> };</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(198, 120, 221);"><span leaf="">const</span></span><span style="box-sizing: border-box;color: rgb(229, 192, 123);"><span leaf=""> response</span></span><span style="box-sizing: border-box;color: rgb(86, 182, 194);"><span leaf=""> =</span></span><span style="box-sizing: border-box;color: rgb(198, 120, 221);"><span leaf=""> await</span></span><span style="box-sizing: border-box;color: rgb(97, 175, 239);"><span leaf=""> fetch</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">(</span></span><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf="">'部署到cloudflare后的网址'</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">, {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(224, 108, 117);"><span leaf=""> method</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">: </span></span><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf="">'POST'</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(224, 108, 117);"><span leaf=""> headers</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf=""> 'Content-Type'</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">: </span></span><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf="">'application/json'</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf=""> 'Authorization'</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">: </span></span><span style="box-sizing: border-box;color: rgb(152, 195, 121);"><span leaf="">`Bearer 部署后的key,随意`</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf=""> },</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(224, 108, 117);"><span leaf=""> body</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">: </span></span><span style="box-sizing: border-box;color: rgb(229, 192, 123);"><span leaf="">JSON</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">.</span></span><span style="box-sizing: border-box;color: rgb(97, 175, 239);"><span leaf="">stringify</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">(</span></span><span style="box-sizing: border-box;color: rgb(224, 108, 117);"><span leaf="">requestBody</span></span><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">),</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: rgb(171, 178, 191);"><span leaf="">});</span></span></span></code></pre> <p><span style="box-sizing: border-box;"><span leaf=""><br></span></span><span leaf="">这是接口调用js版函数,并兼容 openai tts 接口</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">接下来说说如何部署到 cloudflare 上</span></p> <h2 tabindex="-1" style="box-sizing: border-box;margin: 35px 2px 10px 0px;line-height: 1.5;font-size: 24px;font-weight: 700;overflow-wrap: break-word;outline: none;border-top: 1px solid var(--vp-c-divider);padding: 6px 8px 0px 0px;letter-spacing: -0.02em;display: inline-block;background: rgb(239, 112, 96);color: rgb(255, 255, 255);border-top-right-radius: 6px;box-shadow: rgba(239, 112, 96, 0.2) 6px 3px 0px 0px;font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;><span leaf=""> 登录 cloudflare 创建一个Workers</span></h2> <blockquote style="box-sizing: border-box;margin: 20px 0px 16px;border-left: 3px solid rgb(239, 112, 96);padding: 1px 20px;transition: border-color 0.5s;color: var(--vp-c-text-2);margin-inline: 0px;background: rgb(255, 249, 249);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;> <p style="box-sizing: border-box;margin: 0px;overflow-wrap: break-word;line-height: inherit;font-size: 16px;transition: color 0.5s;"><span leaf="">网址 </span><span leaf="">https://dash.cloudflare.com/</span><span leaf=""> 如何登录注册不再赘述</span></p> </blockquote> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">登录后,点击左侧 </span><code style="box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: break-word;border-radius: 4px;overflow-x: auto;background-color: var(--vp-code-bg);color: var(--vp-code-color);font-size: var(--vp-code-font-size);padding: 3px 6px;transition: color 0.25s, background-color 0.5s;><span leaf="">Workers 和 Pages</span></code><span leaf="">,打开创建页面</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/154f02322515ac8795ca1b367bd10b98.png" class="rich_pages wxw-img" data-ratio="0.4361111111111111" data-type="other" data-w="1080" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323194"></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">继续点击创建</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/b8de71ff9d5bda755f4bff43e49cf2e2.png" class="rich_pages wxw-img" data-ratio="0.6265182186234818" data-type="other" data-w="988" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323193"></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">然后在出现的输入框中填写一个英文名称,作为cloudflare赠送的免费子域名头</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/a380afb8bf331784ebaa858ec9033384.png" class="rich_pages wxw-img" data-ratio="0.575925925925926" data-type="other" data-w="1080" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323196"></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">点击右下角部署后,在新出现的页面中继续点击</span><code style="box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: break-word;border-radius: 4px;overflow-x: auto;background-color: var(--vp-code-bg);color: var(--vp-code-color);font-size: var(--vp-code-font-size);padding: 3px 6px;transition: color 0.25s, background-color 0.5s;><span leaf="">编辑代码</span></code><span leaf="">,进入核心阶段,复制代码</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/35ee6c25d25b5cb6d3a73a7257b2bac4.png" class="rich_pages wxw-img" data-ratio="0.35555555555555557" data-type="other" data-w="1080" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323192"></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">然后删掉里面所有的代码,复制下面的代码去替换</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/a2d140ac59b9812205fa2cc19e2959c1.png" class="rich_pages wxw-img" data-ratio="0.4074074074074074" data-type="other" data-w="1080" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323199"></span></p> <p><span style="box-sizing: border-box;top: 2px;right: 8px;z-index: 2;font-size: 12px;font-weight: 500;user-select: none;color: var(--vp-code-lang-color);transition: color 0.4s, opacity 0.4s;"></span></p> <pre tabindex="0" style="white-space:pre-wrap;box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;overflow: auto;line-height: 1.75;box-shadow: rgba(110, 110, 0.45) 0px 8px;border-radius: 4px;margin: 0px;direction: ltr;text-align: left;word-spacing: normal;word-break: normal;overflow-wrap: normal;tab-size: 4;hyphens: none;z-index: 1;padding: 20px 0px;background: rgb(0, 0, 0);color: rgb(255, 255, 255);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: normal;border-radius: 2px;overflow-x: auto;background: rgb(0, 0, 0);color: rgb(255, 255, 255);font-size: var(--vp-code-font-size);padding: 0px 24px;margin: 0px;display: block;direction: ltr;text-align: left;word-spacing: normal;overflow-wrap: normal;tab-size: 4;hyphens: none;width: fit-content;min-width: 100%;line-height: var(--vp-code-line-height);transition: color 0.5s;><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">// 自定义api key ,用于防止滥用</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">const API_KEY = '';</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">const encoder = new TextEncoder();</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">let expiredAt = null;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">let endpoint = null;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">let clientId = "";</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">const TOKEN_REFRESH_BEFORE_EXPIRY = 3 * 60; </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">let tokenInfo = {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> endpoint: null,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> token: null,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> expiredAt: null</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">};</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">addEventListener("fetch", event => {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> event.respondWith(handleRequest(event.request));</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">});</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">async function handleRequest(request) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> if (request.method === "OPTIONS") {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return handleOptions(request);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> </span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const authHeader = request.headers.get("authorization") || request.headers.get("x-api-key");</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const apiKey = authHeader?.startsWith("Bearer ") </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> ? authHeader.slice(7) </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> : null;</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> // 只在设置了 API_KEY 的情况下才验证 </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> if (API_KEY && apiKey !== API_KEY) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return new Response(JSON.stringify({</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> error: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> message: "Invalid API key. Use 'Authorization: Bearer your-api-key' header",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> type: "invalid_request_error",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> param: null,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> code: "invalid_api_key"</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }), {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> status: 401,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> headers: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Content-Type": "application/json",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> ...makeCORSHeaders()</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> });</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const requestUrl = new URL(request.url);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const path = requestUrl.pathname;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> if (path === "/v1/audio/speech") {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> try {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const requestBody = await request.json();</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const { </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> model = "tts-1",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> input,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> voice = "zh-CN-XiaoxiaoNeural",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> response_format = "mp3",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> speed = '1.0',</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> volume='0',</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> pitch = '0', // 添加 pitch 参数,默认值为 0</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> style = "general"//添加style参数,默认值为general</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> } = requestBody;</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> let rate = parseInt(String( (parseFloat(speed)-1.0)*100) );</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> let numVolume = parseInt( String(parseFloat(volume)*100) );</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> let numPitch = parseInt(pitch); </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const response = await getVoice(</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> input, </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> voice, </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> rate>=0?`+${rate}%`:`${rate}%`,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> numPitch>=0?`+${numPitch}Hz`:`${numPitch}Hz`,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> numVolume>=0?`+${numVolume}%`:`${numVolume}%`,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> style,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "audio-24khz-48kbitrate-mono-mp3"</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> );</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return response;</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> } catch (error) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> console.error("Error:", error);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return new Response(JSON.stringify({</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> error: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> message: error.message,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> type: "api_error",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> param: null,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> code: "edge_tts_error"</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }), {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> status: 500,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> headers: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Content-Type": "application/json",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> ...makeCORSHeaders()</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> });</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> // 默认返回 404</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return new Response("Not Found", { status: 404 });</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">async function handleOptions(request) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return new Response(null, {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> status: 204,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> headers: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> ...makeCORSHeaders(),</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Access-Control-Allow-Headers": request.headers.get("Access-Control-Request-Headers") || "Authorization"</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> });</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">async function getVoice(text, voiceName = "zh-CN-XiaoxiaoNeural", rate = '+0%', pitch = '+0Hz', volume='+0%',style = "general", outputFormat = "audio-24khz-48kbitrate-mono-mp3") {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> try {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const maxChunkSize = 2000; </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const chunks = text.trim().split("\n");</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> // 获取每个分段的音频</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> //const audioChunks = await Promise.all(chunks.map(chunk => getAudioChunk(chunk, voiceName, rate, pitch, volume,style, outputFormat)));</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> let audioChunks=[]</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> while(chunks.length>0){</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> try{</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> let audio_chunk= await getAudioChunk(chunks.shift(), voiceName, rate, pitch, volume,style, outputFormat)</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> audioChunks.push(audio_chunk)</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }catch(e){</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return new Response(JSON.stringify({</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> error: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> message: String(e),</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> type: "api_error",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> param: `${voiceName}, ${rate}, ${pitch}, ${volume},${style}, ${outputFormat}`,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> code: "edge_tts_error"</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }), {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> status: 500,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> headers: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Content-Type": "application/json",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> ...makeCORSHeaders()</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> });</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> </span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> // 将音频片段拼接起来</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const concatenatedAudio = new Blob(audioChunks, { type: 'audio/mpeg' });</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const response = new Response(concatenatedAudio, {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> headers: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Content-Type": "audio/mpeg",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> ...makeCORSHeaders()</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> });</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return response;</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> } catch (error) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> console.error("语音合成失败:", error);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return new Response(JSON.stringify({</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> error: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> message: error,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> type: "api_error",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> param: null,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> code: "edge_tts_error "+voiceName</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }), {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> status: 500,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> headers: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Content-Type": "application/json",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> ...makeCORSHeaders()</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> });</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">//获取单个音频数据</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">async function getAudioChunk(text, voiceName, rate, pitch,volume, style, outputFormat='audio-24khz-48kbitrate-mono-mp3') {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const endpoint = await getEndpoint();</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const url = `https://${endpoint.r}.tts.speech.microsoft.com/cognitiveservices/v1`;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> let m=text.match(/\[(\d+)\]\s*?$/);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> let slien=0;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> if(m&&m.length==2){</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> slien=parseInt(m[1]);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> text=text.replace(m[0],'')</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const response = await fetch(url, {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> method: "POST",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> headers: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Authorization": endpoint.t,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Content-Type": "application/ssml+xml",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "X-Microsoft-OutputFormat": outputFormat</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> },</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> body: getSsml(text, voiceName, rate,pitch,volume, style,slien)</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> });</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> if (!response.ok) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const errorText = await response.text();</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> throw new Error(`Edge TTS API error: ${response.status} ${errorText}`);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return response.blob();</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">function getSsml(text, voiceName, rate, pitch,volume,style,slien=0) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> let slien_str='';</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> if(slien>0){</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> slien_str=` <break time="${slien}ms" />`</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return ` <speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" version="1.0" xml:lang="zh-CN"> </speak></span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> <voice name="${voiceName}"> </voice></span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> <mstts:express-as style="${style}" styledegree="2.0" role="default"> </mstts:express-as></span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> <prosody rate="${rate}" pitch="${pitch}" volume="${volume}">${text} </prosody> </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> ${slien_str}</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> `;</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">async function getEndpoint() {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const now = Date.now() / 1000;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> if (tokenInfo.token && tokenInfo.expiredAt && now < tokenInfo.expiredAt - TOKEN_REFRESH_BEFORE_EXPIRY) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return tokenInfo.endpoint;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> // 获取新token</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const endpointUrl = "https://dev.microsofttranslator.com/apps/endpoint?api-version=1.0";</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const clientId = crypto.randomUUID().replace(/-/g, "");</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> try {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const response = await fetch(endpointUrl, {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> method: "POST",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> headers: {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Accept-Language": "zh-Hans",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "X-ClientVersion": "4.0.530a 5fe1dc6c",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "X-UserId": "0f04d16a175c411e",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "X-HomeGeographicRegion": "zh-Hans-CN",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "X-ClientTraceId": clientId,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "X-MT-Signature": await sign(endpointUrl),</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Content-Type": "application/json; charset=utf-8",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Content-Length": "0",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Accept-Encoding": "gzip"</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> });</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> if (!response.ok) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> throw new Error(`获取endpoint失败: ${response.status}`);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const data = await response.json();</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const jwt = data.t.split(".")[1];</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const decodedJwt = JSON.parse(atob(jwt));</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> tokenInfo = {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> endpoint: data,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> token: data.t,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> expiredAt: decodedJwt.exp</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> };</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return data;</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> } catch (error) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> console.error("获取endpoint失败:", error);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> // 如果有缓存的token,即使过期也尝试使用</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> if (tokenInfo.token) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> console.log("使用过期的缓存token");</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return tokenInfo.endpoint;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> throw error;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">function addCORSHeaders(response) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const newHeaders = new Headers(response.headers);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> for (const [key, value] of Object.entries(makeCORSHeaders())) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> newHeaders.set(key, value);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return new Response(response.body, { ...response, headers: newHeaders });</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">function makeCORSHeaders() {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Access-Control-Allow-Origin": "*", </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Access-Control-Allow-Headers": "Content-Type, x-api-key",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "Access-Control-Max-Age": "86400" </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> };</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">async function hmacSha256(key, data) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const cryptoKey = await crypto.subtle.importKey(</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> "raw",</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> key,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> { name: "HMAC", hash: { name: "SHA-256" } },</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> false,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> ["sign"]</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> );</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const signature = await crypto.subtle.sign("HMAC", cryptoKey, new TextEncoder().encode(data));</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return new Uint8Array(signature);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">async function base64ToBytes(base64) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const binaryString = atob(base64);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const bytes = new Uint8Array(binaryString.length);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> for (let i = 0; i < binaryString.length; i++) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> bytes[i] = binaryString.charCodeAt(i);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return bytes;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">async function bytesToBase64(bytes) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return btoa(String.fromCharCode.apply(null, bytes));</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">function uuid() {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return crypto.randomUUID().replace(/-/g, "");</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">async function sign(urlStr) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const url = urlStr.split("://")[1];</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const encodedUrl = encodeURIComponent(url);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const uuidStr = uuid();</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const formattedDate = dateFormat();</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const bytesToSign = `MSTranslatorAndroidApp${encodedUrl}${formattedDate}${uuidStr}`.toLowerCase();</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const decode = await base64ToBytes("oik6PdDdMnOXemTbwvMn9de/h9lFnfBaCWbGMMZqqoSaQaqUOqjVGm5NqsmjcBI1x+sS9ugjB55HEJWRiFXYFw==");</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const signData = await hmacSha256(decode, bytesToSign);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const signBase64 = await bytesToBase64(signData);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return `MSTranslatorAndroidApp::${signBase64}::${formattedDate}::${uuidStr}`;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">function dateFormat() {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const formattedDate = (new Date()).toUTCString().replace(/GMT/, "").trim() + " GMT";</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return formattedDate.toLowerCase();</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">// 添加请求超时控制</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">async function fetchWithTimeout(url, options, timeout = 30000) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const controller = new AbortController();</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const id = setTimeout(() => controller.abort(), timeout);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> </span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> try {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> const response = await fetch(url, {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> ...options,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> signal: controller.signal</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> });</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> clearTimeout(id);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> return response;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> } catch (error) {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> clearTimeout(id);</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> throw error;</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> }</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span></code></pre> <p><span style="box-sizing: border-box;"><span leaf=""><br></span></span><span leaf=""><br></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><strong style="box-sizing: border-box;font-weight: 600;"><span leaf="">特别需要注意的是顶部两行代码,设置 api key ,防止被他人滥用</span></strong></p> <p><span style="box-sizing: border-box;top: 2px;right: 8px;z-index: 2;font-size: 12px;font-weight: 500;user-select: none;color: var(--vp-code-lang-color);transition: color 0.4s, opacity 0.4s;"></span></p> <pre tabindex="0" style="white-space:pre-wrap;box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;overflow: auto;line-height: 1.75;box-shadow: rgba(110, 110, 0.45) 0px 8px;border-radius: 4px;margin: 0px;direction: ltr;text-align: left;word-spacing: normal;word-break: normal;overflow-wrap: normal;tab-size: 4;hyphens: none;z-index: 1;padding: 20px 0px;background: rgb(0, 0, 0);color: rgb(255, 255, 255);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: normal;border-radius: 2px;overflow-x: auto;background: rgb(0, 0, 0);color: rgb(255, 255, 255);font-size: var(--vp-code-font-size);padding: 0px 24px;margin: 0px;display: block;direction: ltr;text-align: left;word-spacing: normal;overflow-wrap: normal;tab-size: 4;hyphens: none;width: fit-content;min-width: 100%;line-height: var(--vp-code-line-height);transition: color 0.5s;><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">// 这是 api key,用于验证可用权限</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">const API_KEY = '';</span></span></span></code></pre> <p><span style="box-sizing: border-box;"><span leaf=""><br></span></span></p> <h2 tabindex="-1" style="box-sizing: border-box;margin: 35px 2px 10px 0px;line-height: 1.5;font-size: 24px;font-weight: 700;overflow-wrap: break-word;outline: none;border-top: 1px solid var(--vp-c-divider);padding: 6px 8px 0px 0px;letter-spacing: -0.02em;display: inline-block;background: rgb(239, 112, 96);color: rgb(255, 255, 255);border-top-right-radius: 6px;box-shadow: rgba(239, 112, 96, 0.2) 6px 3px 0px 0px;font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;><span leaf=""> 绑定自己的域名 </span></h2> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">默认绑定的域名是 </span><code style="box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: break-word;border-radius: 4px;overflow-x: auto;background-color: var(--vp-code-bg);color: var(--vp-code-color);font-size: var(--vp-code-font-size);padding: 3px 6px;transition: color 0.25s, background-color 0.5s;><span leaf="">https://输入框填写的子域名头.你的账号名.workers.dev/</span></code></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">但不幸的是该域名在国内被墙,想免翻墙使用,你需要绑定一个自己的域名。</span></p> <ol style="box-sizing: border-box;list-style: decimal;margin: 16px 0px;padding: 0px 0px 0px 28px;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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; class="list-paddingleft-1"> <li style="box-sizing: border-box;overflow-wrap: break-word;margin-bottom: 0px;list-style: inherit;padding-left: 6px;"> <section> <span leaf="">如果你还没有在 cloudflare上添加过自己的域名,可点击右上角</span><code style="box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: break-word;border-radius: 4px;overflow-x: auto;background-color: var(--vp-code-bg);color: var(--vp-code-color);font-size: var(--vp-code-font-size);padding: 3px 6px;transition: color 0.25s, background-color 0.5s;><span leaf="">添加--现有域</span></code><span leaf="">,然后输入自己的域名</span> </section></li> </ol> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/7518c3c8611166ee6cbb5a2a5d3e0214.png" class="rich_pages wxw-img" data-ratio="0.7453703703703703" data-type="other" data-w="1080" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323200"></span></p> <ol style="box-sizing: border-box;list-style: decimal;margin: 16px 0px;padding: 0px 0px 0px 28px;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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; class="list-paddingleft-1"> <li style="box-sizing: border-box;overflow-wrap: break-word;margin-bottom: 0px;list-style: inherit;padding-left: 6px;"> <section> <span leaf="">如果在cloudflare上已添加过域名,则点击左侧名称返回管理界面,添加自定义域名</span> </section></li> </ol> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/7cfe56755aa690f2f413776ee80e6c42.png" class="rich_pages wxw-img" data-ratio="0.6541436464088398" data-type="other" data-w="905" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323198"></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">点击 设置--域和路由--添加</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/0335c08c8359d07e53fc180e1cd99b7c.png" class="rich_pages wxw-img" data-ratio="0.4185185185185185" data-type="other" data-w="1080" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323201"></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">再点击自定义域,然后填写已添加到 cloudflare 的域名的子域名,例如我的域名 </span><code style="box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: break-word;border-radius: 4px;overflow-x: auto;background-color: var(--vp-code-bg);color: var(--vp-code-color);font-size: var(--vp-code-font-size);padding: 3px 6px;transition: color 0.25s, background-color 0.5s;><span leaf="">pyvideotrans.com</span></code><span leaf=""> 已添加cloudflare,那么此处我可以填写 </span><code style="box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: break-word;border-radius: 4px;overflow-x: auto;background-color: var(--vp-code-bg);color: var(--vp-code-color);font-size: var(--vp-code-font-size);padding: 3px 6px;transition: color 0.25s, background-color 0.5s;><span leaf="">ttsapi.pyvideotrans.com</span></code></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/2bd47b05ae3518cb5b6d79725b652f75.png" class="rich_pages wxw-img" data-ratio="1.0017889087656529" data-type="other" data-w="559" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323197"></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">如下图,添加完毕</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/101e15a245affd1a221c3cc94e6d5382.png" class="rich_pages wxw-img" data-ratio="1.4852255054432348" data-type="other" data-w="643" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323204"></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">此处显示你添加的自定义域</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/7812d4bcd2c095a20a6f3390f4eb8b21.png" class="rich_pages wxw-img" data-ratio="0.4648148148148148" data-type="other" data-w="1080" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323205"></span></p> <h2 tabindex="-1" style="box-sizing: border-box;margin: 35px 2px 10px 0px;line-height: 1.5;font-size: 24px;font-weight: 700;overflow-wrap: break-word;outline: none;border-top: 1px solid var(--vp-c-divider);padding: 6px 8px 0px 0px;letter-spacing: -0.02em;display: inline-block;background: rgb(239, 112, 96);color: rgb(255, 255, 255);border-top-right-radius: 6px;box-shadow: rgba(239, 112, 96, 0.2) 6px 3px 0px 0px;font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;><span leaf=""> 使用 openai sdk 测试</span></h2> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">这是兼容openai 的接口,可使用openai sdk 直接测试,如下python代码</span></p> <p><span style="box-sizing: border-box;top: 2px;right: 8px;z-index: 2;font-size: 12px;font-weight: 500;user-select: none;color: var(--vp-code-lang-color);transition: color 0.4s, opacity 0.4s;"></span></p> <pre tabindex="0" style="white-space:pre-wrap;box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;overflow: auto;line-height: 1.75;box-shadow: rgba(110, 110, 0.45) 0px 8px;border-radius: 4px;margin: 0px;direction: ltr;text-align: left;word-spacing: normal;word-break: normal;overflow-wrap: normal;tab-size: 4;hyphens: none;z-index: 1;padding: 20px 0px;background: rgb(0, 0, 0);color: rgb(255, 255, 255);><code style="white-space:pre-wrap;box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: normal;border-radius: 2px;overflow-x: auto;background: rgb(0, 0, 0);color: rgb(255, 255, 255);font-size: var(--vp-code-font-size);padding: 0px 24px;margin: 0px;display: block;direction: ltr;text-align: left;word-spacing: normal;overflow-wrap: normal;tab-size: 4;hyphens: none;width: fit-content;min-width: 100%;line-height: var(--vp-code-line-height);transition: color 0.5s;><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">import logging</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">from openai import OpenAI</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">import json</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">import httpx</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">api_key = 'adgas213423235saeg' # 替换为你的实际 API key</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">base_url = 'https://xxx.xxx.com/v1' # 替换为你的自定义域,默认加 /v1</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">client = OpenAI(</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> api_key=api_key,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> base_url=base_url</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">)</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">data = {</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> 'model': 'tts-1',</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> 'input': '你好啊,亲爱的朋友们',</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> 'voice': 'zh-CN-YunjianNeural',</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> 'response_format': 'mp3',</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> 'speed': 1.0,</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">}</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">try:</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> response = client.audio.speech.create(</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> **data</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> )</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> with open('./test_openai.mp3', 'wb') as f:</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> f.write(response.content)</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> print("MP3 file saved successfully to test_openai.mp3")</span></span></span><span leaf=""><br></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf="">except Exception as e:</span></span></span><span leaf=""><br></span><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span style="box-sizing: border-box;color: var(--shiki-light, inherit);"><span leaf=""> print(f"An error occurred: {e}")</span></span></span></code></pre> <h2 tabindex="-1" style="box-sizing: border-box;margin: 35px 2px 10px 0px;line-height: 1.5;font-size: 24px;font-weight: 700;overflow-wrap: break-word;outline: none;border-top: 1px solid var(--vp-c-divider);padding: 6px 8px 0px 0px;letter-spacing: -0.02em;display: inline-block;background: rgb(239, 112, 96);color: rgb(255, 255, 255);border-top-right-radius: 6px;box-shadow: rgba(239, 112, 96, 0.2) 6px 3px 0px 0px;font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;><span leaf=""> 搭建web界面</span></h2> <blockquote style="box-sizing: border-box;margin: 20px 0px 16px;border-left: 3px solid rgb(239, 112, 96);padding: 1px 20px;transition: border-color 0.5s;color: var(--vp-c-text-2);margin-inline: 0px;background: rgb(255, 249, 249);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;> <p style="box-sizing: border-box;margin: 0px;overflow-wrap: break-word;line-height: inherit;font-size: 16px;transition: color 0.5s;"><span leaf="">接口有了,那么如何搭建页面呢?</span></p> </blockquote> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf="">打开该项目 </span><span leaf="">https://github.com/jianchang512/tts-pyvideotrans</span><span leaf=""> 下载解压,然后将其中的 </span><code style="box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: break-word;border-radius: 4px;overflow-x: auto;background-color: var(--vp-code-bg);color: var(--vp-code-color);font-size: var(--vp-code-font-size);padding: 3px 6px;transition: color 0.25s, background-color 0.5s;><span leaf="">index.html/output.css/vue.js</span></code><span leaf=""> 3个文件放在服务器目录下,访问 index.html 即可。</span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><span leaf=""><img src="/upload/60e1f78704f8ef0f2026eabd8b55c056.png" class="rich_pages wxw-img" data-ratio="1.0599369085173502" data-type="other" data-w="634" style="box-sizing: border-box;display: block;max-width: 100%;height: auto;" data-imgfileid="300323203"></span></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><strong style="box-sizing: border-box;font-weight: 600;"><span leaf="">注意在 index.html 搜索 </span><code style="box-sizing: border-box;font-family: " jetbranins mono, monaco, consolas, courier new, monospace;word-break: break-word;border-radius: 4px;overflow-x: auto;background-color: var(--vp-code-bg);color: var(--vp-code-color);font-size: var(--vp-code-font-size);padding: 3px 6px;transition: color 0.25s, background-color 0.5s;><span leaf="">https://ttsapi.pyvideotrans.com</span></code><span leaf="">, 改为你部署在 cloudflare 的自定义域,否则无法使用</span></strong></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><strong style="box-sizing: border-box;font-weight: 600;"><span leaf=""><br></span></strong></p> <p style="box-sizing: border-box;margin: 22px 0px;overflow-wrap: break-word;line-height: inherit;color: rgb(51, 51, 51);font-family: Inter, ui-sans-serif, system-ui, sans-serif, " apple color emoji, segoe ui symbol, noto emoji;font-size: 15px;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;><strong style="box-sizing: border-box;font-weight: 600;"><span leaf=""><span textstyle="" style="color: rgb(255, 76, 65);">更好的阅读体验请访问 https://pyvideotrans.com/edgettscf</span></span></strong></p> <section> <span leaf=""><br></span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>
作者:微信小助手
<section data-role="outer" label="edit by 135editor"> <section data-tools="135编辑器" data-id="125616" data-color="#0070c0"> <section> <section data-width="80%"> <section> <section> <section class="mp_profile_iframe_wrp"> <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.05) 0%, rgba(0, 0, 0, 0) 6.76%), linear-gradient(360deg, rgba(50, 0, 0, 0.05) 0%, rgba(249, 247, 252, 0) 9.46%);background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: repeat, repeat;background-repeat-y: repeat, repeat;background-size: 20px 20px, 20px 20px;width: auto;font-family: Optima, 'Microsoft YaHei', PingFangSC-regular, serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;overflow-wrap: break-word;text-align: left;"> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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="">在数据库的世界里,MySQL 凭借其高性能、高可靠性和易用性,成为了众多开发者和企业的首选。而在 MySQL 的日常使用中,查询性能优化是提升应用响应速度、保障用户体验的关键环节。今天,就让我们一同走进 MySQL 的 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><span leaf=""> 命令,它就像一把神奇的钥匙,能帮我们打开数据库查询性能的大门,让我们看清查询背后的执行逻辑,找到优化的突破口。</span></p> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(89, 89, 89);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 5px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(222, 198, 251);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">一、初识 MySQL Explain</span></span><span style="display: none;"></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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="">当我们向 MySQL 数据库发出一个查询请求时,数据库内部会经历一系列复杂的操作来返回结果。</span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><span leaf=""> 命令的作用,就是让我们能够看到这个查询在执行前,MySQL 是如何规划它的执行路径的,也就是所谓的执行计划。简单来说,</span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><span leaf=""> 就像是给数据库查询装上了一个 “透视镜”,让我们可以提前预知查询可能会遇到的问题,从而有针对性地进行优化。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><span leaf="">,非常简单。只需要在你的 SQL 查询语句前加上 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><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 fwjhv9xmfttcqqmm52rdslianswurksshjpyh8nvib93o8hduqx6k248fjsy4mvkfko4a1ahnqr2dzckjilnflbf6x7150p2he 640?wx_fmt="svg&from=appmsg");""></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="">EXPLAIN</span></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">SELECT</span></span><span leaf=""> * </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">FROM</span></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">users</span></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">WHERE</span></span><span leaf=""> age > </span><span style="color: #d19a66;line-height: 26px;"><span leaf="">30</span></span><span leaf="">;</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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="">执行这条语句后,MySQL 就不会真正去执行查询操作,而是返回关于这个查询的执行计划信息,以表格的形式呈现给我们。</span></p> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(89, 89, 89);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 5px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(222, 198, 251);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">二、解读 Explain 的核心信息</span></span><span style="display: none;"></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><span leaf=""> 返回的结果集包含了多个字段,每个字段都蕴含着重要的信息,下面我们就来逐一解读这些关键字段:</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">1. id</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">id</span></code><span leaf=""> 是每个查询或子查询的唯一标识符。当查询比较简单时,可能只有一个 id 值;但如果查询涉及多个表的连接、子查询等情况,就会出现多个不同的 id。一般来说,id 值越大,表示该查询或子查询的执行优先级越高,先被执行。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">2. select_type</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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> <ul style="list-style-type: circle;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(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">SIMPLE</span></code><span leaf="">:简单的查询,不包含子查询和 UNION 操作。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">PRIMARY</span></code><span leaf="">:复杂查询中最外层的查询,如果查询中有子查询,这个值通常会出现在最外层查询中。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">SUBQUERY</span></code><span leaf="">:子查询,出现在 SELECT 或 WHERE 子句中的查询。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">DERIVED</span></code><span leaf="">:派生查询,也就是 FROM 子句中的子查询,MySQL 会将其结果作为一个临时表来处理。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">UNION</span></code><span leaf=""> / </span><code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">UNION RESULT</span></code><span leaf="">:用于 UNION 查询,</span><code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">UNION</span></code><span leaf=""> 表示参与 UNION 的查询,</span><code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">UNION RESULT</span></code><span leaf=""> 表示 UNION 查询的结果。</span> </section></li> </ul> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">3. table</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">4. type</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">type</span></code><span leaf=""> 是一个非常关键的字段,它表示 MySQL 访问表的方式,也就是连接类型。不同的连接类型对查询性能有着巨大的影响,常见的连接类型从好到差依次为:</span></p> <ul style="list-style-type: circle;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(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">SYSTEM</span></code><span leaf="">:系统表,非常快,因为数据量极少。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">CONST</span></code><span leaf="">:常量连接,查询条件是常量,可以直接定位到唯一一行数据。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">EQ_REF</span></code><span leaf="">:使用等值连接,并且连接条件的列上有索引,通常能高效地获取数据。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">REF</span></code><span leaf="">:非等值连接,或者等值连接但索引不是唯一索引,性能次于 EQ_REF。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">RANGE</span></code><span leaf="">:范围查询,比如 </span><code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">WHERE</span></code><span leaf=""> 子句中使用了 </span><code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">></span></code><span leaf="">、</span><code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf=""><</span></code><span leaf=""> 等条件,并且列上有索引,MySQL 会根据索引快速定位到一个数据范围。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">INDEX</span></code><span leaf="">:索引扫描,虽然使用了索引,但需要扫描整个索引树,性能不如上述几种连接类型。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">ALL</span></code><span leaf="">:全表扫描,性能最差,意味着 MySQL 要把表中的每一行数据都检查一遍,当数据量较大时,查询速度会非常慢。</span> </section></li> </ul> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">5. possible_keys</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">possible_keys</span></code><span leaf=""> 只是表示可能用到的索引,并不一定就是实际用到的索引。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">6. key</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">key</span></code><span leaf=""> 字段显示的是查询实际使用的索引。如果这个字段为 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">NULL</span></code><span leaf="">,说明查询没有使用索引,这可能是导致查询性能不佳的原因之一,需要我们重点关注并考虑是否需要创建合适的索引。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">7. key_len</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">key_len</span></code><span leaf=""> 表示查询实际使用的索引的长度。这个长度越短,通常意味着索引的选择性越好,查询性能也更优。通过这个字段,我们可以了解 MySQL 是如何使用索引的,以及索引的使用是否高效。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">8. ref</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">ref</span></code><span leaf=""> 字段会显示与索引列进行等值比较的列或常量。这个字段可以帮助我们了解查询条件是如何与索引配合使用的。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">9. rows</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">rows</span></code><span leaf=""> 字段估计了查询需要扫描的行数。这个估计值是 MySQL 根据统计信息和查询条件计算出来的,虽然不一定是精确值,但可以作为一个参考,帮助我们判断查询的大致性能。一般来说,扫描的行数越少,查询性能越好。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">10. filtered</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">filtered</span></code><span leaf=""> 表示经过查询条件过滤后,剩余数据的百分比。它的值范围是 0 到 100,值越高,说明查询条件过滤效果越好,返回的结果集越小,查询性能也更优。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">11. Extra</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">Extra</span></code><span leaf=""> 字段包含了一些额外的信息,这些信息往往对查询性能有着重要的影响。常见的值有:</span></p> <ul style="list-style-type: circle;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(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">Using index</span></code><span leaf="">:表示查询使用了覆盖索引,即查询所需的数据全部都在索引中,不需要再访问表数据,这种情况下查询性能通常较好。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">Using where</span></code><span leaf="">:表示查询使用了 </span><code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">WHERE</span></code><span leaf=""> 子句进行过滤,这是正常的查询行为,但如果与其他信息结合分析,可以帮助我们了解查询的过滤效果。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">Using join buffer</span></code><span leaf="">:表示查询使用了连接缓冲区,这通常出现在连接类型为 </span><code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">REF</span></code><span leaf=""> 或 </span><code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">EQ_REF</span></code><span leaf=""> 的情况下,如果连接缓冲区使用较多,可能意味着连接操作比较复杂,需要关注查询性能。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">Using filesort</span></code><span leaf="">:表示查询使用了文件排序,这通常出现在需要对查询结果进行排序但没有合适的索引支持排序的情况下,文件排序会消耗较多的系统资源,对查询性能影响较大,需要尽量避免。</span> </section></li> <li> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;"> <code style="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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;width: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 2px;margin-right: 2px;padding-top: 2px;padding-bottom: 2px;padding-left: 4px;padding-right: 4px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;overflow-wrap: break-word;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span leaf="">Using temporary</span></code><span leaf="">:表示查询使用了临时表,这通常出现在复杂的查询中,如包含子查询、分组、排序等情况,使用临时表会增加查询的开销,需要关注查询性能。</span> </section></li> </ul> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(89, 89, 89);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 5px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(222, 198, 251);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">三、实战案例:通过 Explain 优化查询</span></span><span style="display: none;"></span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">案例一:全表扫描引发的性能危机</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">orders</span></code><span leaf=""> 的表,存储了订单信息,表中有数百万条数据。现在我们需要查询某个客户的订单数量,执行了以下 SQL 语句:</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 fwjhv9xmfttcqqmm52rdslianswurksshjpyh8nvib93o8hduqx6k248fjsy4mvkfko4a1ahnqr2dzckjilnflbf6x7150p2he 640?wx_fmt="svg&from=appmsg");""></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="">SELECT</span></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">COUNT</span></span><span leaf="">(*) </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">FROM</span></span><span leaf=""> orders </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">WHERE</span></span><span leaf=""> customer_id = </span><span style="color: #d19a66;line-height: 26px;"><span leaf="">12345</span></span><span leaf="">;</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><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 fwjhv9xmfttcqqmm52rdslianswurksshjpyh8nvib93o8hduqx6k248fjsy4mvkfko4a1ahnqr2dzckjilnflbf6x7150p2he 640?wx_fmt="svg&from=appmsg");""></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="">+----+-------------+-------+------+---------------+------+---------+------+------+-------------+</span><span leaf=""><br></span><span leaf="">| id | select_type | table | </span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">type</span></span><span leaf=""> | possible_keys | key | key_len | ref | rows | Extra |</span><span leaf=""><br></span><span leaf="">+----+-------------+-------+------+---------------+------+---------+------+------+-------------+</span><span leaf=""><br></span><span leaf="">| 1 | SIMPLE | orders| ALL | NULL | NULL | NULL | NULL | 1000000 | Using </span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">where</span></span><span leaf=""> |</span><span leaf=""><br></span><span leaf="">+----+-------------+-------+-------+---------------+------+---------+------+------+-------------+</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">type</span></code><span leaf=""> 为 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">ALL</span></code><span leaf="">,说明这是一个全表扫描,</span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">possible_keys</span></code><span leaf=""> 和 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">key</span></code><span leaf=""> 都为 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">NULL</span></code><span leaf="">,表示没有使用索引。</span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">rows</span></code><span leaf=""> 显示需要扫描 100 万行数据,这无疑会导致查询速度非常慢。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">customer_id</span></code><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 fwjhv9xmfttcqqmm52rdslianswurksshjpyh8nvib93o8hduqx6k248fjsy4mvkfko4a1ahnqr2dzckjilnflbf6x7150p2he 640?wx_fmt="svg&from=appmsg");""></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">CREATE</span></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">INDEX</span></span><span leaf=""> idx_customer_id </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">ON</span></span><span leaf=""> orders(customer_id);</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><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 fwjhv9xmfttcqqmm52rdslianswurksshjpyh8nvib93o8hduqx6k248fjsy4mvkfko4a1ahnqr2dzckjilnflbf6x7150p2he 640?wx_fmt="svg&from=appmsg");""></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="">+----+-------------+-------+------+---------------+---------+---------+------+------+-------------+</span><span leaf=""><br></span><span leaf="">| id | select_type | table | </span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">type</span></span><span leaf=""> | possible_keys | key | key_len | ref | rows | Extra |</span><span leaf=""><br></span><span leaf="">+----+-------------+-------+------+---------------+---------+---------+------+------+-------------+</span><span leaf=""><br></span><span leaf="">| 1 | SIMPLE | orders| ref | idx_customer_id| idx_customer_id| 4 | const| 100 | Using index |</span><span leaf=""><br></span><span leaf="">+----+-------------+-------+------+---------------+---------+---------+------+------+-------------+</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">type</span></code><span leaf=""> 变为 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">ref</span></code><span leaf="">,表示使用了索引进行等值连接,</span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">key</span></code><span leaf=""> 显示实际使用了 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">idx_customer_id</span></code><span leaf=""> 索引,</span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">rows</span></code><span leaf=""> 显示只需要扫描 100 行数据,查询性能得到了显著提升。</span></p> <h3 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;flex-direction: unset;float: unset;height: auto;justify-content: center;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 17px;color: rgb(89, 89, 89);border-bottom-color: rgb(222, 198, 251);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-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 2px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">案例二:文件排序的困扰</span></span><span style="display: none;"></span></h3> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">employees</span></code><span leaf=""> 的表,存储了员工信息,表中有几百万条数据。现在需要查询每个部门中工资最高的前 3 名员工,执行了以下 SQL 语句:</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 fwjhv9xmfttcqqmm52rdslianswurksshjpyh8nvib93o8hduqx6k248fjsy4mvkfko4a1ahnqr2dzckjilnflbf6x7150p2he 640?wx_fmt="svg&from=appmsg");""></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="">SELECT</span></span><span leaf=""> department_id, employee_id, salary</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">FROM</span></span><span leaf=""> employees</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">WHERE</span></span><span leaf=""> department_id = </span><span style="color: #d19a66;line-height: 26px;"><span leaf="">1</span></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">ORDER</span></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">BY</span></span><span leaf=""> salary </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">DESC</span></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">LIMIT</span></span><span leaf=""> </span><span style="color: #d19a66;line-height: 26px;"><span leaf="">3</span></span><span leaf="">;</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><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 fwjhv9xmfttcqqmm52rdslianswurksshjpyh8nvib93o8hduqx6k248fjsy4mvkfko4a1ahnqr2dzckjilnflbf6x7150p2he 640?wx_fmt="svg&from=appmsg");""></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="">+----+-------------+-------------+------+---------------+---------+---------+------+------+-----------------------------+</span><span leaf=""><br></span><span leaf="">| id | select_type | table | </span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">type</span></span><span leaf=""> | possible_keys | key | key_len | ref | rows | Extra |</span><span leaf=""><br></span><span leaf="">+----+-------------+-------------+------+---------------+---------+---------+------+------+-----------------------------+</span><span leaf=""><br></span><span leaf="">| 1 | SIMPLE | employees | ref | idx_department_id | idx_department_id | 4 | const | 10000 | Using </span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">where</span></span><span leaf="">; Using filesort |</span><span leaf=""><br></span><span leaf="">+----+-------------+-------------+------+---------------+---------+---------+------+------+-----------------------------+</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">Extra</span></code><span leaf=""> 字段出现了 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">Using filesort</span></code><span leaf="">,说明查询使用了文件排序。虽然 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">type</span></code><span leaf=""> 为 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">ref</span></code><span leaf="">,使用了 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">idx_department_id</span></code><span leaf=""> 索引,但由于没有合适的索引支持排序,导致需要进行文件排序,这会消耗较多的系统资源,影响查询性能。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">department_id</span></code><span leaf=""> 和 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">salary</span></code><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 fwjhv9xmfttcqqmm52rdslianswurksshjpyh8nvib93o8hduqx6k248fjsy4mvkfko4a1ahnqr2dzckjilnflbf6x7150p2he 640?wx_fmt="svg&from=appmsg");""></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">CREATE</span></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">INDEX</span></span><span leaf=""> idx_department_salary </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">ON</span></span><span leaf=""> employees(department_id, salary </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">DESC</span></span><span leaf="">);</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><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 fwjhv9xmfttcqqmm52rdslianswurksshjpyh8nvib93o8hduqx6k248fjsy4mvkfko4a1ahnqr2dzckjilnflbf6x7150p2he 640?wx_fmt="svg&from=appmsg");""></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="">+----+-------------+-------------+------+---------------+---------------------+---------+------+------+-----------------------------+</span><span leaf=""><br></span><span leaf="">| id | select_type | table | </span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">type</span></span><span leaf=""> | possible_keys | key | key_len | ref | rows | Extra |</span><span leaf=""><br></span><span leaf="">+----+-------------+-------------+------+---------------+---------------------+---------+------+------+-----------------------------+</span><span leaf=""><br></span><span leaf="">| 1 | SIMPLE | employees | ref | idx_department_salary | idx_department_salary | 8 | const | 3 | Using index |</span><span leaf=""><br></span><span leaf="">+----+-------------+-------------+------+---------------+---------------------+---------+------+------+-----------------------------+</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">Extra</span></code><span leaf=""> 字段变成了 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">Using index</span></code><span leaf="">,表示查询使用了覆盖索引,不需要再访问表数据,查询性能得到了极大的提升。</span></p> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"></span><span style="font-size: 18px;color: rgb(89, 89, 89);line-height: 1.8em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: solid;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 5px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(222, 198, 251);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;box-shadow: none;display: block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">四、总结</span></span><span style="display: none;"></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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="">MySQL 的 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><span leaf=""> 命令是数据库查询性能优化的得力助手,通过解读 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><span leaf=""> 返回的执行计划信息,我们可以清晰地了解查询的执行路径、索引的使用情况以及可能存在的性能问题。在实际工作中,我们应该养成在编写 SQL 查询后,先使用 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><span leaf=""> 进行分析的习惯,及时发现并解决查询性能瓶颈,让我们的数据库应用更加高效、稳定。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(89, 89, 89);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="">希望这篇文章能帮助你更好地理解和使用 MySQL 的 </span><code style="color: rgb(145, 109, 213);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-x: no-repeat;background-repeat-y: 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="">EXPLAIN</span></code><span leaf=""> 命令,在数据库优化的道路上更进一步。如果你有任何疑问或实践经验,欢迎在评论区留言交流,让我们共同探索 MySQL 的奥秘!</span></p> </section> <section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin: 0px;padding: 0px 10px;background: none 0% 0% / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0);width: auto;font-family: PingFangSC-regular, sans-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;"> <span leaf=""><br></span> </section> <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.05) 0%, rgba(0, 0, 0, 0) 6.76%), linear-gradient(360deg, rgba(50, 0, 0, 0.05) 0%, rgba(249, 247, 252, 0) 9.46%);background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: repeat, repeat;background-repeat-y: repeat, repeat;background-size: 20px 20px, 20px 20px;width: auto;font-family: Optima, 'Microsoft YaHei', PingFangSC-regular, serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;overflow-wrap: break-word;text-align: left;"> <h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: unset;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat-x: no-repeat;background-repeat-y: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span style="display: none;"><span leaf=""><br></span></span></h2> </section> <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="lglbc2022" data-from="0" data-headimg="http://mmbiz.qpic.cn/sz_mmbiz_png/L3TFosuayYqHqhI3kVX5yJNicB3gQYEUr07zpQuiajmfCYwlhM8lnDYeC9qqtBLiab2WmtQP0cbFqlKM6sZXp06ew/0?wx_fmt=png" data-signature="专注编程分享,聊程序人生" data-id="MzU2MzYwMDI0Ng==" data-is_biz_ban="0" data-service_type="1"></mp-common-profile> </section> </section> </section> </section> </section> </section> </section> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>
作者:微信小助手
<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;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企业应用落地的私信又多了起来,目前已经从10+稳定在了 20+。承接了其中几个需求比较明确的项目,(目前3月底前排期已满),剩下的小部分接受了付费咨询。</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知识库落地选择框架哪个比较好?如果选择 RAGFlow 如何进行定制化开发?如何对文档中的图片进行识别检索?如何对复杂文档进行动态分块等。</span></span></p> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img js_insertlocalimg" data-imgfileid="502125686" data-ratio="0.6212962962962963" data-s="300,640" src="/upload/4126427f2072f904be7c6452648e2669.png" data-type="png" data-w="1080" type="block"> </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: 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="">关于选择什么框架的问题,仁者见仁,需要综合对比的盆友可以参考我之前发的那篇文章<a style="" href="https://mp.weixin.qq.com/s?__biz=MzI1ODIxNjk1OQ==&mid=2649609230&idx=1&sn=6a5dbe073b88fd7ebc670bef39aff788&scene=21#wechat_redirect" textvalue="企业RAG落地避坑指南:自主开发 vs 三大框架,核心配置与选型全解析" data-itemshowtype="0" target="_blank" linktype="text" data-linktype="2">企业RAG落地避坑指南:自主开发 vs 三大框架,核心配置与选型全解析</a>。这篇以 RAGFlow 框架为例,针对上述后三个问题结合目前团队实践经验,给各位做个分享,大家辨证参考。</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 leaf="" 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;">毕竟,RAG并没有“一招鲜”的神奇魔法,传说那几个大厂手里掌握的RAG”核心技术“,私以为也是经过了必要且复杂的“策略优化-管道设计-训练-调优-发布”等专业开发流程,不过成熟的开源应用框架,无疑是更有想象空间的社会化大创新。</span></p> <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></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;"><strong><em><span leaf="" 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 textstyle="" style="font-weight: normal;font-style: normal;">以下,enjoy:</span></span></em></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%;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) 25%,rgb(73, 200, 149) 10%);"><span leaf=""> </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="">以上篇介绍的机械加工行业的维保场景为例<a style="" href="https://mp.weixin.qq.com/s?__biz=MzI1ODIxNjk1OQ==&mid=2649609292&idx=1&sn=b0441f3eebf7bd234cf70385263e4ad5&scene=21#wechat_redirect" textvalue="RAGFlow+DeepSeek-R1:14b落地案例分享(足够详细):机加工行业设备维保场景" data-itemshowtype="0" target="_blank" linktype="text" data-linktype="2">RAGFlow+DeepSeek-R1:14b落地案例分享(足够详细):机加工行业设备维保场景</a>,推荐先采用官方的 Python API 进行合理的优化配置后,再修改项目源码,最后根据业务目标做必要的高级优化拓展。此处附上一张个人项目实施过程中积累的些优化要点,供各位参考:</span></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/3ec7225f22a1fe695c2bebc8a1774bae.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.40925925925925927" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125684"> </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="">1.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=""> </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="">阶段一:API 优化配置</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="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="">1.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=""> </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="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="">1.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=""> </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="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) 50%,rgb(73, 200, 149) 10%);"><span leaf=""> </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="">6 个官方 Python API 优化全解析</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: left;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="">根据 RAGFlow 官方 Python API 文档,为大家完整梳理了所有可进行 API 优化的模块和参数。这些 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: left;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></span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/5358425bd5c2023ce2401551b7b48c31.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.5574074074074075" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125683"> </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="ruby"><code><span leaf=""><span class="code-snippet__symbol">https:</span><span class="code-snippet__plaintext">/</span><span class="code-snippet__regexp">/ragflow.io/docs/dev/python</span><span class="code-snippet__plaintext">_api_reference</span></span></code></pre> </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="">2.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=""> </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(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="">创建数据集 create_dataset</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="">RAGFlow.create_dataset(</span></code><code><span leaf=""> name: str,</span></code><code><span leaf=""> avatar: str = "",</span></code><code><span leaf=""> description: str = "",</span></code><code><span leaf=""> embedding_model: str = "BAAI/bge-large-zh-v1.5",</span></code><code><span leaf=""> language: str = "English",</span></code><code><span leaf=""> permission: str = "me", </span></code><code><span leaf=""> chunk_method: str = "naive",</span></code><code><span leaf=""> parser_config: DataSet.ParserConfig = None</span></code><code><span leaf="">)</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 leaf="" 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 textstyle="" style="font-weight: bold;">优化参数:</span></span></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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="">embedding_model: 选择合适的嵌入模型,影响检索质量</span></span></p></li> </ul> <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="">中文场景推荐: "BAAI/bge-large-zh-v1.5"</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="">英文场景可选: "BAAI/bge-large-en-v1.5"</span></span></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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="">language: 选择与文档匹配的语言</span></span></p></li> </ul> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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="">chunk_method: 关键参数,根据文档类型选择最佳分块策略</span></span></p></li> </ul> <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="">"naive": 通用文档</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="">"paper": 论文/设备手册</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="">"book": 结构化书籍</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="">"table": 表格数据</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="">"qa": 问答格式文档</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="">"picture": 图片文档</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="">"one": 整个文档作为一个块</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="">"knowledge_graph": 知识图谱</span></span></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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="">parser_config: 精细调整解析配置</span></span></p></li> </ul> <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="">chunk_token_num: 控制分块大小 </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="">delimiter: 自定义分隔符 </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="">layout_recognize: 是否启用布局识别 </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="">raptor: 高级解析选项</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="">更新数据集 DataSet.update</span></span></strong></span></strong></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=""><span class="code-snippet__plaintext">DataSet.update(update_message : </span><span class="code-snippet__built_in">dict</span><span class="code-snippet__plaintext">) </span></span></code></pre> </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(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 textstyle="" style="font-weight: bold;">优化参数:</span></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="">embedding_model: 更换更适合的嵌入模型 </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="">chunk_method: 调整分块策略</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=""> meta_fields: 更新元数据字段</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="">2.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=""> </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="">文件管理 (FILE MANAGEMENT)</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="">上传文档 DataSet.upload_documents</span></span></strong></span></strong></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=""><span class="code-snippet__plaintext">DataSet.upload_documents(document_list : </span><span class="code-snippet__built_in">list</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__built_in">dict</span><span class="code-snippet__plaintext">]) </span></span></code></pre> </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: 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></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="">display_name: 文件显示名,方便检索与管理 </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="">blob: 文件内容</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="">更新文档 Document.update</span></span></strong></span></strong></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=""><span class="code-snippet__plaintext">Document.update(update_message : </span><span class="code-snippet__built_in">dict</span><span class="code-snippet__plaintext">) </span></span></code></pre> </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: 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></span></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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="">chunk_method: 文档分块方法 </span></span></p></li> </ul> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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="">parser_config: 文档解析配置</span></span></p></li> </ul> <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="">对于图文文档,可设置: "layout_recognize": True</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="">对于表格文档,可设置: "html4excel": True</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> <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=""><span class="code-snippet__plaintext">DataSet.async_parse_documents(document_ids : </span><span class="code-snippet__built_in">list</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__built_in">str</span><span class="code-snippet__plaintext">]) </span></span></code></pre> </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: 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="">2.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=""> </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="">分块管理 (CHUNK MANAGEMENT)</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="">添加分块 Document.add_chunk</span></span></strong></span></strong></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="php"><code><span leaf=""><span class="code-snippet__plaintext">Document.</span><span class="code-snippet__title">add_chunk</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__attr">content</span><span class="code-snippet__plaintext">: str,</span><span class="code-snippet__attr"> important_keywords</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">list</span><span class="code-snippet__plaintext">[str] = [])</span></span></code></pre> </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: 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></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="">important_keywords: 关键词标注,增强检索相关性</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="">更新分块 Chunk.update</span></span></strong></span></strong></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=""><span class="code-snippet__plaintext">Chunk.update(update_message : </span><span class="code-snippet__built_in">dict</span><span class="code-snippet__plaintext">) </span></span></code></pre> </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: 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></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="">content: 更新分块内容 </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="">important_keywords: 更新关键词</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=""> available: 控制分块可用性</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="">检索 RAGFlow.retrieve<span textstyle="" style="color: rgb(255, 41, 65);">(关键API)</span></span></span></strong></span></strong></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="php"><code><span leaf=""><span class="code-snippet__plaintext">RAGFlow.</span><span class="code-snippet__title">retrieve</span><span class="code-snippet__plaintext">(</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> question</span><span class="code-snippet__plaintext">: str = </span><span class="code-snippet__string">""</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> dataset_ids</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">list</span><span class="code-snippet__plaintext">[str] = None,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> document_ids</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">list</span><span class="code-snippet__plaintext">[str] = None,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> page</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">int</span><span class="code-snippet__plaintext"> = </span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> page_size</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">int</span><span class="code-snippet__plaintext"> = </span><span class="code-snippet__number">30</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> similarity_threshold</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">float</span><span class="code-snippet__plaintext"> = </span><span class="code-snippet__number">0.2</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> vector_similarity_weight</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">float</span><span class="code-snippet__plaintext"> = </span><span class="code-snippet__number">0.3</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> top_k</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">int</span><span class="code-snippet__plaintext"> = </span><span class="code-snippet__number">1024</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> rerank_id</span><span class="code-snippet__plaintext">: str = None,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> keyword</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">bool</span><span class="code-snippet__plaintext"> = False,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr"> highlight</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">bool</span><span class="code-snippet__plaintext"> = False</span></span></code><code><span leaf=""><span class="code-snippet__plaintext">)</span></span></code></pre> </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: 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></span></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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: left;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="">similarity_threshold: 相似度阈值,影响召回范围</span></span></p></li> <li><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: left;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=""> vector_similarity_weight: 向量相似度权重与关键词匹配权重的比例</span></span></p></li> </ul> <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="">设置为 0-1 之间,值越大向量权重越高</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="">工业领域建议参考0.3-0.5,平衡专业术语与语义理解</span></span></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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="">top_k: 参与向量检索的 chunk 数量,影响检索范围 </span></span></p></li> <li><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="">rerank_id: 重排序模型 ID,提升检索精度 </span></span></p></li> <li><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="">keyword: <span textstyle="" style="color: rgb(255, 41, 65);">开启关键词匹配,对专业领域极其有用 </span></span></span></p></li> <li><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="">highlight: 高亮匹配内容,帮助理解匹配原因</span></span></p></li> </ul> <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="">2.4</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=""> </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(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="">创建聊天助手 RAGFlow.create_chat</span></span></strong></span></strong></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="php"><code><span leaf=""><span class="code-snippet__plaintext">RAGFlow.</span><span class="code-snippet__title">create_chat</span><span class="code-snippet__plaintext">(</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr">name</span><span class="code-snippet__plaintext">: str, </span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr">avatar</span><span class="code-snippet__plaintext">: str = </span><span class="code-snippet__string">""</span><span class="code-snippet__plaintext">, </span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr">dataset_ids</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">list</span><span class="code-snippet__plaintext">[str] = [], </span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr">llm</span><span class="code-snippet__plaintext">: Chat.LLM = None, </span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__attr">prompt</span><span class="code-snippet__plaintext">: Chat.Prompt = None</span></span></code><code><span leaf=""><span class="code-snippet__plaintext">)</span></span></code></pre> </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: 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></span></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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="">llm: LLM 模型配置</span></span></p></li> </ul> <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="">model_name: 模型名称 </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="">temperature: 温度,影响创造性 </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="">top_p: 词汇采样范围 </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="">presence_penalty: 重复惩罚 </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="">frequency_penalty: 频率惩罚 </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="">max_token: 最大输出 token 数</span></span></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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="">prompt: 提示词配置</span></span></p></li> </ul> <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="">similarity_threshold: 相似度阈值 </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="">keywords_similarity_weight: 关键词相似度权重 </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="">top_n: 提供给 LLM 的 chunk 数量 </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="">rerank_model: 重排序模型 </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: left;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="">top_k: 重排序参与的候选数量 empty_response: 无匹配时的回复 </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: left;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="">show_quote: 是否显示引用来源 </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: left;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="">prompt: 系统提示词内容</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="">更新聊天助手 Chat.update</span></span></strong></span></strong></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=""><span class="code-snippet__plaintext">Chat.update(update_message : </span><span class="code-snippet__built_in">dict</span><span class="code-snippet__plaintext">) </span></span></code></pre> </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: 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="">优化参数: 同 create_chat 中的参数</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="">2.5</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=""> </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="">会话管理 (SESSION MANAGEMENT)</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="">创建会话 Chat.create_session</span></span></strong></span></strong></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="php"><code><span leaf=""><span class="code-snippet__plaintext">Chat.</span><span class="code-snippet__title">create_session</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__attr">name</span><span class="code-snippet__plaintext">: str = </span><span class="code-snippet__string">"New session"</span><span class="code-snippet__plaintext">)</span></span></code></pre> </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(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="">提问 Session.ask</span></span></strong></span></strong></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="php"><code><span leaf=""><span class="code-snippet__plaintext">Session.</span><span class="code-snippet__title">ask</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__attr">question</span><span class="code-snippet__plaintext">: str = </span><span class="code-snippet__string">""</span><span class="code-snippet__plaintext">,</span><span class="code-snippet__attr"> stream</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">bool</span><span class="code-snippet__plaintext"> = False, **kwargs)</span></span></code></pre> </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: 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></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="">stream: 流式输出,提升用户体验</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="">**kwargs: 可传递给 prompt 中定义的变量</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="">2.6</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=""> </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="">代理管理 (AGENT MANAGEMENT)</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="">创建代理会话 Agent.create_session</span></span></strong></span></strong></p> <section class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="bash"><code><span leaf=""><span class="code-snippet__plaintext">Agent.create_session(</span><span class="code-snippet__built_in">id</span><span class="code-snippet__plaintext">, rag, **kwargs)</span></span></code></pre> </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(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="">代理提问 Session.ask</span></span></strong></span></strong></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="php"><code><span leaf=""><span class="code-snippet__plaintext">Session.</span><span class="code-snippet__title">ask</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__attr">question</span><span class="code-snippet__plaintext">: str = </span><span class="code-snippet__string">""</span><span class="code-snippet__plaintext">,</span><span class="code-snippet__attr"> stream</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__keyword">bool</span><span class="code-snippet__plaintext"> = False)</span></span></code></pre> </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: justify;line-height: 1.5;box-sizing: border-box !important;word-wrap: break-word !important;"><strong><strong><span leaf="" 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;">与普通会话的ask方法类似。</span></strong></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%;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) 75%,rgb(73, 200, 149) 10%);"><span leaf=""> </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=""> </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> <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="ruby"><code><span leaf=""><span class="code-snippet__comment"># 需要修改源码的示例逻辑</span></span></code><code><span leaf=""><span class="code-snippet__keyword">class</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">CustomTerminologyProcessor</span><span class="code-snippet__symbol">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">__init__</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__variable">self</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">, terminology_mapping</span></span><span class="code-snippet__plaintext">)</span><span class="code-snippet__symbol">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__variable">self</span><span class="code-snippet__plaintext">.terminology_mapping = terminology_mapping </span><span class="code-snippet__comment"># 同义词映射表</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">process_query</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__variable">self</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">, query</span></span><span class="code-snippet__plaintext">)</span><span class="code-snippet__symbol">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 专业术语标准化</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 车间俚语转换为标准术语</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> processed_query = query</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> slang, standard_term </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__variable">self</span><span class="code-snippet__plaintext">.terminology_mapping.items()</span><span class="code-snippet__symbol">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> processed_query = processed_query.replace(slang, standard_term)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> processed_query</span></span></code></pre> </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: 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></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="">需要在 RAGFlow 的查询管道中修改源码添加此功能</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=""> </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="">需要定制 Milvus 索引策略,实现基础索引层和语义索引层的混合索引:</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="ruby"><code><span leaf=""><span class="code-snippet__comment"># 这部分需要修改源码,以下是概念性代码</span></span></code><code><span leaf=""><span class="code-snippet__keyword">class</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">CustomHybridIndexBuilder</span><span class="code-snippet__symbol">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">__init__</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__variable">self</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">, vector_db_client</span></span><span class="code-snippet__plaintext">)</span><span class="code-snippet__symbol">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__variable">self</span><span class="code-snippet__plaintext">.client = vector_db_client</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">create_scalar_indices</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__variable">self</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">, collection_name, fields</span></span><span class="code-snippet__plaintext">)</span><span class="code-snippet__symbol">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 创建设备编号、故障代码等标量索引</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> field </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__symbol">fields:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__variable">self</span><span class="code-snippet__plaintext">.client.create_index(collection_name, field, </span><span class="code-snippet__string">"scalar"</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">create_vector_indices</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__variable">self</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">, collection_name, fields</span></span><span class="code-snippet__plaintext">)</span><span class="code-snippet__symbol">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 创建向量索引</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> field </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__symbol">fields:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__variable">self</span><span class="code-snippet__plaintext">.client.create_index(collection_name, field, {</span><span class="code-snippet__string">"index_type"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"HNSW"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"params"</span><span class="code-snippet__plaintext">: {</span><span class="code-snippet__string">"M"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__number">16</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"efConstruction"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__number">200</span><span class="code-snippet__plaintext">}})</span></span></code></pre> </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: 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></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="">修改 RAGFlow 的索引构建模块扩展</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=""> Milvus 客户端接口以支持多索引策略</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.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=""> </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> <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=""><span class="code-snippet__comment"># 查询路由器 - 需要源码修改实现</span></span></code><code><span leaf=""><span class="code-snippet__keyword">class</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">QueryRouter</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">route_query</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params">self, query_text</span><span class="code-snippet__plaintext">):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> self._is_equipment_code(query_text):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"exact_match"</span><span class="code-snippet__plaintext">, {</span><span class="code-snippet__string">"field"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"equipment_code"</span><span class="code-snippet__plaintext">}</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">elif</span><span class="code-snippet__plaintext"> self._is_fault_code(query_text):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"exact_match"</span><span class="code-snippet__plaintext">, {</span><span class="code-snippet__string">"field"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"fault_code"</span><span class="code-snippet__plaintext">}</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">elif</span><span class="code-snippet__plaintext"> self._is_parameter_query(query_text):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"parameter_lookup"</span><span class="code-snippet__plaintext">, {</span><span class="code-snippet__string">"field"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"parameter_name"</span><span class="code-snippet__plaintext">}</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">else</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"semantic_search"</span><span class="code-snippet__plaintext">, {</span><span class="code-snippet__string">"model"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"embedding_model"</span><span class="code-snippet__plaintext">}</span></span></code></pre> </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: 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></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="">在 RAGFlow 的查询处理流程中添加查询分类和路由机制</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="">3.4</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=""> </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> <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=""><span class="code-snippet__comment"># 上下文增强器 - 需要修改源码实现</span></span></code><code><span leaf=""><span class="code-snippet__keyword">class</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">ContextEnhancer</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">enhance_query</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__plaintext">self, query, session_history, equipment_metadata=</span></span><span class="code-snippet__params"><span class="code-snippet__literal">None</span></span><span class="code-snippet__plaintext">):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 添加设备上下文信息</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> equipment_metadata:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> query_context = </span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"设备型号: </span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">{equipment_metadata[</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__string">'model'</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">]}</span></span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">, 生产年份: </span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">{equipment_metadata[</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__string">'year'</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">]}</span></span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">\n"</span></span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> query_context += query</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 添加历史查询信息</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> session_history:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> relevant_history = self._extract_relevant_history(session_history, query)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> query_context = </span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"参考历史信息: </span></span><span class="code-snippet__string"><span class="code-snippet__subst">{relevant_history}</span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">\n"</span></span><span class="code-snippet__plaintext"> + query_context</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> query_context</span></span></code></pre> </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: 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></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%;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) 100%,rgb(73, 200, 149) 10%);"><span leaf=""> </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="">依然是两种方案,直接使用RAGFlow API方案优势是更简单,使用现有功能,无需额外的模型调用,也能够直接显示原始图片,视觉效果更好,处理速度更快,不依赖外部 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></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/c46be8fd9c2ca955e636ab9ace25de34.jpg" class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.2309058614564832" data-s="300,640" data-type="jpeg" data-w="563" type="block" data-imgfileid="502125687"> </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: 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.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=""> </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 class="code-snippet__fix code-snippet__js"> <ul class="code-snippet__line-index code-snippet__js"> </ul> <pre class="code-snippet__js" data-lang="bash"><code><span leaf=""><span class="code-snippet__comment"># 使用多模态模型生成图片描述</span></span></code><code><span leaf=""><span class="code-snippet__plaintext">processor = MultimodalDocumentProcessor(api_key=</span><span class="code-snippet__string">"YOUR_API_KEY"</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext">enhanced_docs = processor.process_pdf(</span><span class="code-snippet__string">"设备手册.pdf"</span><span class="code-snippet__plaintext">)</span></span></code></pre> </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=""> </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="">使用 RAGFlow 处理和存储原始图片</span></span></strong></span></strong></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=""><span class="code-snippet__comment"># 配置保留图片的数据集</span></span></code><code><span leaf=""><span class="code-snippet__plaintext">dataset = rag_object.create_dataset(</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> name=</span><span class="code-snippet__string">"图文设备手册"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunk_method=</span><span class="code-snippet__string">"paper"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> parser_config={</span><span class="code-snippet__string">"layout_recognize"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__literal">True</span><span class="code-snippet__plaintext">}</span></span></code><code><span leaf=""><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__comment"># 上传原始PDF文档</span></span></code><code><span leaf=""><span class="code-snippet__keyword">with</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">open</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__string">"设备手册.pdf"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"rb"</span><span class="code-snippet__plaintext">) </span><span class="code-snippet__keyword">as</span><span class="code-snippet__plaintext"> f:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> dataset.upload_documents([{</span><span class="code-snippet__string">"display_name"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"设备手册.pdf"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"blob"</span><span class="code-snippet__plaintext">: f.read()}])</span></span></code></pre> </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.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=""> </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 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=""><span class="code-snippet__plaintext">assistant = rag_object.create_chat(</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> name=</span><span class="code-snippet__string">"图文设备专家"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> dataset_ids=[dataset.</span><span class="code-snippet__built_in">id</span><span class="code-snippet__plaintext">],</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> prompt=Chat.Prompt(</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> prompt=</span><span class="code-snippet__string">"""你是设备维修专家。回答时,请同时提供:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> 1. 文字描述解释故障和解决方案</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> 2. 引用相关图片,包括图片描述</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> 3. 告诉用户可以参考哪些图片获取更多信息</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> {knowledge}"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> )</span></span></code><code><span leaf=""><span class="code-snippet__plaintext">)</span></span></code></pre> </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.4</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=""> </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(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 解析器,更准确地绑定文本和相关图片</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="">实现图文混合索引:</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="">在检索结果中包含图片 URL 或直接嵌入图片</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="">修改聊天助手的响应生成逻辑,自动识别图片引用</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%;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) 100%,rgb(73, 200, 149) 10%);"><span leaf=""> </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 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;"><strong><span leaf="" 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 textstyle="" style="font-weight: normal;">RAGFlow的chunk_method参数是在数据集级别或文档级别设置的,不支持在单个文档内部动态切换不同的分块策略。但实际情况是,同一文档中的不同部分可能需要不同的处理方式,比如针对段落、图片、表格、图表等,使用单一的分块策略很难同时兼顾所有这些内容类型的特点。</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="">5.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=""> </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="">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(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="">修改 RAGFlow 的文档解析器,使其能够识别文档中的不同部分并应用不同的分块策略,但这需要深入修改 RAGFlow 的核心处理逻辑,如果没有深入理解RAGFlow的全局代码,建议不要这么做。</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="">在上传到 RAGFlow 前预处理文档,将其拆分成不同类型的子文档。例如,将设备手册拆分为纯文本部分、表格部分、图文部分等然后分别上传到不同的数据集,每个数据集使用适合的分块策略。</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="">这个方案优点是,可以充分利用RAGFlow针对不同内容类型的专门分块策略,但问题也很明显,就是文档上下文被拆分,可能影响整体理解。</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: left;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="">不使用RAGFlow 的自动分块,而是手动控制分块,使用chunk_method="one"将整个文档作为一个块导入,然后使用自定义逻辑创建更细粒度的分块。这种做法无疑可以实现最精细的控制、保留文档完整性,当然缺点就是实现上会相对麻烦。</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="">创建多个使用不同分块策略的数据集,将同一文档上传到所有这些数据集,在检索时查询所有数据集并合并结果。这种方法保持文档完整性,但创建多个使用不同分块策略的副本,会造成存储冗余,检索时需要合并多个结果集。</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="">5.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=""> </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="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 leaf="" 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;">这种方法使用RAGFlow的API但完全控制分块过程,最灵活且无需修改源码。</span> </section> <section style="text-align: center;" nodeleaf=""> <img src="/upload/54f88a45f8bd25540e3457016b3170ac.png" class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.9055555555555556" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="502125690"> </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(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="">使用 chunk_method="one"将文档整体上传保留文档的完整性和上下文关系</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="">使用 PyMuPDF 识别文档中的不同内容类型:</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="">动态创建精细分块:</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(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="">每个分块添加类型标识符[text], [table], [image]等</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="">丰富关键词提取:</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=""><br></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);"> <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 leaf="" 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;">回顾23年和24年国内大部分中小企业对大模型应用落地的态度,大抵是23年在观望,24年上半年利润和数字化底座都不错企业开始内部小范围试错,发现效果不达预期后,要么放弃,要么就试图寻找一些外部解决方案。但对于大部分公司而言,大模型在企业应用落地受限于比较贵的部署成本和复杂的技术门槛迟迟没有提上日程,DeepSeek的1/20开源之后,正在改变这一局面,此刻我们或许也正处于一个关键的转折点之上。</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 leaf="" 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;">RAG的落地优化需要群策群力先前试着建了微信群和小红书的群,活跃度比较差,本想搜个知识星球加入交流下,一时也没搜到,于是我就建了个,希望能吸引到一线的从业人员或者其他的积极行动者们充分交流。年费499,限时3天免费体验,有点小贵,新手慎入。</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 leaf="" 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></p> <ul style="list-style-type: disc;" class="list-paddingleft-1"> <li><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 leaf="" 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;">已落地项目(目前有3个)中的技术方案及部分源码;</span></p></li> <li><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 leaf="" 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></p></li> <li><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 leaf="" 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;">RAG相关系列论文和框架解读;</span></p></li> <li><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 leaf="" 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></p></li> </ul> <section style="text-align: center;" nodeleaf=""> <img src="/upload/23e872597b8a95b39cd0d2bbaea9aa66.jpg" class="rich_pages wxw-img" data-ratio="1.6092436974789917" data-s="300,640" data-type="jpeg" data-w="714" type="block" data-imgfileid="502125693"> </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: 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=""><br></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=""><span class="code-snippet__keyword">from</span><span class="code-snippet__plaintext"> ragflow_sdk </span><span class="code-snippet__keyword">import</span><span class="code-snippet__plaintext"> RAGFlow</span></span></code><code><span leaf=""><span class="code-snippet__keyword">import</span><span class="code-snippet__plaintext"> fitz </span><span class="code-snippet__comment"># PyMuPDF</span></span></code><code><span leaf=""><span class="code-snippet__keyword">import</span><span class="code-snippet__plaintext"> re</span></span></code><code><span leaf=""><span class="code-snippet__keyword">import</span><span class="code-snippet__plaintext"> pandas </span><span class="code-snippet__keyword">as</span><span class="code-snippet__plaintext"> pd</span></span></code><code><span leaf=""><span class="code-snippet__keyword">import</span><span class="code-snippet__plaintext"> io</span></span></code><code><span leaf=""><span class="code-snippet__keyword">import</span><span class="code-snippet__plaintext"> logging</span></span></code><code><span leaf=""><span class="code-snippet__keyword">from</span><span class="code-snippet__plaintext"> typing </span><span class="code-snippet__keyword">import</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__type">List</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__type">Dict</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__type">Any</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__type">Tuple</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext">logging.basicConfig(level=logging.INFO, </span><span class="code-snippet__built_in">format</span><span class="code-snippet__plaintext">=</span><span class="code-snippet__string">'%(asctime)s - %(name)s - %(levelname)s - %(message)s'</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext">logger = logging.getLogger(__name__)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__keyword">class</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">DynamicChunker</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""针对混合格式文档的自定义分块器"""</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">__init__</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__plaintext">self, api_key: </span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">, base_url: </span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__plaintext">):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> self.rag_object = RAGFlow(api_key=api_key, base_url=base_url)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">process_document</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__plaintext">self, pdf_path: </span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">, dataset_name: </span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext"> = </span></span><span class="code-snippet__params"><span class="code-snippet__literal">None</span></span><span class="code-snippet__plaintext">) -> </span><span class="code-snippet__built_in">str</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""处理PDF文档并实现自定义分块"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 1. 创建或获取数据集</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> dataset_name:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> datasets = self.rag_object.list_datasets(name=dataset_name)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> datasets:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> dataset = datasets[</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> logger.info(</span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"使用现有数据集: </span></span><span class="code-snippet__string"><span class="code-snippet__subst">{dataset.name}</span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">, ID: </span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">{dataset.</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__built_in">id</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">}</span></span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">"</span></span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">else</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> dataset = self.rag_object.create_dataset(</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> name=dataset_name,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> embedding_model=</span><span class="code-snippet__string">"BAAI/bge-large-zh-v1.5"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> language=</span><span class="code-snippet__string">"Chinese"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunk_method=</span><span class="code-snippet__string">"one"</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 使用"one"方式,保持文档完整性</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> )</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> logger.info(</span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"创建新数据集: </span></span><span class="code-snippet__string"><span class="code-snippet__subst">{dataset.name}</span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">, ID: </span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">{dataset.</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__built_in">id</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">}</span></span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">"</span></span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">else</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> dataset = self.rag_object.create_dataset(</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> name=</span><span class="code-snippet__string">"混合文档库"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> embedding_model=</span><span class="code-snippet__string">"BAAI/bge-large-zh-v1.5"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> language=</span><span class="code-snippet__string">"Chinese"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunk_method=</span><span class="code-snippet__string">"one"</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> )</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> logger.info(</span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"创建新数据集: </span></span><span class="code-snippet__string"><span class="code-snippet__subst">{dataset.name}</span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">, ID: </span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">{dataset.</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__built_in">id</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">}</span></span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">"</span></span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 2. 上传文档</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">with</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">open</span><span class="code-snippet__plaintext">(pdf_path, </span><span class="code-snippet__string">"rb"</span><span class="code-snippet__plaintext">) </span><span class="code-snippet__keyword">as</span><span class="code-snippet__plaintext"> f:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> document_blob = f.read()</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> docs = dataset.upload_documents([{</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"display_name"</span><span class="code-snippet__plaintext">: pdf_path.split(</span><span class="code-snippet__string">"/"</span><span class="code-snippet__plaintext">)[-</span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">],</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"blob"</span><span class="code-snippet__plaintext">: document_blob</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> }])</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">not</span><span class="code-snippet__plaintext"> docs:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> logger.error(</span><span class="code-snippet__string">"文档上传失败"</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__literal">None</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> doc = docs[</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> logger.info(</span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"文档上传成功, ID: </span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">{doc.</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__built_in">id</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">}</span></span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">"</span></span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 3. 分析文档结构并创建自定义分块</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunks = self._create_custom_chunks(pdf_path)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> logger.info(</span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"创建了 </span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">{</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__built_in">len</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">(chunks)}</span></span></span><span class="code-snippet__string"><span class="code-snippet__plaintext"> 个自定义分块"</span></span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 4. 手动添加分块到文档</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunk_ids = []</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> chunk </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> chunks:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> content = chunk[</span><span class="code-snippet__string">"content"</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> keywords = chunk[</span><span class="code-snippet__string">"keywords"</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunk_type = chunk[</span><span class="code-snippet__string">"type"</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 添加分块类型标记以便未来检索</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> content_with_marker = </span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"[</span></span><span class="code-snippet__string"><span class="code-snippet__subst">{chunk_type}</span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">]\n</span></span><span class="code-snippet__string"><span class="code-snippet__subst">{content}</span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">"</span></span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 添加分块</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> new_chunk = doc.add_chunk(</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> content=content_with_marker,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> important_keywords=keywords</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> )</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunk_ids.append(new_chunk.</span><span class="code-snippet__built_in">id</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> logger.info(</span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"添加分块: 类型=</span></span><span class="code-snippet__string"><span class="code-snippet__subst">{chunk_type}</span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">, ID=</span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">{new_chunk.</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__built_in">id</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">}</span></span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">, 关键词数量=</span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">{</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__built_in">len</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">(keywords)}</span></span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">"</span></span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> doc.</span><span class="code-snippet__built_in">id</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">_create_custom_chunks</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__plaintext">self, pdf_path: </span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__plaintext">) -> </span><span class="code-snippet__type">List</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__type">Dict</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__built_in">str</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__type">Any</span><span class="code-snippet__plaintext">]]:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""分析PDF并创建自定义分块"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> pdf_doc = fitz.</span><span class="code-snippet__built_in">open</span><span class="code-snippet__plaintext">(pdf_path)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunks = []</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 用于存储当前上下文</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_section = </span><span class="code-snippet__string">""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_text_chunk = </span><span class="code-snippet__string">""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_table_data = []</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_keywords = []</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> page_idx, page </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">enumerate</span><span class="code-snippet__plaintext">(pdf_doc):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 提取页面文本</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> text = page.get_text()</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 检测章节标题</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> section_headers = self._detect_section_headers(text)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> section_headers:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 如果有积累的文本块,先保存</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> current_text_chunk:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunks.append({</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"content"</span><span class="code-snippet__plaintext">: current_text_chunk,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"keywords"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__built_in">list</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__built_in">set</span><span class="code-snippet__plaintext">(current_keywords)),</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"type"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"text"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"section"</span><span class="code-snippet__plaintext">: current_section</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> })</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_text_chunk = </span><span class="code-snippet__string">""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_keywords = []</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 更新当前章节</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_section = section_headers[</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_keywords.append(current_section)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 检测表格</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> tables = self._detect_tables(page)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> tables:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 如果有积累的文本块,先保存</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> current_text_chunk:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunks.append({</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"content"</span><span class="code-snippet__plaintext">: current_text_chunk,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"keywords"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__built_in">list</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__built_in">set</span><span class="code-snippet__plaintext">(current_keywords)),</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"type"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"text"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"section"</span><span class="code-snippet__plaintext">: current_section</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> })</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_text_chunk = </span><span class="code-snippet__string">""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_keywords = []</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 处理表格</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> table </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> tables:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> table_content = self._format_table(table)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> table_keywords = self._extract_keywords_from_table(table)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunks.append({</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"content"</span><span class="code-snippet__plaintext">: table_content,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"keywords"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__built_in">list</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__built_in">set</span><span class="code-snippet__plaintext">(table_keywords + current_keywords)),</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"type"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"table"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"section"</span><span class="code-snippet__plaintext">: current_section</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> })</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 检测图片</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> images = self._detect_images(page)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> img_idx, img </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">enumerate</span><span class="code-snippet__plaintext">(images):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 提取图片周围的文本作为上下文</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> img_context = self._extract_image_context(text, img[</span><span class="code-snippet__string">"bbox"</span><span class="code-snippet__plaintext">])</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 如果找到图片相关文本</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> img_context:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 如果有积累的文本块,先保存</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> current_text_chunk:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunks.append({</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"content"</span><span class="code-snippet__plaintext">: current_text_chunk,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"keywords"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__built_in">list</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__built_in">set</span><span class="code-snippet__plaintext">(current_keywords)),</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"type"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"text"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"section"</span><span class="code-snippet__plaintext">: current_section</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> })</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_text_chunk = </span><span class="code-snippet__string">""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_keywords = []</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 创建图文块</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> image_text_content = </span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"图片描述: </span></span><span class="code-snippet__string"><span class="code-snippet__subst">{img_context}</span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">\n图片位置: 第</span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">{page_idx+</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__number">1</span></span></span><span class="code-snippet__string"><span class="code-snippet__subst"><span class="code-snippet__plaintext">}</span></span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">页"</span></span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> image_keywords = self._extract_keywords(img_context)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunks.append({</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"content"</span><span class="code-snippet__plaintext">: image_text_content,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"keywords"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__built_in">list</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__built_in">set</span><span class="code-snippet__plaintext">(image_keywords + current_keywords)),</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"type"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"image"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"section"</span><span class="code-snippet__plaintext">: current_section</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> })</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 防止重复处理同一段文本</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> text = text.replace(img_context, </span><span class="code-snippet__string">""</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 处理剩余文本</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> text.strip():</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 按段落拆分</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> paragraphs = self._split_into_paragraphs(text)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> para </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> paragraphs:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(para.strip()) < </span><span class="code-snippet__number">10</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__comment"># 忽略太短的段落</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">continue</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 累积文本直到达到合适的大小</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_text_chunk += para + </span><span class="code-snippet__string">"\n\n"</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_keywords.extend(self._extract_keywords(para))</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 检查是否应该创建新的文本块</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(current_text_chunk) > </span><span class="code-snippet__number">1500</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__comment"># 大约300-500个词</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunks.append({</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"content"</span><span class="code-snippet__plaintext">: current_text_chunk,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"keywords"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__built_in">list</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__built_in">set</span><span class="code-snippet__plaintext">(current_keywords)),</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"type"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"text"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"section"</span><span class="code-snippet__plaintext">: current_section</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> })</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_text_chunk = </span><span class="code-snippet__string">""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> current_keywords = []</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 处理最后一个文本块</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> current_text_chunk:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunks.append({</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"content"</span><span class="code-snippet__plaintext">: current_text_chunk,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"keywords"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__built_in">list</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__built_in">set</span><span class="code-snippet__plaintext">(current_keywords)),</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"type"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__string">"text"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"section"</span><span class="code-snippet__plaintext">: current_section</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> })</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> chunks</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">_detect_section_headers</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__plaintext">self, text: </span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__plaintext">) -> </span><span class="code-snippet__type">List</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__built_in">str</span><span class="code-snippet__plaintext">]:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""检测章节标题"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 这是一个简化的实现,可以根据实际文档格式调整</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> header_patterns = [</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">r"^第[一二三四五六七八九十\d]+章\s*(.+)$"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">r"^\d+\.\d*\s+(.+)$"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">r"^[一二三四五六七八九十]+[、..]\s*(.+)$"</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> ]</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> headers = []</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> line </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> text.split(</span><span class="code-snippet__string">"\n"</span><span class="code-snippet__plaintext">):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> line = line.strip()</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> pattern </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> header_patterns:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">match</span><span class="code-snippet__plaintext"> = re.</span><span class="code-snippet__keyword">match</span><span class="code-snippet__plaintext">(pattern, line)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">match</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> headers.append(line)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">break</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> headers</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">_detect_tables</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params">self, page</span><span class="code-snippet__plaintext">) -> </span><span class="code-snippet__type">List</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__type">Any</span><span class="code-snippet__plaintext">]:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""检测页面中的表格"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 这里使用简化的检测逻辑,实际应用中可能需要更复杂的表格检测算法</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 例如,可以寻找包含多个垂直和水平线的区域</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> tables = []</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 简单表格检测:查找水平线和垂直线的集中区域</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 这里仅作为占位示例,实际实现会更复杂</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> horizontal_lines = []</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> vertical_lines = []</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> drawing </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> page.get_drawings():</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> item </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> drawing[</span><span class="code-snippet__string">"items"</span><span class="code-snippet__plaintext">]:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> item[</span><span class="code-snippet__string">"type"</span><span class="code-snippet__plaintext">] == </span><span class="code-snippet__string">"l"</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__comment"># 线段</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> x0, y0, x1, y1 = item[</span><span class="code-snippet__string">"rect"</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">abs</span><span class="code-snippet__plaintext">(y1 - y0) < </span><span class="code-snippet__number">2</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__comment"># 水平线</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> horizontal_lines.append((x0, y0, x1, y1))</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">elif</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">abs</span><span class="code-snippet__plaintext">(x1 - x0) < </span><span class="code-snippet__number">2</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__comment"># 垂直线</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> vertical_lines.append((x0, y0, x1, y1))</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 简单的表格判定:有足够多的水平线和垂直线</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(horizontal_lines) >= </span><span class="code-snippet__number">3</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">and</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(vertical_lines) >= </span><span class="code-snippet__number">2</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 找出所有线的边界,作为表格边界</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> min_x = </span><span class="code-snippet__built_in">min</span><span class="code-snippet__plaintext">([</span><span class="code-snippet__built_in">min</span><span class="code-snippet__plaintext">(l[</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">], l[</span><span class="code-snippet__number">2</span><span class="code-snippet__plaintext">]) </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> l </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> horizontal_lines + vertical_lines])</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> max_x = </span><span class="code-snippet__built_in">max</span><span class="code-snippet__plaintext">([</span><span class="code-snippet__built_in">max</span><span class="code-snippet__plaintext">(l[</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">], l[</span><span class="code-snippet__number">2</span><span class="code-snippet__plaintext">]) </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> l </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> horizontal_lines + vertical_lines])</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> min_y = </span><span class="code-snippet__built_in">min</span><span class="code-snippet__plaintext">([</span><span class="code-snippet__built_in">min</span><span class="code-snippet__plaintext">(l[</span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">], l[</span><span class="code-snippet__number">3</span><span class="code-snippet__plaintext">]) </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> l </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> horizontal_lines + vertical_lines])</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> max_y = </span><span class="code-snippet__built_in">max</span><span class="code-snippet__plaintext">([</span><span class="code-snippet__built_in">max</span><span class="code-snippet__plaintext">(l[</span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">], l[</span><span class="code-snippet__number">3</span><span class="code-snippet__plaintext">]) </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> l </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> horizontal_lines + vertical_lines])</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 提取表格区域的文本</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> table_rect = fitz.Rect(min_x, min_y, max_x, max_y)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> table_text = page.get_text(</span><span class="code-snippet__string">"text"</span><span class="code-snippet__plaintext">, clip=table_rect)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 简化的表格结构化(实际应用中需要更复杂的逻辑)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> table_rows = table_text.split(</span><span class="code-snippet__string">"\n"</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> table = []</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> row </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> table_rows:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> row.strip():</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> cells = row.split()</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(cells) >= </span><span class="code-snippet__number">2</span><span class="code-snippet__plaintext">: </span><span class="code-snippet__comment"># 至少有2个单元格才视为有效行</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> table.append(cells)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> table:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> tables.append(table)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> tables</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">_detect_images</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params">self, page</span><span class="code-snippet__plaintext">) -> </span><span class="code-snippet__type">List</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__type">Dict</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__built_in">str</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__type">Any</span><span class="code-snippet__plaintext">]]:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""检测页面中的图片"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> images = []</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 获取页面上的图片对象</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> img_list = page.get_images(full=</span><span class="code-snippet__literal">True</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> img_idx, img_info </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">enumerate</span><span class="code-snippet__plaintext">(img_list):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> xref = img_info[</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> base_image = page.parent.extract_image(xref)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> base_image:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 寻找图片在页面上的位置</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> img_rects = []</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> rect </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> page.get_image_rects(xref):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> img_rects.append(rect)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> img_rects:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 使用第一个找到的位置</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> bbox = img_rects[</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> images.append({</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"bbox"</span><span class="code-snippet__plaintext">: [bbox.x0, bbox.y0, bbox.x1, bbox.y1]</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> })</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> images</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">_extract_image_context</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__plaintext">self, text: </span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">, bbox: </span></span><span class="code-snippet__params"><span class="code-snippet__type">List</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">[</span></span><span class="code-snippet__params"><span class="code-snippet__built_in">float</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">], context_size: </span></span><span class="code-snippet__params"><span class="code-snippet__built_in">int</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext"> = </span></span><span class="code-snippet__params"><span class="code-snippet__number">200</span></span><span class="code-snippet__plaintext">) -> </span><span class="code-snippet__built_in">str</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""提取图片周围的文本作为上下文"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 在文本中查找可能的图片标题,如"图1","Figure 1"等</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> caption_patterns = [</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">r"图\s*\d+[\..:]?\s*(.+?)(?:\n|$)"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">r"Figure\s*\d+[\.:]?\s*(.+?)(?:\n|$)"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">r"图表\s*\d+[\..:]?\s*(.+?)(?:\n|$)"</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> ]</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> pattern </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> caption_patterns:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> matches = re.finditer(pattern, text, re.IGNORECASE)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">match</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> matches:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">match</span><span class="code-snippet__plaintext">.group(</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 如果找不到明确的图片标题,则尝试提取图片周围的文本</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 这是一个简化实现,实际应用中可能需要更复杂的逻辑</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> lines = text.split(</span><span class="code-snippet__string">"\n"</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> total_length = </span><span class="code-snippet__number">0</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> start_line = </span><span class="code-snippet__number">0</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 估计图片在文本中的位置</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 这是一个非常粗略的估计,实际应用中需要更精确的方法</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> relative_position = bbox[</span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">] / </span><span class="code-snippet__number">1000</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 假设页面高度为1000</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> target_position = </span><span class="code-snippet__built_in">int</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(text) * relative_position)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 找到大致对应的行</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> i, line </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">enumerate</span><span class="code-snippet__plaintext">(lines):</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> total_length += </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(line) + </span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># +1 for newline</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> total_length > target_position:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> start_line = </span><span class="code-snippet__built_in">max</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">, i - </span><span class="code-snippet__number">2</span><span class="code-snippet__plaintext">) </span><span class="code-snippet__comment"># 从前两行开始</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">break</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 提取上下文(当前行及其前后几行)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> context_lines = lines[</span><span class="code-snippet__built_in">max</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">, start_line):</span><span class="code-snippet__built_in">min</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(lines), start_line + </span><span class="code-snippet__number">5</span><span class="code-snippet__plaintext">)]</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"\n"</span><span class="code-snippet__plaintext">.join(line </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> line </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> context_lines </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(line.strip()) > </span><span class="code-snippet__number">5</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">_format_table</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__plaintext">self, table: </span></span><span class="code-snippet__params"><span class="code-snippet__type">List</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">[</span></span><span class="code-snippet__params"><span class="code-snippet__type">List</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">[</span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">]]</span></span><span class="code-snippet__plaintext">) -> </span><span class="code-snippet__built_in">str</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""格式化表格为文本格式"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">not</span><span class="code-snippet__plaintext"> table:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">""</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 创建pandas DataFrame</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> df = pd.DataFrame(table[</span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">:], columns=table[</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">] </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(table) > </span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">else</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__literal">None</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 转换为字符串形式</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> result = io.StringIO()</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> df.to_csv(result, sep=</span><span class="code-snippet__string">"|"</span><span class="code-snippet__plaintext">, index=</span><span class="code-snippet__literal">False</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> result.getvalue()</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">_extract_keywords_from_table</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__plaintext">self, table: </span></span><span class="code-snippet__params"><span class="code-snippet__type">List</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">[</span></span><span class="code-snippet__params"><span class="code-snippet__type">List</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">[</span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__params"><span class="code-snippet__plaintext">]]</span></span><span class="code-snippet__plaintext">) -> </span><span class="code-snippet__type">List</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__built_in">str</span><span class="code-snippet__plaintext">]:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""从表格中提取关键词"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> keywords = []</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 表头作为关键词</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> table </span><span class="code-snippet__keyword">and</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(table) > </span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> keywords.extend(table[</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">])</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 第一列可能是行标题,也加入关键词</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> row </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> table[</span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">:] </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(table) > </span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">else</span><span class="code-snippet__plaintext"> []:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> row </span><span class="code-snippet__keyword">and</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(row) > </span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> keywords.append(row[</span><span class="code-snippet__number">0</span><span class="code-snippet__plaintext">])</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> keywords</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">_split_into_paragraphs</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__plaintext">self, text: </span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__plaintext">) -> </span><span class="code-snippet__type">List</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__built_in">str</span><span class="code-snippet__plaintext">]:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""将文本拆分为段落"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 按照多个换行符拆分</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> paragraphs = re.split(</span><span class="code-snippet__string">r"\n\s*\n"</span><span class="code-snippet__plaintext">, text)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> [p.strip() </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> p </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> paragraphs </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> p.strip()]</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">def</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__title">_extract_keywords</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__params"><span class="code-snippet__plaintext">self, text: </span></span><span class="code-snippet__params"><span class="code-snippet__built_in">str</span></span><span class="code-snippet__plaintext">) -> </span><span class="code-snippet__type">List</span><span class="code-snippet__plaintext">[</span><span class="code-snippet__built_in">str</span><span class="code-snippet__plaintext">]:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__string">"""从文本中提取关键词"""</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 这是一个简化的关键词提取方法</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 实际应用中可以使用更复杂的NLP技术,如TF-IDF、TextRank等</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 1. 移除停用词和标点</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> stop_words = {</span><span class="code-snippet__string">"的"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"了"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"和"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"与"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"或"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"在"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"是"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"有"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"被"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"将"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"把"</span><span class="code-snippet__plaintext">}</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> cleaned_text = re.sub(</span><span class="code-snippet__string">r'[^\w\s]'</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">' '</span><span class="code-snippet__plaintext">, text)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> words = cleaned_text.split()</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> filtered_words = [w </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> w </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> words </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> w </span><span class="code-snippet__keyword">not</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> stop_words </span><span class="code-snippet__keyword">and</span><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">len</span><span class="code-snippet__plaintext">(w) > </span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 2. 简单词频统计</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> word_count = {}</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> word </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> filtered_words:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> word </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> word_count:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> word_count[word] += </span><span class="code-snippet__number">1</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">else</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> word_count[word] = </span><span class="code-snippet__number">1</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__comment"># 3. 选择频率最高的几个词作为关键词</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> sorted_words = </span><span class="code-snippet__built_in">sorted</span><span class="code-snippet__plaintext">(word_count.items(), key=</span><span class="code-snippet__keyword">lambda</span><span class="code-snippet__plaintext"> x: x[</span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">], reverse=</span><span class="code-snippet__literal">True</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__keyword">return</span><span class="code-snippet__plaintext"> [word </span><span class="code-snippet__keyword">for</span><span class="code-snippet__plaintext"> word, count </span><span class="code-snippet__keyword">in</span><span class="code-snippet__plaintext"> sorted_words[:</span><span class="code-snippet__number">10</span><span class="code-snippet__plaintext">] </span><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> count > </span><span class="code-snippet__number">1</span><span class="code-snippet__plaintext">]</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__comment"># 使用示例</span></span></code><code><span leaf=""><span class="code-snippet__keyword">if</span><span class="code-snippet__plaintext"> __name__ == </span><span class="code-snippet__string">"__main__"</span><span class="code-snippet__plaintext">:</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> chunker = DynamicChunker(</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> api_key=</span><span class="code-snippet__string">"YOUR_API_KEY"</span><span class="code-snippet__plaintext">,</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> base_url=</span><span class="code-snippet__string">"http://YOUR_BASE_URL:9380"</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> )</span></span></code><code><span leaf=""><br></span></code><code><span leaf=""><span class="code-snippet__plaintext"> doc_id = chunker.process_document(</span><span class="code-snippet__string">"设备维修手册.pdf"</span><span class="code-snippet__plaintext">, </span><span class="code-snippet__string">"动态分块测试"</span><span class="code-snippet__plaintext">)</span></span></code><code><span leaf=""><span class="code-snippet__plaintext"> </span><span class="code-snippet__built_in">print</span><span class="code-snippet__plaintext">(</span><span class="code-snippet__string"><span class="code-snippet__plaintext">f"处理完成,文档ID: </span></span><span class="code-snippet__string"><span class="code-snippet__subst">{doc_id}</span></span><span class="code-snippet__string"><span class="code-snippet__plaintext">"</span></span><span class="code-snippet__plaintext">)</span></span></code></pre> </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: 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=""><br></span></span></p> <section 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 leaf="" 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;"><br></span> </section> <p style="display: none;"> <mp-style-type data-value="3"></mp-style-type></p>
作者:微信小助手
<section style="font-size: 14px;color: rgb(62, 62, 62);"> <section style="margin: 10px 0% 8px;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"> <section style="display: inline-block;width: 100%;vertical-align: top;border-left: 3px solid rgb(219, 219, 219);border-bottom-left-radius: 0px;padding-left: 8px;align-self: flex-start;flex: 0 0 auto;"> <section style="color: rgba(0, 0, 0, 0.5);font-size: 13px;text-align: justify;"> <p>作者:来自 vivo 互联网服务器团队- Cai Linfeng</p> </section> </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>本文介绍了服务端在搭建 Web 版的百万人级别的群聊系统时,遇到的技术挑战和解决思路,内容包括:通信方案选型、消息存储、消息有序性、消息可靠性、未读数统计。</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><strong>一、引言</strong></p> </section> </section> <p><br></p> <p>现在IM群聊产品多种多样,有国民级的微信、QQ,企业级的钉钉、飞书,还有许多公司内部的IM工具,这些都是以客户端为主要载体,而且群聊人数通常都是有限制,微信正常群人数上限是500,QQ2000人,收费能达到3000人,这里固然有产品考量,但技术成本、资源成本也是很大的因素。而笔者业务场景上需要一个迭代更新快、轻量级(不依赖客户端)、单群百万群成员的纯H5的IM产品,本文将回顾实现一个百万人量级的群聊,服务器侧需要考虑的设计要点,希望可以给到读者一些启发。</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><strong>二、背景介绍</strong></p> </section> </section> <p><br></p> <p>不同的群聊产品,采用的技术方案是不同的,为了理解接下来的技术选型,需要先了解下这群聊产品的特性。</p> <section style="margin-top: 10px;margin-bottom: 10px;"> <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="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>单群成员需要支撑百万人,同时在线百万级。</p></li> <li><p>功能、体验要接近纯客户端实现方案。</p></li> <li><p>用户端完全用H5承载。</p></li> </ol> </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><strong>三、通信技术</strong></p> </section> </section> <p><br></p> <p>即时通信常见的通信技术有短轮询、长轮询、Server-Sent Events(SSE)、Websocket。短轮询和长轮询适用于实时性要求不高的场景,比如论坛的消息提醒。SSE 适用于服务器向客户端单向推送的场景,如实时新闻、股票行情。Websocket 适用于实时双向通信的场景,实时性好,且服务端、前端都有比较成熟的三方包,如 socket.io,所以这块在方案选择中是比较 easy 的,前后端使用 Websocket 来实现实时通信。</p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="padding-left: 1em;padding-right: 1em;display: inline-block;text-align: center;"> <span style="display: inline-block;padding: 0.3em 0.5em;border-radius: 0.5em;font-size: 12px;text-shadow: rgb(204, 204, 204) 4px 3px;color: rgb(65, 95, 255);" title=""><p>彩蛋提醒</p></span> </section> <section style="border-width: 1px;border-style: solid;border-color: rgb(192, 200, 209);margin-top: -1em;padding: 20px 10px 10px;background-color: rgb(239, 239, 239);text-align: center;"> <p>我们为大家准备了抽奖福利,请继续阅读下去。</p> </section> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;text-align: center;"> <section style="padding: 3px;display: inline-block;border-bottom: 1px solid rgb(65, 94, 255);font-size: 17px;color: rgb(65, 94, 255);"> <p><strong>四、消息存储</strong></p> </section> </section> <p><br></p> <p>群聊消息的保存方式,主流有2种方式:读扩散、写扩散。图1展示了它们的区别,区别就在于消息是写一次还是写N次,以及如何读取。</p> <p><br></p> <section style="text-align: center;margin-top: 10px;margin-bottom: 10px;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img class="rich_pages wxw-img" data-imgfileid="100016471" data-ratio="0.30092592592592593" data-s="300,640" src="/upload/0973cd46db09cad4cd1dccfe5d2276b3.png" data-type="png" data-w="1080" style="vertical-align: middle;width: 100%;"> </section> </section> <section style="text-align: center;font-size: 12px;color: rgb(204, 204, 204);"> <p>图1</p> </section> <section> <p><strong><br></strong></p> <p><span style="color: rgb(65, 94, 255);">读扩散</span>就是所有群成员共用一个群信箱,当一个群产生一条消息时,只需要写入这个群的信箱即可,所有群成员从这一个信箱里读取群消息。</p> <p><br>优点是写入逻辑简单,存储成本低,写入效率高。缺点是读取逻辑相对复杂,要通过消息表与其他业务表数据聚合;消息定制化处理复杂,需要额外的业务表;可能还有IO热点问题。</p> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <p>举个例子:</p> <p>很常见的场景,展示用户对消息的已读未读状态,这个时候公共群信箱就无法满足要求,必须增加消息已读未读表来记录相关状态。还有用户对某条消息的删除状态,用户可以选择删除一条消息,但是其他人仍然可以看到它,此时也不适合在公共群信箱里拓展,也需要用到另一张关系表,总而言之针对消息做用户特定功能时就会比写扩散复杂。</p> </section> </section> </section> <p><span style="color: rgb(65, 94, 255);">写扩散</span>就是每个群成员拥有独立的信箱,每产生一条消息,需要写入所有群成员信箱,群成员各自从自己的信箱内读取群消息。<br>优点是读取逻辑简单,适合消息定制化处理,不存在IO热点问题。缺点是写入效率低,且随着群成员数增加,效率降低;存储成本大。</p> <p><br></p> <p>所以当单群成员在万级以上时,用写扩散就明显不太合适了,写入效率太低,而且可能存在很多无效写入,不活跃的群成员也必须得有信箱,存储成本是非常大的,因此采用读扩散是比较合适的。</p> <p><br></p> <section style="margin: 10px 0% 8px;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"> <section style="display: inline-block;width: 100%;border-left: 3px solid rgb(65, 94, 255);border-bottom-left-radius: 0px;padding-left: 8px;vertical-align: top;align-self: flex-start;flex: 0 0 auto;"> <section style="color: rgba(0, 0, 0, 0.5);font-size: 13px;text-align: justify;"> <p>据了解,微信是采用写扩散模式,微信群设定是500人上限,写扩散的缺点影响就比较小。</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><strong>五、架构设计</strong></p> </section> </section> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.1 整体架构</span></p> </section> <p><br></p> <p>先来看看群聊的架构设计图,如图2所示:</p> <p><br></p> <section style="text-align: center;margin-top: 10px;margin-bottom: 10px;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img class="rich_pages wxw-img" data-imgfileid="100016472" data-ratio="0.7398148148148148" data-s="300,640" src="/upload/77718277c0cc3339d128dda89de7a552.png" data-type="png" data-w="1080" style="vertical-align: middle;width: 100%;"> </section> </section> <section style="text-align: center;color: rgb(204, 204, 204);"> <p>图2</p> </section> <p><br></p> <p>从用户登录到发送消息,再到群用户收到这条消息的系统流程如图3所示:</p> <p><br></p> <section style="text-align: center;margin-top: 10px;margin-bottom: 10px;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img class="rich_pages wxw-img" data-imgfileid="100016469" data-ratio="0.4009259259259259" data-s="300,640" src="/upload/4992eb2f84daffbd292fd989f52c5352.png" data-type="png" data-w="1080" style="vertical-align: middle;width: 100%;"> </section> </section> <section style="text-align: center;color: rgb(204, 204, 204);"> <p>图3</p> </section> <p><br></p> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>用户登录,通过负载均衡,与<span style="color: rgb(65, 94, 255);">连接服务</span>建立 Websocket 长连接。</p></li> <li><p><span style="color: rgb(65, 94, 255);">连接服务</span>管理会话,管理群与用户的映射关系,在本地内存里使用哈希表存储,key为groupId,value为List<socketioclient> ,同一个群的用户可能会在不同的集群服务器上。 </socketioclient></p></li> <li><p><span style="color: rgb(65, 94, 255);">连接服务</span>向<span style="color: rgb(65, 94, 255);">群组服务</span>上报群组路由,上报它的内网IP和它所管理的 groupIdList 的关系,这里需要2种同步策略并行保证群组路由信息的准确性:a.在用户建立、断开长连接时即刻上报;b.定时上报。</p></li> <li><p><span style="color: rgb(65, 94, 255);">群组服务</span>管理群组路由,使用远程中心缓存 Redis 管理 groupId 和连接服务器IP的关系,key 为 groupId,value 为 List,该IP为连接服务的内网IP地址,这里会做上报的心跳判断,超过3个心跳周期不上报,则认为已断线。</p></li> <li><p>用户在群里发布一条消息,消息通过 Websokcet 送达<span style="color: rgb(65, 94, 255);">连接服务</span>,然后经过<span style="color: rgb(65, 94, 255);">连接服务</span>——><span style="color: rgb(65, 94, 255);">消息队列</span>——><span style="color: rgb(65, 94, 255);">群组服务</span>,消息在群组服务里经过频控、安全检查、格式转换等一系列流程后入库,持久化。</p></li> <li><p><span style="color: rgb(65, 94, 255);">群组服务</span>通过群组路由管理获取这条消息所属群的路由信息,即一组连接服务的IP地址,然后通过 HTTP 回调对应的<span style="color: rgb(65, 94, 255);">连接服务</span>,通知它们有新消息产生,这里只简单传递消息ID。</p></li> <li><p><span style="color: rgb(65, 94, 255);">连接服务</span>收到 HTTP 请求后,根据会话管理查询该群所有用户,给用户发送新消息提醒。</p></li> <li><p>用户收到新消息提醒,通过 Websocket 来<span style="color: rgb(65, 94, 255);">连接服务</span>拉取该新消息具体详情,然后根据消息协议展示在信息流里。</p></li> </ol> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.2 路由策略</span></p> </section> <p><br></p> <p>用户应该连接到哪一台连接服务呢?这个过程重点考虑如下2个问题:</p> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>尽量保证各个节点的连接均衡;</p></li> <li><p>增删节点是否要做 Rebalance。</p></li> </ol> <p><br></p> <p>保证均衡有如下几个算法:</p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p><strong>轮询</strong>:挨个将各个节点分配给客户端,但会出现新增节点分配不均匀的情况;</p></li> <li><p><strong>取模</strong>:类似于 HashMap,但也会出现轮询的问题。当然也可以像 HashMap 那样做一次 Rebalance,让所有的客户端重新连接。不过这样会导致所有的连接出现中断重连,代价有点大。由于 Hash 取模方式的问题带来了一致性 Hash 算法,但依然会有一部分的客户端需要 Rebalance;</p></li> <li><p><strong>权重</strong>:可以手动调整各个节点的负载情况,甚至可以做成自动的,基于监控当某些节点负载较高就自动调低权重,负载较低的可以提高权重;<br>笔者是采用轮询 + 权重模式,尽量保证负载均衡。</p></li> </ol> </section> </section> </section> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.3 重连机制</span></p> </section> <p><br></p> <p>当应用在扩缩容或重启升级时,在该节点上的客户端怎么处理?<br>由于设计有心跳机制,当心跳不通或监听连接断开时,就认为该节点有问题了,就尝试重新连接;如果客户端正在发送消息,那么就需要将消息临时保存住,等待重新连接上后再次发送。</p> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.4 线程策略</span></p> </section> <p><br></p> <p>将连接服务里的IO线程与业务线程隔离,提升整体性能,原因如下:</p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>充分利用多核的并行处理能力:IO线程和业务线程隔离,双方都可以并行处理网络IO和业务逻辑,充分利用计算机多核并行计算能力,提升性能;</p></li> <li><p>故障隔离:业务线程处理多种业务消息,有IO密集型,也有 CPU 密集型,有些是纯内存计算,不同的业务处理时延和故障率是不同的。如果把业务线程和IO线程合并,就会有如下问题:某类业务处理较慢,阻塞IO线程,导致其他处理较快的业务消息响应不及时;</p></li> <li><p>可维护性:IO线程和业务线程隔离之后,职责单一,有利于维护和定位问题。</p></li> </ol> </section> </section> </section> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.5 有状态链接</span></p> </section> <p><br></p> <p>在这样的场景中不像 HTTP 那样是无状态的,需要明确知道各个客户端和连接的关系。比如需要向客户端广播群消息时,首先得知道客户端的连接会话保存在哪个连接服务节点上,自然这里需要引入第三方中间件来存储这个关系。通过由连接服务主动上报给群组服务来实现,上报时机是客户端接入和断开连接服务以及周期性的定时任务。</p> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.6 群组路由</span></p> </section> <p><br></p> <p>设想这样一个场景:需要给群所有成员推送一条消息怎么做?<br>通过群编号去前面的路由 Redis 获取对应群的连接服务组,再通过 HTTP 方式调用连接服务,通过连接服务上的长连接会话进行真正的消息下发。</p> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">5.7 消息流转</span></p> </section> <p><br></p> <p>连接服务直接接收用户的上行消息,考虑到消息量可能非常大,在连接服务里做业务显然不合适,这里完全可以选择 Kafka 来解耦,将所有的上行消息直接丢到 Kafka 就不管了,消息由群组服务来处理。</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><strong>六、消息顺序</strong></p> </section> </section> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">6.1 乱序现象</span></p> </section> <p><br></p> <p>为什么要讲消息顺序,来看一个场景。假设群里有用户A、用户B、用户C、用户D,下面以 ABCD 代替,假设A发送了3条消息,顺序分别是 msg1、msg2、msg3,但B、C、D看到的消息顺序不一致,如图4所示:</p> <section style="text-align: center;margin-top: 10px;margin-bottom: 10px;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img class="rich_pages wxw-img" data-imgfileid="100016470" data-ratio="0.475" data-s="300,640" src="/upload/d35e14d1fff89e5fc05bf97c862e723d.png" data-type="png" data-w="1080" style="vertical-align: middle;width: 100%;"> </section> </section> <section style="text-align: center;color: rgb(204, 204, 204);"> <p>图4</p> </section> <p><br></p> <p>这时B、C、D肯定会觉得A在胡言乱语了,这样的产品用户必定是不喜欢的,因此必须要保证所有接收方看到的消息展示顺序是一致的。</p> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">6.2 原因分析</span></p> </section> <p><br></p> <p>所以先了解下消息发送的宏观过程:</p> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>发送方发送消息。</p></li> <li><p>服务端接收消息。</p></li> <li><p>服务端返回 ACK 消息。</p></li> <li><p>服务端推送新消息或客户端拉取新消息。</p></li> </ol> <p><br></p> <p>在上面的过程中,都可能产生顺序问题,简要分析几点原因:</p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p><strong>时钟不一致</strong>:多个客户端、服务端集群、DB集群,时钟不能保证完全一致,因此不能用本地时间来决定消息顺序。</p></li> <li><p><strong>网络传输</strong>:发送消息环节,先发后至,到达服务器的顺序可能是 msg2、msg1、msg3。</p></li> <li><p><strong>多线程</strong>:服务器考虑性能、吞吐量,往往会在多处环节采用线程池、异步去提升整体速度,因此也会产生顺序问题。</p></li> </ol> </section> </section> </section> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">6.3 解决方案</span></p> </section> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">6.3.1 单用户保持有序</span></p> </section> <p><br></p> <p>通过上面的分析可以知道,其实无法保证或是无法衡量不同用户之间的消息顺序,那么只需保证同一个用户的消息是有序的,保证上下文语义,所以可以得出一个比较朴素的实现方式:以服务端数据库的唯一自增ID为标尺来衡量消息的时序,然后让同一个用户的消息处理串行化。那么就可以通过以下几个技术手段配合来解决:</p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>发送消息使用 Websocket 发送,并且多次发送保持同一个会话,那么 tcp 协议就保证了应用层收到的消息必定是有序的。</p></li> <li><p>在应用程序内部处理时,涉及相关多线程的模块,根据 uid 进行 hash,匹配一个单线程的线程池,即同一个 uid 的消息永远用同一个线程去处理,不同用户之间仍是并行处理。</p></li> <li><p>在跨应用程序时,一般有2种处理方式:一是用 rpc 同步调用;二是利用消息中间件的全局有序。</p></li> <li><p>用户端上做消息发送频率限制,2次发送必须间隔1秒,能大大降低乱序的可能性了。</p></li> </ol> </section> </section> </section> <p><br></p> <section> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">6.3.2 推拉结合</span></p> <p><br></p> </section> <section> <p>到这里基本解决了同一个用户的消息可以按照他自己发出的顺序入库的问题,即解决了消息发送流程里第一、二步。</p> <p><br></p> <p>第三、四步存在的问题是这样的:</p> <p>A发送了 msg1、msg2、msg3,B发送了 msg4、msg5、msg6,最终服务端的入库顺序是msg1、msg2、msg4、msg3、msg5、msg6,那除了A和B其他人的消息顺序需要按照入库顺序来展示,而这里的问题是服务端考量推送吞吐量,在推送环节是并发的,即可能 msg4 比 msg1 先推送到用户端上,如果按照推送顺序追加来展示,那么就与预期不符了,每个人看到的消息顺序都可能不一致,如果用户端按照消息的id大小进行比较插入的话,用户体验将会比较奇怪,突然会在2个消息中间出现一条消息。所以这里采用推拉结合方式来解决这个问题,具体步骤如下:</p> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>用户端发出消息,服务端将消息以群维度按照消息的入库顺序缓存在 Redis 有序 SET。</p></li> <li><p>服务端推送给用户端新消息提醒,内容是该新消息的id。</p></li> <li><p>用户端拉取消息,携带2个消息id,startId 和 endId,startId:本地最新的完整消息id;endId:服务端推送得到的新消息id。</p></li> <li><p>服务端返回2个消息id区间内的消息列表。</p></li> </ol> </section> </section> </section> <p><br></p> <section style="text-align: center;margin-top: 10px;margin-bottom: 10px;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img data-imgfileid="100016468" data-ratio="0.13148148148148148" data-s="300,640" src="/upload/01986bf46dcbcde3bfeae297cbbf6abe.png" data-type="png" data-w="1080" style="vertical-align: middle;width: 100%;"> </section> </section> <section style="text-align: center;color: rgb(204, 204, 204);"> <p>图5</p> </section> <p><br></p> <section style="text-align: center;margin-top: 10px;margin-bottom: 10px;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img class="rich_pages wxw-img" data-imgfileid="100016476" data-ratio="0.36944444444444446" data-s="300,640" src="/upload/36850413c7f9a241d9351bb49216364e.png" data-type="png" data-w="1080" style="vertical-align: middle;width: 100%;"> </section> </section> <section style="text-align: center;color: rgb(204, 204, 204);"> <p>图6</p> </section> <p><br></p> <p>举例,图5表示服务端的消息顺序,图6表示用户端拉取消息时本地消息队列和提醒队列的变化逻辑。</p> <p><br></p> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>t1时刻用户本地最新的完整消息是 msg1,即这条消息已经完整展示给用户。</p></li> <li><p>t2时刻收到服务端推送的 msg3 新消息提醒,放到提醒队列,此时用户看不到这条消息。</p></li> <li><p>t3时刻向服务端拉取消息详情,请求参数为 startId:msg1,endId:msg3,服务端会按顺序一起返回2个消息区间内的所有消息的详情即 msg2、msg4、msg3,将消息详情同步写入到消息队列,此时用户可以看到刷新出3条消息。</p></li> <li><p>t4时刻用户还会收到 msg2、msg4 的新消息提醒,用户端校验消息队列已经存在 msg2、msg4 的详情,忽略该新消息提醒。</p></li> </ol> <p><br></p> <section style="margin: 10px 0% 8px;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"> <section style="display: inline-block;width: 100%;border-left: 3px solid rgb(65, 94, 255);border-bottom-left-radius: 0px;padding-left: 8px;vertical-align: top;align-self: flex-start;flex: 0 0 auto;"> <section style="color: rgba(0, 0, 0, 0.5);text-align: justify;"> <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><strong>七、消息可靠性</strong></p> </section> </section> <p><br></p> <p>在IM系统中,消息的可靠性同样非常重要,它主要体现在:</p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p><strong>消息不丢失</strong>:对发送人来说,必须保证消息能入库;对接收者来说,不管是在线还是离线,都能保证收到。但是这里的不丢失,只是说以最大努力去保证,并不是说完全不丢失。</p></li> <li><p><strong>消息不重复</strong>:这很容易理解,同一条消息不能重复出现。</p></li> </ol> </section> </section> </section> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">7.1 消息不丢失设计</span></p> </section> <p><br></p> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p><strong>传输协议保障</strong>:首先 TCP 是可靠的协议,能较大程度上保证消息不丢失。</p></li> <li><p><strong>增加ACK机制</strong>:服务端在执行完消息处理的所有流程后,给发送者发送 ACK;假如发送者在超时时间内没有收到 ACK 消息,则进行一定次数的重试,重新发送;当重发次数超过预设次数,就不再重发,消息发送失败。</p></li> <li><p><strong>最终一致性</strong>:这是对接收者而言,如果某条新消息提醒因网络等其他原因丢失,用户没有收到这条消息提醒,那么用户就不会去拉消息详情,在用户视角就是没有看到这条消息。但是当后续的新消息提醒送达时,可以依赖前面提到的拉取机制拿到一个区间内的消息列表,这里就包含了丢失的消息,因此能达到最终一致性。</p></li> </ol> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">7.2 消息不重复设计</span></p> </section> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p><strong>增加UUID</strong>:每条消息增加 UUID,由客户端创建消息时生成,同一个用户的消息 UUID 唯一。</p></li> <li><p><strong>服务端</strong>:用户 ID+UUID 在数据库做联合唯一索引,保证数据层面消息不重复。</p></li> <li><p><strong>用户端</strong>:进行兜底,构造一个map来维护已接收消息的id,当收到id重复的消息时直接丢弃。</p></li> </ol> </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><strong>八、未读数统计</strong></p> </section> </section> <p><br></p> <p>为了提醒用户有新消息,需要给用户展示新消息提醒标识,产品设计上一般有小红点、具体的数值2种方式。具体数值比小红点要复杂,这里分析下具体数值的处理方式,还需要分为初始打开群和已打开群2个场景。</p> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <p><strong>已打开群</strong>:可以完全依赖用户端本地统计,用户端获取到新消息后,就将未读数累计加1,等点进去查看后,清空未读数统计,这个比较简单。</p> </section> </section> </section> <p><br></p> <section> <p><strong>初始打开群</strong>:由于用户端采用H5开发,用户端没有缓存,没有能力缓存最近的已读消息游标,因此这里完全需要服务端来统计,在打开群时下发最新的聊天信息流和未读数,下面具体讲下这个场景下该怎么设计。</p> <p><br>既然由服务端统计未读数,那么少不了要保存用户在某个群里已经读到哪个消息,类似一个游标,用户已读消息,游标往前走。用户已读消息存储表设计如图7所示:</p> </section> <p><br></p> <section style="text-align: center;margin-top: 10px;margin-bottom: 10px;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img data-imgfileid="100016474" data-ratio="0.38055555555555554" data-s="300,640" src="/upload/3823f9a44d4aa528a4d4f11f6799fb1d.png" data-type="png" data-w="1080" style="vertical-align: middle;width: 100%;"> </section> </section> <section style="text-align: center;color: rgb(204, 204, 204);"> <p>图7</p> </section> <p><br></p> <section> <p>游标offset采用定时更新策略,连接服务会记录用户最近一次拉取到的消息ID,定时异步上报批量用户到群组服务更新 offset。</p> <p><br>该表第一行表示用户1在 id=89 的群里,最新的已读消息是id=1022消息,那么可以通过下面的SQL来统计他在这个群里的未读数:<br><span style="background-color: rgb(204, 204, 204);">select count(1) from msg_info where groupId = 89 and id > 1022</span>。但是事情并没这么简单,一个用户有很多群,每个群都要展示未读数,因此要求未读数统计的程序效率要高,不然用户体验就很差,很明显这个 SQL 的耗时波动很大,取决于 offset 的位置,如果很靠后,SQL 执行时间会非常长。笔者通过2个策略来优化这个场景:</p> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>调整产品设计:未读数最大显示调整为99+。算是产品上的一个让步,有很多产品也采用这个方案,所以用户也是有这个心智的,99+表示“有很多新消息”,至于具体多少,是几百、几千很多时候不是特别重要。所以问题就变得简单多了,只要计算游标是否在最新的100条消息以内还是以外。</p></li> <li><p>合理利用数据结构:因为有群内有很多人,每个人登录的时候都需要统计,所以每次都去查 MySQL 是比较低效的,因此笔者的方案是在 Redis 里设计一个有界的ZSET结构。</p></li> </ol> </section> </section> </section> <p><br></p> <section style="text-align: center;margin-top: 10px;margin-bottom: 10px;line-height: 0;"> <section style="vertical-align: middle;display: inline-block;line-height: 0;"> <img data-imgfileid="100016473" data-ratio="0.09537037037037037" data-s="300,640" src="/upload/3f37970becde65c0c638094f8a12b7af.png" data-type="png" data-w="1080" style="vertical-align: middle;width: 100%;"> </section> </section> <section style="text-align: center;color: rgb(204, 204, 204);"> <p>图8</p> </section> <p><br></p> <p>如上图8所示,每个群都会构建一个长度为100,score 和 member 都是消息ID,可以通过 <span style="background-color: rgb(204, 204, 204);">zrevrank</span> 命令得到某个 offset 的排名值,该值可以换算成未读数。比如:用户1在群89的未读消息数,<span style="background-color: rgb(204, 204, 204);">'zrevrank 89 1022' = 2</span>,也就是有2条未读数。用户2在群89的未读数,<span style="background-color: rgb(204, 204, 204);">'zrevrank 89 890' = nil</span>,那么未读数就是99+。同时消息新增、删除都需要同步维护该数据结构,失效或不存在时从 MySQL 初始化。</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><strong>九、超大群策略</strong></p> </section> </section> <p><br></p> <section> <p>前面提到,设计目标是在同一个群里能支撑百万人,从架构上可以看到,连接服务处于流量最前端,所以它的承载力直接决定了同时在线用户的上限。</p> <p><br>影响它的因素有:</p> </section> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>服务器自身配置:内存、CPU、网卡、Linux 支持的最大文件打开数;</p></li> <li><p>应用自身配置:应用本身启动需要的内存,如 Netty 依赖的堆外内存,大量的本地缓存;</p></li> <li><p>性能要求:当连接数不断变大时,消息分发的整体耗时肯定在不断增加,因此要关注最慢的分发耗时要满足即时性要求;<br>结合以上情况,可以测试出固定配置服务器单点能支持的最大用户连接数,假如单机能支持20000个用户连接,那么百万在线连接,在连接服务层用50个服务的集群就能解决。</p></li> </ol> </section> </section> </section> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">9.1 消息风暴</span></p> </section> <p><br></p> <p>当同时在线用户数非常多,例如百万时,会面临如下几个问题:</p> <p><br></p> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p><strong>消息发送风暴</strong>:极端情况下,用户同时发送消息,假设服务端承载住了这些流量,那么瓶颈其实在用户端,第一用户端会经历网络风暴,网卡带宽能否支撑是一个大问题;第二假设网卡能通过这些流量,用户端上百万条消息该如何展示,要是瞬间刷出这些消息,用户端 CPU能否撑住又是个问题,即使能抗住用户体验也很糟糕,根本就看不清消息,一直在飞速刷屏。因此服务端可以在发送消息风暴时做好限流、丢弃策略,给到用户友好的提示。</p></li> <li><p><strong>消息提醒风暴</strong>:一条新消息的产生,就要推送提醒消息百万次,对服务器来说,要考量整体推送完成的时效性,如果时效性差,对有些用户来说,就是消息需要较长时间才刷出来,出现明显的延迟。新消息持久化后,群组服务 HTTP 回调一组连接服务,单群百万在线用户,需要50台连接服务集群,那么回调50次,为了保证时效性,因此这里要并发回调,并设置合理的线程池,然后连接服务收到回调后也需要并发完成对群用户的新消息提醒推送。</p></li> <li><p><strong>消息拉取风暴</strong>:连接服务收到拉取消息事件,需要去群组服务获取消息详情,QPS 就非常高了,理论上集群达到 100wQPS,20台群组服务,那么每台群组服务就是 5wQPS。这里的策略是在链路前端连接服务上进行流量过滤,因为用户都是请求同一个群的同一条消息或附近的消息,那么就可以在连接服务里设计群消息的本地缓存,所有用户都只从本地缓存里读,如果本地缓存里没有,就放一个线程去群组服务请求加载缓存,其他线程同步等待,这样就大大降低了打到群组服务的 QPS。</p></li> </ol> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">9.2 消息压缩</span></p> </section> <p><br></p> <section> <p>如果某一个时刻,推送消息的数量比较大,且群同时在线人数比较多的时候,连接服务层的机房出口带宽就会成为消息推送的瓶颈。</p> <p><br>做个计算,百万人在线,需要5台连接服务,一条消息1KB,一般情况下,5台连接服务集群都是部署在同一个机房,那么这个机房的带宽就是1000000*1KB=1GB,如果多几个超大群,那么对机房的带宽要求就更高,所以如何有效的控制每一个消息的大小、压缩每一个消息的大小,是需要思考的问题。</p> <p><br>经过测试,使用 protobuf 数据交换格式,平均每一个消息可以节省43%的字节大小,可以大大节省机房出口带宽。</p> </section> <p><br></p> <section style="font-size: 15px;"> <p><span style="font-size: 16px;color: rgb(65, 95, 255);">9.3 块消息</span></p> </section> <p><br></p> <section> <p>超大群里,消息推送的频率很高,每一条消息推送都需要进行一次IO系统调用,显然会影响服务器性能,可以采用将多个消息进行合并推送。</p> <p><br><strong>主要思路</strong>:以群为维度,累计一段时间内的消息,如果达到阈值,就立刻合并推送,否则就以匀速的时间间隔将在这个时间段内新增的消息进行推送。</p> <p><br>时间间隔是1秒,阈值是10,如果500毫秒内新增了10条消息,就合并推送这10条消息,时间周期重置;如果1秒内只新增了8条消息,那么1秒后合并推送这8条消息。<br>这样做的好处如下:</p> </section> <p><br></p> <section style="margin-top: 10px;margin-bottom: 10px;"> <section style="display: inline-block;width: 100%;border-width: 1px;border-style: solid;border-color: transparent;padding: 10px;background-color: rgb(239, 239, 239);"> <section style="font-size: 13px;"> <ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"> <li><p>提升服务器性能:减少IO系统调用,减少用户态与内核态之前的切换;</p></li> <li><p>减少传输量:合并消息后,可以减少传输多余的消息头,进一步压缩消息大小;</p></li> <li><p>提升用户体验:一定程度上能减小消息风暴,消息渲染的节奏比较均匀,带给用户更好的体验;</p></li> </ol> </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><strong>十、总结</strong></p> </section> </section> <p><br></p> <p>在本文中,笔者介绍了从零开始搭建一个生产级百万级群聊的一些关键要点和实践经验,包括通信方案选型、消息存储、消息顺序、消息可靠性、高并发等方面,但仍有许多技术设计未涉及,比如冷热群、高低消息通道会放在未来的规划里。IM开发业界没有统一的标准,不同的产品有适合自己的技术方案,希望本文能够带给读者更好地理解和应用这些技术实践,为构建高性能、高可靠性的群聊系统提供一定的参考。</p> </section>
作者:微信小助手
<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 10px;padding-right: 10px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(90deg, rgba(50, 0, 0, 0.03) 0%, rgba(255, 255, 255, 0) 11.49%), linear-gradient(360deg, rgba(50, 0, 0, 0.04) 0%, rgba(255, 255, 255, 0) 12.16%);background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: repeat, repeat;background-size: 20px 20px, 20px 20px;width: auto;font-family: Optima, PingFangSC-light, serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;overflow-wrap: break-word;text-align: left;"> <blockquote style="margin-top: 20px;margin-bottom: 20px;margin-left: 0px;margin-right: 0px;padding-top: 10px;padding-bottom: 10px;padding-left: 20px;padding-right: 10px;border-top-style: solid;border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgba(64, 184, 255, 0.4);border-bottom-color: rgba(64, 184, 255, 0.4);border-left-color: rgba(64, 184, 255, 0.4);border-right-color: rgba(64, 184, 255, 0.4);border-top-left-radius: 8px;border-top-right-radius: 8px;border-bottom-right-radius: 8px;border-bottom-left-radius: 8px;background-attachment: scroll;background-clip: border-box;background-color: rgba(64, 184, 250, 0.1);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;display: block;overflow-x: auto;overflow-y: auto;"> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">清晨,我泡上一杯98年的咖啡,打开电脑,收到一条来自Doris用户的消息: </span></p> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">"请问有 将doris数据库数据作为deepseek大模型的知识库的方法吗" </span></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> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">于是,和这位Doris用户聊了聊,发现这类需求随着DeepSeek的爆火被无限放大了,但也确实是一个引申的</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">机遇与挑战</span></strong><span leaf="">。 </span></p> <p style="text-indent: 0em;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;color: rgb(59, 59, 59);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;"><span leaf="">也罢,今天就来一探究竟,一起学习学习如何基于</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Doris+DeepSeek</span></strong><span leaf="">打造你的专属AI助手!</span></p> </blockquote> <section style="text-align: center;" nodeleaf=""> <img src="/upload/4b8d355c96f8991678f07238350977c0.png" class="rich_pages wxw-img" data-ratio="0.6018957345971564" data-s="300,640" data-type="png" data-w="844" style="width:100%;" type="block" data-backw="549" data-backh="330" data-imgfileid="503003868"> </section> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsqnj5xwicjricawate7kicmzdria8lyice261phiavu1wfztvvwx9i9vcaew 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">术语名词</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin: 0px 0px 8px;padding: 8px 0px;"><span leaf="">在开始之前,先用大白话,介绍下几个术语名词:</span></p> <section style="text-align: center;margin-bottom: 16px;" nodeleaf=""> <img src="/upload/431ea0a1801fc25d1f60817ab5dc92e4.png" class="rich_pages wxw-img" data-ratio="0.7666666666666667" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003880"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ AGI:通用人工智能,AI界的"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">全能学霸</span></strong><span leaf="">"。致力于像人类一样能学数学、写诗、看病,甚至自己发明工具,目前还是科幻级存在。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ AIGC:人工智能生成,AI的"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">创作工厂</span></strong><span leaf="">"。输入一句话,自动生成文章/插画/音乐。DeepSeek写情书,Midjourney画星空,都是它的拿手好戏。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ LLM:大语言模型,AI专属"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">语言魔术师</span></strong><span leaf="">"。吃下全网文本,练就聊天/编程/翻译神技。DeepSeek、ChatGPT、Grok都是这类超级话痨。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ LangChain:AI基础平台,AI应用的"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">乐高积木</span></strong><span leaf="">"。把聊天机器人、文档分析、LLM、Doris等功能模块化,开发者像搭积木一样快速拼出智能应用。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">4️⃣ RAG:检索增强生成,AI的"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">外接大脑</span></strong><span leaf="">"。给模型配个随身百科,回答前先翻书查资料。比如让</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Doris+DeepSeek</span></strong><span leaf="">用你公司的产品手册回答问题。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">5️⃣ Fine-tuning:微调,AI的"</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">私人教练</span></strong><span leaf="">"。用行业秘籍给通用模型开小灶。比如用Doris最佳实践集训练,让DeepSeek秒变Doris专家。这块需要注意:越是微调,专用性越强,通用性越弱。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">小贴士</span></strong><span leaf="">:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Fine-tuning 微调如同给DeepSeek做</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">定制</span></strong><span leaf="">手术——通过专业训练让模型精通某个领域,但越专精就越难跨界(比如医疗AI看不懂法律条文)。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">RAG则是给DeepSeek装智能U盘(</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">外挂</span></strong><span leaf="">)——不修改模型本身,回答时自动调取知识库内容(好比律师查法典办案),通用性无损还能随时更新知识。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">Doris+DeepSeek</span></strong><span leaf="">的结合,其实就是</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">RAG</span></strong><span leaf="">应用了。</span></p> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsqnj5xwicjricawate7kicmzdria8lyice261phiavu1wfztvvwx9i9vcaew 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">一分钟定方案</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Apache Doris作为一款基于 MPP 架构的高性能、实时分析型</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">开源</span></strong><span leaf="">数据库,具备优秀的计算检索能力。既能支持</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">高并发</span></strong><span leaf="">的点查询场景,也能支持</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">高吞吐</span></strong><span leaf="">的复杂分析场景,还能进行</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">PB级日志检索</span></strong><span leaf="">,并完美融合</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">湖仓一体</span></strong><span leaf="">。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">DeepSeek则是新一代的开源大语言模型,具有强大的语义理解和推理能力,以高性价比和</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">开源</span></strong><span leaf="">著称。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">两者结合,如何解决个人和企业知识库的难题?</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">正当我思考时,灵光一闪:</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/d7a0a49a0c0688f817739c54bbf06687.png" class="rich_pages wxw-img" data-ratio="0.7509259259259259" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003869"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">方案主要分为</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">4个模块</span></strong><span leaf="">:</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">1. 数据源端(Sources)</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">接入本地知识库的文件数据,做</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">加载、清洗和分割</span></strong><span leaf="">处理。</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">2. 数据导入端(Embedding)</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">Vector Embedding(向量嵌入)是将文本、图像等数据转换为</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">数值向量</span></strong><span leaf="">的机器学习技术,其核心是通过高维空间中的向量位置来捕捉数据的语义信息。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">实现向量化的就是Embedding,一段文本向量化会转化为</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">一堆浮点数</span></strong><span leaf="">,这些浮点数排列在一起就像一个数组,例如某段话向量化:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&from=appmsg");""><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">[0.30633423, 0.32576653, -1.4459475, 0.8461606, 0.015846528...]</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">这一步主要是基于这类技术将数据源进行向量化存到Doris。</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">3. 数据融合端(LLM)</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">大模型的知识库存在两大局限:</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">时效性</span></strong><span leaf="">天花板(如deepseek-r1:14b的知识截至2024年7月)和个人/企业</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">知识盲区</span></strong><span leaf="">(无法获取内部资料)。</span></p><span style="cursor:pointer;" data-tool="mdnice编辑器"> <section data-formula="\text{AI智能升级公式} = \frac{\text{DeepSeek 大模型通用能力} \times \text{Doris知识库}}{\text{传统人工培训}} " style="text-align: center;overflow-x: auto;overflow-y: auto;display: block;"> <svg xmlns="http://www.w3.org/2000/svg" role="img" focusable="false" viewbox="0 -1426 25540.2 2336" aria-hidden="true" style="vertical-align: -2.059ex;width: 57.783ex;height: 5.285ex;max-width: 300% !important;"> <g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"> <g data-mml-node="math"> <g data-mml-node="mtext"> <path data-c="41" d="M255 0Q240 3 140 3Q48 3 39 0H32V46H47Q119 49 139 88Q140 91 192 245T295 553T348 708Q351 716 366 716H376Q396 715 400 709Q402 707 508 390L617 67Q624 54 636 51T687 46H717V0H708Q699 3 581 3Q458 3 437 0H427V46H440Q510 46 510 64Q510 66 486 138L462 209H229L209 150Q189 91 189 85Q189 72 209 59T259 46H264V0H255ZM447 255L345 557L244 256Q244 255 345 255H447Z"></path> <path data-c="49" d="M328 0Q307 3 180 3T32 0H21V46H43Q92 46 106 49T126 60Q128 63 128 342Q128 620 126 623Q122 628 118 630T96 635T43 637H21V683H32Q53 680 180 680T328 683H339V637H317Q268 637 254 634T234 623Q232 620 232 342Q232 63 234 60Q238 55 242 53T264 48T317 46H339V0H328Z" transform="translate(750, 0)"></path> <text data-variant="normal" transform="translate(1111, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 智 </tspan> </text> <text data-variant="normal" transform="translate(2045.6, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 能 </tspan> </text> <text data-variant="normal" transform="translate(2980.1, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 升 </tspan> </text> <text data-variant="normal" transform="translate(3914.7, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 级 </tspan> </text> <text data-variant="normal" transform="translate(4849.2, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 公 </tspan> </text> <text data-variant="normal" transform="translate(5783.8, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 式 </tspan> </text> </g> <g data-mml-node="mo" transform="translate(6996.1, 0)"> <path data-c="3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path> </g> <g data-mml-node="mfrac" transform="translate(7774.1, 0)"> <g data-mml-node="mrow" transform="translate(220, 676)"> <g data-mml-node="mtext"> <path data-c="44" d="M130 622Q123 629 119 631T103 634T60 637H27V683H228Q399 682 419 682T461 676Q504 667 546 641T626 573T685 470T708 336Q708 210 634 116T442 3Q429 1 228 0H27V46H60Q102 47 111 49T130 61V622ZM593 338Q593 439 571 501T493 602Q439 637 355 637H322H294Q238 637 234 628Q231 624 231 344Q231 62 232 59Q233 49 248 48T339 46H350Q456 46 515 95Q561 133 577 191T593 338Z"></path> <path data-c="65" d="M28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275Z" transform="translate(764, 0)"></path> <path data-c="65" d="M28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275Z" transform="translate(1208, 0)"></path> <path data-c="70" d="M36 -148H50Q89 -148 97 -134V-126Q97 -119 97 -107T97 -77T98 -38T98 6T98 55T98 106Q98 140 98 177T98 243T98 296T97 335T97 351Q94 370 83 376T38 385H20V408Q20 431 22 431L32 432Q42 433 61 434T98 436Q115 437 135 438T165 441T176 442H179V416L180 390L188 397Q247 441 326 441Q407 441 464 377T522 216Q522 115 457 52T310 -11Q242 -11 190 33L182 40V-45V-101Q182 -128 184 -134T195 -145Q216 -148 244 -148H260V-194H252L228 -193Q205 -192 178 -192T140 -191Q37 -191 28 -194H20V-148H36ZM424 218Q424 292 390 347T305 402Q234 402 182 337V98Q222 26 294 26Q345 26 384 80T424 218Z" transform="translate(1652, 0)"></path> <path data-c="53" d="M55 507Q55 590 112 647T243 704H257Q342 704 405 641L426 672Q431 679 436 687T446 700L449 704Q450 704 453 704T459 705H463Q466 705 472 699V462L466 456H448Q437 456 435 459T430 479Q413 605 329 646Q292 662 254 662Q201 662 168 626T135 542Q135 508 152 480T200 435Q210 431 286 412T370 389Q427 367 463 314T500 191Q500 110 448 45T301 -21Q245 -21 201 -4T140 27L122 41Q118 36 107 21T87 -7T78 -21Q76 -22 68 -22H64Q61 -22 55 -16V101Q55 220 56 222Q58 227 76 227H89Q95 221 95 214Q95 182 105 151T139 90T205 42T305 24Q352 24 386 62T420 155Q420 198 398 233T340 281Q284 295 266 300Q261 301 239 306T206 314T174 325T141 343T112 367T85 402Q55 451 55 507Z" transform="translate(2208, 0)"></path> <path data-c="65" d="M28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275Z" transform="translate(2764, 0)"></path> <path data-c="65" d="M28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275Z" transform="translate(3208, 0)"></path> <path data-c="6B" d="M36 46H50Q89 46 97 60V68Q97 77 97 91T97 124T98 167T98 217T98 272T98 329Q98 366 98 407T98 482T98 542T97 586T97 603Q94 622 83 628T38 637H20V660Q20 683 22 683L32 684Q42 685 61 686T98 688Q115 689 135 690T165 693T176 694H179V463L180 233L240 287Q300 341 304 347Q310 356 310 364Q310 383 289 385H284V431H293Q308 428 412 428Q475 428 484 431H489V385H476Q407 380 360 341Q286 278 286 274Q286 273 349 181T420 79Q434 60 451 53T500 46H511V0H505Q496 3 418 3Q322 3 307 0H299V46H306Q330 48 330 65Q330 72 326 79Q323 84 276 153T228 222L176 176V120V84Q176 65 178 59T189 49Q210 46 238 46H254V0H246Q231 3 137 3T28 0H20V46H36Z" transform="translate(3652, 0)"></path> <path data-c="20" d="" transform="translate(4180, 0)"></path> <text data-variant="normal" transform="translate(4430, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 大 </tspan> </text> <text data-variant="normal" transform="translate(5364.6, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 模 </tspan> </text> <text data-variant="normal" transform="translate(6299.1, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 型 </tspan> </text> <text data-variant="normal" transform="translate(7233.7, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 通 </tspan> </text> <text data-variant="normal" transform="translate(8168.2, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 用 </tspan> </text> <text data-variant="normal" transform="translate(9102.8, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 能 </tspan> </text> <text data-variant="normal" transform="translate(10037.4, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 力 </tspan> </text> </g> <g data-mml-node="mo" transform="translate(11194.1, 0)"> <path data-c="D7" d="M630 29Q630 9 609 9Q604 9 587 25T493 118L389 222L284 117Q178 13 175 11Q171 9 168 9Q160 9 154 15T147 29Q147 36 161 51T255 146L359 250L255 354Q174 435 161 449T147 471Q147 480 153 485T168 490Q173 490 175 489Q178 487 284 383L389 278L493 382Q570 459 587 475T609 491Q630 491 630 471Q630 464 620 453T522 355L418 250L522 145Q606 61 618 48T630 29Z"></path> </g> <g data-mml-node="mtext" transform="translate(12194.4, 0)"> <path data-c="44" d="M130 622Q123 629 119 631T103 634T60 637H27V683H228Q399 682 419 682T461 676Q504 667 546 641T626 573T685 470T708 336Q708 210 634 116T442 3Q429 1 228 0H27V46H60Q102 47 111 49T130 61V622ZM593 338Q593 439 571 501T493 602Q439 637 355 637H322H294Q238 637 234 628Q231 624 231 344Q231 62 232 59Q233 49 248 48T339 46H350Q456 46 515 95Q561 133 577 191T593 338Z"></path> <path data-c="6F" d="M28 214Q28 309 93 378T250 448Q340 448 405 380T471 215Q471 120 407 55T250 -10Q153 -10 91 57T28 214ZM250 30Q372 30 372 193V225V250Q372 272 371 288T364 326T348 362T317 390T268 410Q263 411 252 411Q222 411 195 399Q152 377 139 338T126 246V226Q126 130 145 91Q177 30 250 30Z" transform="translate(764, 0)"></path> <path data-c="72" d="M36 46H50Q89 46 97 60V68Q97 77 97 91T98 122T98 161T98 203Q98 234 98 269T98 328L97 351Q94 370 83 376T38 385H20V408Q20 431 22 431L32 432Q42 433 60 434T96 436Q112 437 131 438T160 441T171 442H174V373Q213 441 271 441H277Q322 441 343 419T364 373Q364 352 351 337T313 322Q288 322 276 338T263 372Q263 381 265 388T270 400T273 405Q271 407 250 401Q234 393 226 386Q179 341 179 207V154Q179 141 179 127T179 101T180 81T180 66V61Q181 59 183 57T188 54T193 51T200 49T207 48T216 47T225 47T235 46T245 46H276V0H267Q249 3 140 3Q37 3 28 0H20V46H36Z" transform="translate(1264, 0)"></path> <path data-c="69" d="M69 609Q69 637 87 653T131 669Q154 667 171 652T188 609Q188 579 171 564T129 549Q104 549 87 564T69 609ZM247 0Q232 3 143 3Q132 3 106 3T56 1L34 0H26V46H42Q70 46 91 49Q100 53 102 60T104 102V205V293Q104 345 102 359T88 378Q74 385 41 385H30V408Q30 431 32 431L42 432Q52 433 70 434T106 436Q123 437 142 438T171 441T182 442H185V62Q190 52 197 50T232 46H255V0H247Z" transform="translate(1656, 0)"></path> <path data-c="73" d="M295 316Q295 356 268 385T190 414Q154 414 128 401Q98 382 98 349Q97 344 98 336T114 312T157 287Q175 282 201 278T245 269T277 256Q294 248 310 236T342 195T359 133Q359 71 321 31T198 -10H190Q138 -10 94 26L86 19L77 10Q71 4 65 -1L54 -11H46H42Q39 -11 33 -5V74V132Q33 153 35 157T45 162H54Q66 162 70 158T75 146T82 119T101 77Q136 26 198 26Q295 26 295 104Q295 133 277 151Q257 175 194 187T111 210Q75 227 54 256T33 318Q33 357 50 384T93 424T143 442T187 447H198Q238 447 268 432L283 424L292 431Q302 440 314 448H322H326Q329 448 335 442V310L329 304H301Q295 310 295 316Z" transform="translate(1934, 0)"></path> <text data-variant="normal" transform="translate(2328, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 知 </tspan> </text> <text data-variant="normal" transform="translate(3262.6, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 识 </tspan> </text> <text data-variant="normal" transform="translate(4197.1, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 库 </tspan> </text> </g> </g> <g data-mml-node="mtext" transform="translate(6079.3, -710)"> <text data-variant="normal" transform="matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 传 </tspan> </text> <text data-variant="normal" transform="translate(934.6, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 统 </tspan> </text> <text data-variant="normal" transform="translate(1869.1, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 人 </tspan> </text> <text data-variant="normal" transform="translate(2803.7, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 工 </tspan> </text> <text data-variant="normal" transform="translate(3738.2, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 培 </tspan> </text> <text data-variant="normal" transform="translate(4672.8, 0) matrix(1 0 0 -1 0 0)" font-size="934.6px" font-family="serif"> <tspan leaf=""> 训 </tspan> </text> </g> <rect width="17526" height="60" x="120" y="220"></rect> </g> </g> </g><g></g> </svg> </section></span> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">要让AI真正掌握业务精髓,还需:</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <p style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">知识注入</span></strong><span leaf="">:将个人/企业专属的《XXX》存入Doris数据库,相当于给AI装上"行业大脑"</span></p> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <p style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">智能关联</span></strong><span leaf="">:遇到复杂问题时,DeepSeek AI会自动关联多个知识库的章节内容,像资深专家般综合分析,妥妥的AI助手</span></p> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <p style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">精准应答</span></strong><span leaf="">:基于实时更新的个人/企业知识库,DeepSeek AI能给出贴合业务场景的解决方案</span></p> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">简单而已一句话:</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">将自己的知识内容喂给LLM,让LLM结合我们给出的知识去回答问题</span></strong><span leaf="">。</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">4. 数据客户端(Processing)</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">进行常规QA,</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">提问入口</span></strong><span leaf="">。</span></p> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsqnj5xwicjricawate7kicmzdria8lyice261phiavu1wfztvvwx9i9vcaew 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">一分钟撕代码</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">确定好方案后,即刻开撕代码。</span></p> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">环境准备</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">Doris环境</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">🔗 Doris部署:<span textstyle="" style="color: rgb(0, 128, 255);text-decoration: underline;">https://doris.apache.org/zh-CN/docs/dev/gettingStarted/quick-start</span></span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">如果已经有Doris集群,直接用即可。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">若当前还没Doris环境,可以参考Doris官方文档,基于Docker或本地化快速部署搭建一套Doris集群:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&from=appmsg");""><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># Docker为例</span></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 1. 创建 docker-compose.yaml 文件</span></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 复制以下内容到 docker-compose.yaml 文件中,并将 DORIS_QUICK_START_VERSION 替换为指定的 Doris 版本,例如 2.1.8。</span></span><span leaf=""><br></span><span leaf="">version: </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"3"</span></span><span leaf=""><br></span><span leaf="">services:</span><span leaf=""><br></span><span leaf=""> fe:</span><span leaf=""><br></span><span leaf=""> image: apache/doris.fe-ubuntu:</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">${DORIS_QUICK_START_VERSION}</span></span><span leaf=""><br></span><span leaf=""> hostname: fe</span><span leaf=""><br></span><span leaf=""> environment:</span><span leaf=""><br></span><span leaf=""> - FE_SERVERS=fe1:127.0.0.1:9010</span><span leaf=""><br></span><span leaf=""> - FE_ID=1</span><span leaf=""><br></span><span leaf=""> network_mode: host</span><span leaf=""><br></span><span leaf=""> be:</span><span leaf=""><br></span><span leaf=""> image: apache/doris.be-ubuntu:</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">${DORIS_QUICK_START_VERSION}</span></span><span leaf=""><br></span><span leaf=""> hostname: be</span><span leaf=""><br></span><span leaf=""> environment:</span><span leaf=""><br></span><span leaf=""> - FE_SERVERS=fe1:127.0.0.1:9010</span><span leaf=""><br></span><span leaf=""> - BE_ADDR=127.0.0.1:9050</span><span leaf=""><br></span><span leaf=""> depends_on:</span><span leaf=""><br></span><span leaf=""> - fe</span><span leaf=""><br></span><span leaf=""> network_mode: host</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># 2. 启动Doris集群</span></span><span leaf=""><br></span><span leaf="">docker-compose -f ./docker-compose.yaml up -d</span><span leaf=""><br></span></code></pre> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">DeepSeeek环境</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">本地部署的Ollama+DeepSeek,网上教程非常多,本文还是就不单独介绍了。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">简而言之,参考一臻整理的如下简图(两步完成不带WebUI):</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/051fe237c5c66cd08288b99bc6370738.png" class="rich_pages wxw-img" data-ratio="0.5935185185185186" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003870"> </section> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">Python环境</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">本次使用的Python版本是</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">3.8.17</span></strong><span leaf="">,相关的包都可以畅通无阻的install(建议用</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">conda</span></strong><span leaf="">管理py环境):</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&from=appmsg");""><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">pip install langchain</span><span leaf=""><br></span><span leaf="">pip install langchain-community</span><span leaf=""><br></span><span leaf="">pip install -qU langchain-community</span><span leaf=""><br></span><span leaf="">pip install sqlalchemy</span><span leaf=""><br></span><span leaf="">pip install --upgrade --quiet pymysql</span><span leaf=""><br></span><span leaf="">pip install markdown</span><span leaf=""><br></span></code></pre> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">代码实现</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">经过一臻</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">七七四十九秒</span></strong><span leaf="">的编写调试,完整代码如下:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&from=appmsg");""><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> dataclasses </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> dataclass</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> contextlib </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> contextmanager</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> langchain_community.llms.ollama </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> Ollama</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> langchain_community.embeddings.ollama </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> OllamaEmbeddings</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> langchain_community.document_loaders </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> DirectoryLoader, UnstructuredMarkdownLoader</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> langchain_core.output_parsers </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> StrOutputParser</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> langchain_core.prompts </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> ChatPromptTemplate</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> langchain_core.runnables </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> RunnablePassthrough, RunnableLambda</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> langchain_text_splitters </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> TokenTextSplitter</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> langchain_community.vectorstores.apache_doris </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> ApacheDorisSettings, ApacheDoris</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> pymysql </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> connect</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">from</span></span><span leaf=""> pymysql.connections </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">import</span></span><span leaf=""> Connection</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #61aeee;line-height: 26px;"><span leaf="">@dataclass</span></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">class</span></span><span leaf=""> </span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">DorisConfig</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Apache Doris configuration"""</span></span><span leaf=""><br></span><span leaf=""> host: str</span><span leaf=""><br></span><span leaf=""> port: int</span><span leaf=""><br></span><span leaf=""> username: str</span><span leaf=""><br></span><span leaf=""> password: str</span><span leaf=""><br></span><span leaf=""> database: str</span><span leaf=""><br></span><span leaf=""> table: str</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> </span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">to_settings</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf=""> -> ApacheDorisSettings:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Convert config to ApacheDorisSettings"""</span></span><span leaf=""><br></span><span leaf=""> settings = ApacheDorisSettings()</span><span leaf=""><br></span><span leaf=""> settings.host = self.host</span><span leaf=""><br></span><span leaf=""> settings.port = self.port</span><span leaf=""><br></span><span leaf=""> settings.username = self.username</span><span leaf=""><br></span><span leaf=""> settings.password = self.password</span><span leaf=""><br></span><span leaf=""> settings.database = self.database</span><span leaf=""><br></span><span leaf=""> settings.table = self.table</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf=""> settings</span><span leaf=""><br></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">class</span></span><span leaf=""> </span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">DocumentLoader</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Document loading and processing"""</span></span><span leaf=""><br></span><span leaf=""> </span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">__init__</span></span><span style="line-height: 26px;"><span leaf="">(self, docs_dir: str, chunk_size: int = </span><span style="color: #d19a66;line-height: 26px;"><span leaf="">400</span></span><span leaf="">, chunk_overlap: int = </span><span style="color: #d19a66;line-height: 26px;"><span leaf="">50</span></span><span leaf="">)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> self.docs_dir = docs_dir</span><span leaf=""><br></span><span leaf=""> self.chunk_size = chunk_size</span><span leaf=""><br></span><span leaf=""> self.chunk_overlap = chunk_overlap</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> </span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">load_and_split</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Load and split documents into chunks"""</span></span><span leaf=""><br></span><span leaf=""> loader = DirectoryLoader(</span><span leaf=""><br></span><span leaf=""> self.docs_dir,</span><span leaf=""><br></span><span leaf=""> glob=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"**/*.md"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> loader_cls=UnstructuredMarkdownLoader</span><span leaf=""><br></span><span leaf=""> )</span><span leaf=""><br></span><span leaf=""> docs = loader.load()</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> splitter = TokenTextSplitter(</span><span leaf=""><br></span><span leaf=""> chunk_size=self.chunk_size,</span><span leaf=""><br></span><span leaf=""> chunk_overlap=self.chunk_overlap</span><span leaf=""><br></span><span leaf=""> )</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf=""> splitter.split_documents(docs)</span><span leaf=""><br></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">class</span></span><span leaf=""> </span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">Doris</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Apache Doris database operations"""</span></span><span leaf=""><br></span><span leaf=""> </span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">__init__</span></span><span style="line-height: 26px;"><span leaf="">(self, config: DorisConfig)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> self.config = config</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #61aeee;line-height: 26px;"><span leaf=""> @contextmanager</span></span><span leaf=""><br></span><span leaf=""> </span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">get_connection</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf=""> -> Connection:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Get database connection with context management"""</span></span><span leaf=""><br></span><span leaf=""> conn = connect(</span><span leaf=""><br></span><span leaf=""> host=self.config.host,</span><span leaf=""><br></span><span leaf=""> port=self.config.port,</span><span leaf=""><br></span><span leaf=""> user=self.config.username,</span><span leaf=""><br></span><span leaf=""> password=self.config.password,</span><span leaf=""><br></span><span leaf=""> database=self.config.database</span><span leaf=""><br></span><span leaf=""> )</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">try</span></span><span leaf="">:</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">yield</span></span><span leaf=""> conn</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">finally</span></span><span leaf="">:</span><span leaf=""><br></span><span leaf=""> conn.close()</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> </span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">get_context</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf=""> -> str:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Get context from database"""</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">with</span></span><span leaf=""> self.get_connection() </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">as</span></span><span leaf=""> conn:</span><span leaf=""><br></span><span leaf=""> cursor = conn.cursor()</span><span leaf=""><br></span><span leaf=""> cursor.execute(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">f"SELECT document FROM `</span><span style="color: #e06c75;line-height: 26px;"><span leaf="">{self.config.table}</span></span><span leaf="">`"</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf=""> rows = cursor.fetchall()</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">"\n"</span></span><span leaf="">.join(row[</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">0</span></span><span leaf="">] </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">for</span></span><span leaf=""> row </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf=""> rows)</span><span leaf=""><br></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">class</span></span><span leaf=""> </span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">QASystem</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Question Answering System"""</span></span><span leaf=""><br></span><span leaf=""> </span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">__init__</span></span><span style="line-height: 26px;"><span leaf="">(</span><span leaf=""><br></span><span leaf=""> self,</span><span leaf=""><br></span><span leaf=""> config: DorisConfig,</span><span leaf=""><br></span><span leaf=""> docs_dir: str = </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"./docs"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> embedding_model: str = </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"bge-m3"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> llm_model: str = </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"deepseek-r1"</span></span><span leaf=""><br></span><span leaf=""> )</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> self.config = config</span><span leaf=""><br></span><span leaf=""> self.docs_dir = docs_dir</span><span leaf=""><br></span><span leaf=""> self.embedding_model = embedding_model</span><span leaf=""><br></span><span leaf=""> self.llm_model = llm_model</span><span leaf=""><br></span><span leaf=""> self.db = Doris(config)</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> </span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">initialize_vectorstore</span></span><span style="line-height: 26px;"><span leaf="">(self)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Initialize vector store with documents"""</span></span><span leaf=""><br></span><span leaf=""> loader = DocumentLoader(self.docs_dir)</span><span leaf=""><br></span><span leaf=""> docs = loader.load_and_split()</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> embeddings = OllamaEmbeddings(model=self.embedding_model)</span><span leaf=""><br></span><span leaf=""> ApacheDoris.from_documents(</span><span leaf=""><br></span><span leaf=""> docs,</span><span leaf=""><br></span><span leaf=""> embeddings,</span><span leaf=""><br></span><span leaf=""> config=self.config.to_settings()</span><span leaf=""><br></span><span leaf=""> )</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> </span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">get_qa_chain</span></span><span style="line-height: 26px;"><span leaf="">(self, context: str)</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Create QA chain"""</span></span><span leaf=""><br></span><span leaf=""> template = </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""</span><span leaf=""><br></span><span leaf=""> Answer the question based only on the following context:{context}</span><span leaf=""><br></span><span leaf=""> Question: 请严格结合{context}的内容回答{question}的问题,别发散,说人话。</span><span leaf=""><br></span><span leaf=""> """</span></span><span leaf=""><br></span><span leaf=""> prompt = ChatPromptTemplate.from_template(template)</span><span leaf=""><br></span><span leaf=""> llm = Ollama(model=self.llm_model)</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf=""> (</span><span leaf=""><br></span><span leaf=""> {</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"context"</span></span><span leaf="">: RunnableLambda(</span><span style="color: #c678dd;line-height: 26px;"><span leaf="">lambda</span></span><span leaf=""> d: context),</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"question"</span></span><span leaf="">: RunnablePassthrough()</span><span leaf=""><br></span><span leaf=""> }</span><span leaf=""><br></span><span leaf=""> | prompt</span><span leaf=""><br></span><span leaf=""> | llm</span><span leaf=""><br></span><span leaf=""> | StrOutputParser()</span><span leaf=""><br></span><span leaf=""> )</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> </span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">query</span></span><span style="line-height: 26px;"><span leaf="">(self, question: str)</span></span><span leaf=""> -> str:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""Query the QA system"""</span></span><span leaf=""><br></span><span leaf=""> context = self.db.get_context()</span><span leaf=""><br></span><span leaf=""> qa_chain = self.get_qa_chain(context)</span><span leaf=""><br></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">return</span></span><span leaf=""> qa_chain.invoke(question)</span><span leaf=""><br></span><span leaf=""><br></span><span style="line-height: 26px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">def</span></span><span leaf=""> </span><span style="color: #61aeee;line-height: 26px;"><span leaf="">main</span></span><span style="line-height: 26px;"><span leaf="">()</span></span><span leaf="">:</span></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># Configuration</span></span><span leaf=""><br></span><span leaf=""> config = DorisConfig(</span><span leaf=""><br></span><span leaf=""> host=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{按需补齐}"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> port=</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">9030</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> username=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{按需补齐}"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> password=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{按需补齐}"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> database=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{按需补齐}"</span></span><span leaf="">,</span><span leaf=""><br></span><span leaf=""> table=</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"{按需补齐,默认langchain}"</span></span><span leaf=""><br></span><span leaf=""> )</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># Initialize QA system</span></span><span leaf=""><br></span><span leaf=""> qa_system = QASystem(config)</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># Initialize vector store (only needed once)</span></span><span leaf=""><br></span><span leaf=""> qa_system.initialize_vectorstore()</span><span leaf=""><br></span><span leaf=""><br></span><span leaf=""> </span><span style="color: #5c6370;font-style: italic;line-height: 26px;"><span leaf=""># Query example</span></span><span leaf=""><br></span><span leaf=""> question = </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"请介绍下Apache Doris,以及当前最新的Release版本是多少"</span></span><span leaf=""><br></span><span leaf=""> response = qa_system.query(question)</span><span leaf=""><br></span><span leaf=""> print(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">"----- Response -----"</span></span><span leaf="">)</span><span leaf=""><br></span><span leaf=""> print(response)</span><span leaf=""><br></span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">if</span></span><span leaf=""> __name__ == </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"__main__"</span></span><span leaf="">:</span><span leaf=""><br></span><span leaf=""> main()</span><span leaf=""><br></span></code></pre> <h4 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 15px 15px;width: 15px;height: 15px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: inline-block;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -2px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsg09t8gria4mgd85qcfic4lm0idrokhgjbm6cbxichpt3pgmmxdshxhqyq 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(43, 43, 43);line-height: 1.5em;letter-spacing: 0em;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: inline-block;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 8px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">代码解析</span></span><span style="display: none;"><span leaf=""><br></span></span></h4> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">代码经过精简,很多block没有进行过多地细化深入。主要是为了让大家能够快速熟悉Doris+DeepSeek的完整流程,后续可以结合自己需求,按模块进行调整应用。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">代码主流程如下:</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/a0641287cca0deeee1a3722aa60e45da.png" class="rich_pages wxw-img" data-ratio="1.1675925925925925" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003871"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin: 16px 0px 0px;padding: 8px 0px;"><span leaf="">从里到外,每一层的解析:</span></p> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">DorisConfig</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要功能分为2个方面:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 配置集中管理</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">封装 Doris 数据库连接所需的 6 个关键参数。使用类型注解确保配置数据的正确性。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 配置格式转换</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">to_settings() 方法将配置转换为 LangChain 官方库 ApacheDoris 模块需要的参数格式,方便与 LangChain 的 Apache Doris进行集成。</span></p> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">Doris</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要职责分为三个层次:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 连接管理</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">基于 DorisConfig 配置创建数据库连接</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">使用 @contextmanager 实现安全的连接上下文管理</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">自动处理连接异常和资源释放</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 数据操作</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">执行指定 SQL 查询(当前实现为获取全部 document 字段,即直接获取全部内容喂给DeepSeek;暂时没用到</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">embedding</span></strong><span leaf="">值,后续可以结合起来用,效果更佳)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">将查询结果拼接为字符串返回</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">为上层 QASystem 提供原始数据输入</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 资源隔离</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">封装所有数据库相关操作细节</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">隔离 SQL 语法与业务逻辑</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">为后续扩展更多数据库操作提供统一入口</span> </section> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">DocumentLoader</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要实现三个关键功能:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 文件加载</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">自动扫描指定目录下的 Markdown 文件(**/*.md)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">使用 UnstructuredMarkdownLoader 解析文件内容</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 文本分割</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">基于 token 数量进行智能分割</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">通过重叠 token 保持上下文连贯性</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">输出格式化的 Document 对象列表</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 参数化配置</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">允许灵活调整块大小(默认 400 tokens)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">可设置块间重叠量(默认 50 tokens)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">为后续向量化存储提供标准化输入</span> </section> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">QASystem</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要承担三个层面的职责:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 系统整合</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">协调 Doris 数据库操作</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">管理文档向量化存储</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">桥接大语言模型(</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">deepseek-r1</span></strong><span leaf="">)</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 处理流程</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">知识库初始化(文档向量化存储到Doris)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">问答处理链构建(LangChain 流水线)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">用户查询执行(端到端响应生成)</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 参数管理</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">集中管理嵌入模型(embedding_model本次选用的是</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">bge-m3</span></strong><span leaf="">)和 LLM 选择(llm本次选用的是</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">deepseek-r1</span></strong><span leaf="">)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">控制知识库文件存储路径</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">维护数据库连接配置</span> </section> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">Client</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要作为入口交互:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1️⃣ 系统配置</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">定义 Doris 数据库连接参数</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">指定文档存储表名(langchain)</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">设置认证信息(用户名/密码)</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">2️⃣ 初始化流程</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">创建问答系统实例</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">加载文档生成向量数据库(仅首次需要)</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">3️⃣ 演示流程</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">预定义测试问题</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">执行端到端问答</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">格式化输出结果</span> </section> <h5 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">其它说明</span></span><span style="display: none;"><span leaf=""><br></span></span></h5> <h6 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">1. 测试文件</span></span><span style="display: none;"><span leaf=""><br></span></span></h6> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要导入了3个md文件,分别是:</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">🔗 Doris README:<span textstyle="" style="color: rgb(0, 128, 255);text-decoration: underline;">https://github.com/apache/doris/edit/master/README.md</span></span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">🔗 Doris简介文档:<span textstyle="" style="color: rgb(0, 128, 255);text-decoration: underline;">https://github.com/apache/doris-website/blob/master/i18n/zh-CN/docusaurus-plugin-content-docs/current/gettingStarted/what-is-apache-doris.md</span></span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">🔗 Doris版本最新发布文档:<span textstyle="" style="color: rgb(0, 128, 255);text-decoration: underline;">https://github.com/apache/doris-website/blob/master/i18n/zh-CN/docusaurus-plugin-content-docs/current/releasenotes/all-release.md</span></span></p> <h6 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">2. Doris表</span></span><span style="display: none;"><span leaf=""><br></span></span></h6> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">在进行ApacheDoris.from_documents时,Doris会自动建如下表:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&from=appmsg");""><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span style="color: #c678dd;line-height: 26px;"><span leaf="">CREATE</span></span><span leaf=""> </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">TABLE</span></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`langchain`</span></span><span leaf=""> (</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`id`</span></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">varchar</span></span><span leaf="">(</span><span style="color: #d19a66;line-height: 26px;"><span leaf="">50</span></span><span leaf="">) </span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">NULL</span></span><span leaf="">,</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`document`</span></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">text</span></span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">NULL</span></span><span leaf="">,</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`embedding`</span></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">array</span></span><span leaf=""><</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">float</span></span><span leaf="">> </span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">NULL</span></span><span leaf="">,</span><span leaf=""><br></span><span style="color: #98c379;line-height: 26px;"><span leaf="">`metadata`</span></span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">text</span></span><span style="color: #56b6c2;line-height: 26px;"><span leaf="">NULL</span></span><span leaf=""><br></span><span leaf="">) </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">ENGINE</span></span><span leaf="">=OLAP</span><span leaf=""><br></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">UNIQUE</span></span><span style="color: #c678dd;line-height: 26px;"><span leaf="">KEY</span></span><span leaf="">(</span><span style="color: #98c379;line-height: 26px;"><span leaf="">`id`</span></span><span leaf="">)</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">主要存储文档切割后的原文、embedding值和文件元数据:</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/bf7d53e782edeba9759f863b9a1b7bf4.png" class="rich_pages wxw-img" data-ratio="0.4666666666666667" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003872"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">由于Doris当前还没支持vector类型,所以还没法直接转为Retriever检索器,否则会报如下异常:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&from=appmsg");""><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">Syntax error </span><span style="color: #c678dd;line-height: 26px;"><span leaf="">in</span></span><span leaf=""> line 4:\n... cosine_distance(array<</span><span style="color: #e6c07b;line-height: 26px;"><span leaf="">float</span></span><span leaf="">></span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">因此这块的流程改为将向量化后的Doris数据,直接读取(可以结合Doris</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">倒排索引</span></strong><span leaf="">加速)外挂为上下文context。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">预计7月将完成Doris向量化能力大统一,敬请期待!</span></p> <h6 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;display: block;"><span style="display: none;"><span leaf=""><br></span></span><span style="font-size: 14px;color: rgb(0, 0, 0);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: block;"><span leaf="">3. 提示词</span></span><span style="display: none;"><span leaf=""><br></span></span></h6> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">构建QA chain时,prompt提示词这块值得一提。大家结合应用时可以个性化调整:</span></p> <pre data-tool="mdnice编辑器" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;"><span data-cacheurl="" data-remoteid="" style="display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(" https: mmbiz.qpic.cn mmbiz_svg ufvmvgcvafkp2bijpvoesbpoubffmnn4e5bcpnpzuapfr0kw7nqtmiaic9afznuicamjbgk8nsc7w3yvcymxqdugqoxgrxoax6e 640?wx_fmt="svg&from=appmsg");""><span leaf=""><br></span></span><code style="overflow-x: auto;padding: 16px;color: #abb2bf;padding-top: 15px;background: #282c34;border-radius: 5px;display: -webkit-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;"><span leaf="">template = </span><span style="color: #98c379;line-height: 26px;"><span leaf="">"""</span><span leaf=""><br></span><span leaf=""> Answer the question based only on the following context:{context}</span><span leaf=""><br></span><span leaf=""> Question: 请严格结合{context}的内容回答{question}的问题,别发散,说人话。</span><span leaf=""><br></span><span leaf=""> """</span></span><span leaf=""><br></span><span leaf="">prompt = ChatPromptTemplate.from_template(template)</span><span leaf=""><br></span></code></pre> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">在langchain中,ChatPromptTemplate是一个定义提问模版的方法,主要有两个功能:from_messages 和 from_template。</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <p style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">1. from_messages:把系统指令、用户提问等不同角色的对话片段,像搭积木一样组合,3秒构建多轮对话模板。</span></p> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <p style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">2. from_template</span></strong><span leaf="">:一键复制现有模板,好比PS图层编辑般自由修改,快速生成变体对话方案。本次选用的是from_template。</span></p> </section> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsqnj5xwicjricawate7kicmzdria8lyice261phiavu1wfztvvwx9i9vcaew 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">一分钟看结果</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"><span leaf=""><br></span></span></h2> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">代码编写调试完后,来对比下结果。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">首先,本地部署的是ollama+deepseek r1:14b,直接问相同的问题,回答:</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/02d22a4d6fa749914b95cd146d089b20.png" class="rich_pages wxw-img" data-ratio="0.8898148148148148" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003873"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">结果有几个明显的错误点,比如Doris是2017年正式在GitHub上开源,最新发布的 release 版本是 v2.1.8(仅按发布时间排)。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">再基于Doris+DeepSeek,问相同的问题,回答:</span></p> <section style="text-align: center;" nodeleaf=""> <img src="/upload/27f8b5a39d70e19540abac2fe821c397.png" class="rich_pages wxw-img" data-ratio="0.5925925925925926" data-s="300,640" data-type="png" data-w="1080" type="block" data-imgfileid="503003874"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin: 16px 0px 0px;padding: 8px 0px;"><span leaf="">结果准确率明显上升,且完美结合了prompt和Doris知识数据进行回答。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf=""><span textstyle="" style="color: rgb(0, 128, 255);font-weight: bold;">通过DeepSeek 结合 Doris 打造的 RAG 知识库</span>,既发挥了 DeepSeek 强大的模型推理能力,又利用了 Doris 高效的存储与检索优势,大幅提升回答准确度,有效避免AI幻觉,为个人/企业带来高质量的本地知识库。</span></p> <h2 data-tool="mdnice编辑器" style="border-bottom-color: rgb(64, 184, 250);margin-top: 30px;margin-bottom: 15px;margin-left: 0px;margin-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: solid;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 4px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: block;flex-direction: unset;float: unset;height: auto;justify-content: unset;line-height: 1.5em;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span data-cacheurl="" data-remoteid="" style="background-attachment: scroll;background-clip: border-box;background-color: transparent;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: 20px 20px;width: 20px;height: 20px;align-items: unset;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: unset;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: 0px;margin-bottom: -25px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;-webkit-box-reflect: unset;background-image: url(" https: mmbiz.qpic.cn sz_mmbiz_png fibmic00uxz23nxhmkeehcyaoicimygardsqnj5xwicjricawate7kicmzdria8lyice261phiavu1wfztvvwx9i9vcaew 640?wx_fmt="png&from=appmsg");""><span leaf=""><br></span></span><span style="font-size: 20px;color: rgb(64, 184, 250);line-height: 1.5em;letter-spacing: 0em;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;align-items: unset;background-attachment: scroll;background-clip: border-box;background-color: transparent;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;display: flex;font-weight: bold;flex-direction: unset;float: unset;height: auto;justify-content: unset;margin-top: 0px;margin-bottom: 0px;margin-left: 25px;margin-right: 0px;overflow-x: unset;overflow-y: unset;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: auto;-webkit-box-reflect: unset;"><span leaf="">结语</span></span><span style="background-color: rgba(64, 184, 250, 0.5);align-items: unset;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-right-width: 1px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgb(0, 0, 0);border-left-color: rgb(0, 0, 0);border-right-color: rgb(0, 0, 0);border-top-left-radius: 20px;border-top-right-radius: 0px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;box-shadow: none;color: rgb(0, 0, 0);display: flex;font-size: 22px;font-weight: bold;flex-direction: unset;float: right;height: 10px;justify-content: unset;letter-spacing: 0px;line-height: 1.5em;margin-top: -10px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;overflow-x: unset;overflow-y: unset;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;text-align: left;text-indent: 0em;text-shadow: none;transform: none;width: 200px;-webkit-box-reflect: unset;"><span leaf=""><br></span></span></h2> <section style="text-align: center;" nodeleaf=""> <img class="rich_pages wxw-img" data-imgfileid="503003877" data-ratio="0.5425925925925926" data-s="300,640" src="/upload/5c7b3c1a255b9f32cc538b2c9e11e864.png" data-type="png" data-w="1080" type="block"> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf=""><span textstyle="" style="color: rgb(0, 128, 255);font-weight: bold;">知识库AI智能化</span>是一个永无止境的进化过程。随着大模型技术的发展,未来可以探索更多优化方向:</span></p> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">实时更新:支持增量同步,保持知识时效性</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">知识推理:引入知识图谱,提升问答准确性</span> </section> <section style="margin-top: 5px;margin-bottom: 5px;color: rgb(89, 89, 89);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;font-weight: normal;"> <span style="color: rgb(51, 51, 51);font-family: Arial, sans-serif;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">• </span></span><span leaf="">多模态支持:除文本外,支持图片、音视频等富媒体内容</span> </section> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">技术在飞速发展,但打造一个好的知识库系统不仅仅是技术问题。建议从小规模试点开始,在实践中不断优化,让系统真正服务于业务需求。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">最后,近期看到很多小伙伴因为AI而感到危机。</span></p> <p data-tool="mdnice编辑器" style="color: rgb(43, 43, 43);font-size: 14px;line-height: 1.8em;letter-spacing: 0.02em;text-align: left;text-indent: 0em;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 8px;padding-bottom: 8px;padding-left: 0px;padding-right: 0px;"><span leaf="">一臻表示:</span><strong style="color: rgb(53, 148, 247);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;"><span leaf="">AI不会替代人,但会用AI的人大概率会替代不会用AI的人</span></strong><span leaf="">。好比工业时代到互联网时代的转折期,会上网的人,替换了很多不会上网的人。互联网会把工业时代的产业重写一遍,AI也可以重写以往的产业模式。共勉!</span></p> </section>