An intelligent knowledge management method and system for the water conservancy industry

CN123012185APending Publication Date: 2026-10-30ZHONGSHUI SANLI DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611495297.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-24
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0005]本申请提供一种面向水利行业的智能化知识管理方法及系统,旨在解决现有技术在水利行业知识管理过程中,多源异构知识难以统一处理、文档分段与更新方式适应性不足、专业知识检索及连续问答准确性较低、知识结构难以灵活配置以及知识服务跨系统利用能力不足的问题

Benefits of technology

本申请基于对现有技术问题的进一步分析和研究,认识到现有技术在水利行业知识管理过程中,多源异构知识难以统一处理、文档分段与更新方式适应性不足、专业知识检索及连续问答准确性较低、知识结构难以灵活配置以及知识服务跨系统利用能力不足的问题,通过获取水利知识资源及对应的分段配置信息,对水利知识资源进行内容处理和分段处理,得到水利知识单元,使不同来源、不同格式的水利知识资源转化为能够统一存储和检索的内容对象;基于水利知识单元建立多个检索方式对应的检索索引,根据用户查询信息构建上下文查询信息,并对基于上下文查询信息进行多路检索得到的候选检索结果进行融合,使各检索方式的匹配能力相互补充,减少单一检索方式造成的相关知识遗漏,提高检索结果与用户查询需求的匹配程度;通过保存水利知识单元之间的上下文关联关系,在获得融合检索结果后进一步获取关联的上下文内容,使知识应答能够结合上下文查询信息、检索命中的内容及关联的上下文生成,降低知识分段造成的语义割裂对回答完整性和准确性的影响;同时,在水利知识资源发生变化时,确定受影响的水利知识单元及其处理类型,并据此更新相应内容和检索索引,使知识库能够随资源变化保持更新,减少重复处理未变化内容所产生的计算开销,从而缓解水利知识资源分散、检索匹配不足、上下文利用不充分以及知识更新效率较低的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012185A_ABST
    Figure CN123012185A_ABST
Patent Text Reader

Abstract

The application discloses a kind of intelligent knowledge management method and system for water conservancy industry, it is related to knowledge management technical field.Water conservancy knowledge resource and segmented configuration information are acquired, water conservancy knowledge unit is obtained after content processing and segmented processing, the search index corresponding to multiple search modes is established, and context association relationship is established according to the position relationship of water conservancy knowledge unit in corresponding resource;Context query information is constructed according to user query information, and candidate search results are fused by multi-path search on context query information, and context knowledge content is determined according to knowledge search result and context association relationship, and knowledge response information is generated in combination with context query information and is associated with saving;When resource changes, determine the water conservancy knowledge unit affected, and differentially update corresponding content and search index.Through multi-path search fusion and associated context supplement, the degree of search matching and response integrity are improved, and differential updating reduces repeated calculation, and improves knowledge maintenance efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of knowledge management technology, and in particular to an intelligent knowledge management method and system for the water conservancy industry. Background Technology

[0002] With the continuous advancement of water conservancy informatization, a large amount of knowledge resources are constantly being generated in business areas such as water conservancy project construction, hydrological monitoring, flood control and drought relief, river and lake management, equipment operation and maintenance, and water affairs administration. These knowledge resources typically include policies and regulations, standards and specifications, engineering data, hydrological data, flood control plans, operation and maintenance manuals, and accident case studies. Since water conservancy knowledge is often simultaneously linked to river basins, projects, business scenarios, and effective time periods, and different pieces of knowledge exhibit semantic relationships such as synonymy, hierarchy, correlation, and causality, effectively managing and utilizing the ever-growing water conservancy knowledge resources has become a crucial aspect of the digital transformation of the water conservancy industry.

[0003] Current water resources knowledge management methods typically rely on general document knowledge bases or internal archive platforms, primarily providing users with information retrieval services through centralized file storage and keyword matching. However, water resources knowledge resources are scattered and come in diverse formats, making it difficult for existing systems to uniformly parse and organize the knowledge content in text, tables, images, and scanned documents. During document processing, using fixed rules to segment different document types can easily lead to semantic breaks in context, and changes to partial document content often require reprocessing the entire document, resulting in significant resource consumption. Furthermore, in knowledge retrieval, single keyword or semantic searches struggle to simultaneously achieve precise matching of water resources terminology and semantic matching of similar expressions, affecting the completeness and accuracy of knowledge retrieval. Furthermore, existing knowledge-based question-and-answer methods do not make sufficient use of historical context, and when asking follow-up questions, problems such as unclear referents or incoherent questions and answers are likely to occur. The entity categories, attributes, and relationships in knowledge graphs usually rely on pre-defined settings, making it difficult to adapt to the knowledge organization needs of different water conservancy business scenarios. At the same time, there is a lack of a unified and reliable knowledge service mechanism between the knowledge base and external business platforms such as hydrological monitoring, flood control command, and engineering management, which limits the cross-system utilization of knowledge resources.

[0004] Therefore, in the process of knowledge management in the water conservancy industry, the following issues urgently need to be addressed: the difficulty in uniformly processing multi-source heterogeneous knowledge, the insufficient adaptability of document segmentation and updating methods, the low accuracy of professional knowledge retrieval and continuous question answering, the difficulty in flexibly configuring knowledge structures, and the insufficient cross-system utilization capability of knowledge services. Summary of the Invention

[0005] This application provides an intelligent knowledge management method and system for the water conservancy industry, aiming to solve the problems in the existing technology for knowledge management in the water conservancy industry, such as the difficulty in uniformly processing multi-source heterogeneous knowledge, insufficient adaptability of document segmentation and updating methods, low accuracy of professional knowledge retrieval and continuous question answering, difficulty in flexibly configuring knowledge structure, and insufficient cross-system utilization capability of knowledge services.

[0006] Firstly, an intelligent knowledge management method for the water conservancy industry, the method comprising: Obtain water conservancy knowledge resources and corresponding segmentation configuration information; perform content processing and segmentation processing on the water conservancy knowledge resources according to the segmentation configuration information to obtain water conservancy knowledge units. Based on the water conservancy knowledge units, a retrieval index corresponding to multiple retrieval methods is established, along with the contextual relationships between the water conservancy knowledge units, to obtain a water conservancy knowledge base. The contextual relationships are established based on the positional relationships of the water conservancy knowledge units in the corresponding water conservancy knowledge resources, and are used to represent the correspondence between the water conservancy knowledge units and other water conservancy knowledge units that can supplement the context of the water conservancy knowledge units. Obtain user query information, construct context query information based on the user query information, retrieve the context query information based on multiple retrieval indexes to obtain multiple candidate retrieval results, and fuse the multiple candidate retrieval results to obtain knowledge retrieval results; The contextual knowledge content is determined based on the knowledge retrieval results and the contextual association relationship. The contextual query information and the contextual knowledge content are combined to obtain the knowledge response input information. The knowledge response input information is input into the language model to obtain the knowledge response information. The user query information, the knowledge retrieval results and the knowledge response information are associated and managed. When the water conservancy knowledge resources change, the affected water conservancy knowledge units are determined based on the change information of the water conservancy knowledge resources, and the affected water conservancy knowledge units and their corresponding retrieval indexes are differentially updated to obtain the updated water conservancy knowledge base.

[0007] Optionally, in the above scheme, the step of acquiring water conservancy knowledge resources and corresponding segmentation configuration information, and performing content processing and segmentation processing on the water conservancy knowledge resources according to the segmentation configuration information to obtain water conservancy knowledge units, includes: Original water conservancy knowledge documents with different data formats and content carriers are obtained, and the original water conservancy knowledge documents are parsed and their content is identified to obtain the original water conservancy knowledge content. The original water conservancy knowledge content is subjected to duplicate content identification and data cleaning to obtain candidate water conservancy knowledge content; Based on water conservancy terminology, the candidate water conservancy knowledge content is semantically annotated and formatted to obtain standardized water conservancy knowledge content. Obtain the segmentation configuration information corresponding to the standardized water conservancy knowledge content, and segment the standardized water conservancy knowledge content according to the segmentation configuration information to obtain the water conservancy knowledge unit.

[0008] Optionally, in the above scheme, the step of segmenting the standardized water conservancy knowledge content according to the segmentation configuration information to obtain the water conservancy knowledge unit includes: The parent-child level segmentation rules, maximum slice length, and overlap region length are extracted from the segmentation configuration information to obtain the target segmentation parameters; The title and chapter structure of the standardized water conservancy knowledge content are parsed according to the parent-child segmentation rules in the target segmentation parameters to obtain document hierarchy information; Based on the document hierarchy information, the standardized water conservancy knowledge content is divided into chapter-level segments to obtain parent-level knowledge slices; Within each parent knowledge slice, sliding segmentation is performed based on the maximum slice length and the overlap area length to obtain child knowledge slices; Based on the source location of each child knowledge slice, a parent-child association relationship is established between the child knowledge slice and its corresponding parent knowledge slice to obtain the water conservancy knowledge unit. The child knowledge slice is used for knowledge retrieval, and the parent knowledge slice is used to determine the contextual knowledge content.

[0009] Optionally, in the above scheme, the step of establishing a retrieval index corresponding to multiple retrieval methods based on the water conservancy knowledge units and the contextual association relationship between the water conservancy knowledge units to obtain a water conservancy knowledge base includes: Obtain the entity categories, entity attributes, and entity relationships configured by the user to obtain knowledge entity structure information; Based on the knowledge entity structure information, an entity extraction instruction is constructed. The entity extraction instruction and the water conservancy knowledge unit are input into the language model to obtain candidate entity nodes and candidate entity relationships. Based on the knowledge entity structure information, the candidate entity nodes and the candidate entity relationships are subjected to entity category legality verification, entity attribute integrity verification, and relationship end-to-end category matching verification to obtain the verified entity relationship data. The verified entity relationship data is then merged with entities of the same type and name and deduplicated to obtain the target knowledge graph data. Based on the positional relationship of the water conservancy knowledge units in the corresponding water conservancy knowledge resources, the contextual association relationship between the water conservancy knowledge units is established to obtain knowledge association data; The water conservancy knowledge units are vectorized and indexed by text respectively to obtain semantic retrieval index and text retrieval index; The water conservancy knowledge units, the target knowledge graph data, the knowledge association data, the semantic retrieval index, and the text retrieval index are associated and stored to obtain the water conservancy knowledge base.

[0010] Optionally, in the above scheme, the steps of obtaining user query information, constructing context query information based on the user query information, retrieving the context query information based on multiple retrieval indexes to obtain multiple candidate retrieval results, and fusing the multiple candidate retrieval results to obtain knowledge retrieval results include: Obtain the user query information and its corresponding session identifier, and query the session record based on the session identifier; When a session record corresponding to the session identifier is found, the found session record is identified as the target session record; when no session record corresponding to the session identifier is found, a session record corresponding to the session identifier is created to obtain the target session record. Based on the target session record, extract the complete question-and-answer rounds within the preset window from the session message history data to obtain historical session information; The historical session information and the user query information are combined in chronological order to obtain the context query information; The context query information is retrieved based on multiple retrieval indexes, and the multiple candidate retrieval results are merged to obtain the knowledge retrieval result.

[0011] In the above scheme, optionally, the plurality of retrieval indexes include semantic retrieval indexes and text retrieval indexes; the step of retrieving the context query information based on the plurality of retrieval indexes respectively, and fusing the obtained plurality of candidate retrieval results to obtain the knowledge retrieval result includes: The context query information is vectorized to obtain the query feature vector; Based on the query feature vector and the semantic retrieval index, a semantic retrieval of the water conservancy knowledge unit is performed to obtain a first candidate retrieval result containing the first candidate water conservancy knowledge unit and its semantic retrieval score; Based on the context query information and the text retrieval index, a text retrieval of the water conservancy knowledge unit is performed to obtain a second candidate retrieval result containing the second candidate water conservancy knowledge unit and its text retrieval score; Align the first candidate search result and the second candidate search result according to the water conservancy knowledge unit identifier to obtain the candidate fusion result; The semantic retrieval score and text retrieval score in the candidate fusion results are normalized respectively to obtain the normalized retrieval score; The normalized search scores corresponding to the same water conservancy knowledge unit are weighted and fused according to the preset search weights to obtain the comprehensive search score. The candidate fusion results are sorted, deduplicated, and threshold-filtered based on the comprehensive retrieval score to obtain the knowledge retrieval results.

[0012] Optionally, in the above scheme, the step of determining contextual knowledge content based on the knowledge retrieval results and the contextual association, combining the contextual query information and the contextual knowledge content to obtain knowledge response input information, inputting the knowledge response input information into a language model to obtain knowledge response information, and managing the association between the user query information, the knowledge retrieval results, and the knowledge response information includes: The knowledge retrieval results are reordered based on relevance to obtain the target water conservancy knowledge unit; Based on the contextual association, determine the contextual water conservancy knowledge unit associated with the target water conservancy knowledge unit; The target water conservancy knowledge unit and the context water conservancy knowledge unit are combined to obtain the context knowledge content; The context query information and the context knowledge content are combined to obtain the knowledge response input information; The knowledge response input information is input into the language model to obtain the knowledge response information; The user query information, the knowledge retrieval results, and the knowledge response information are associated and stored in the session message history data corresponding to the target session record to obtain the updated session message history data.

[0013] Optionally, in the above scheme, when the water conservancy knowledge resources change, determining the affected water conservancy knowledge units based on the change information of the water conservancy knowledge resources, and performing differential updates on the affected water conservancy knowledge units and their corresponding retrieval indexes to obtain an updated water conservancy knowledge base includes: Obtain slice editing information for the water conservancy knowledge resource, extract operation markers from the slice editing information, and extract the slice identifier and / or slice content required for the corresponding operation based on the operation markers to obtain slice change data; Based on the operation marker, the slice change data is divided into at least one of the following: new operation data, modification operation data, and deletion operation data, to obtain a slice differential operation set; Based on the slice difference operation set, perform corresponding add, modify or delete operations on the water conservancy knowledge units in the water conservancy knowledge base to obtain the knowledge unit change results. Based on the knowledge unit change results, the newly added or modified water conservancy knowledge units are vectorized and text indexed, and the corresponding search indexes of the deleted water conservancy knowledge units are deleted to obtain the index change results. Based on the changes to the knowledge units and the indexes, the water conservancy knowledge units, contextual relationships, and retrieval indexes in the water conservancy knowledge base are updated synchronously to obtain the updated water conservancy knowledge base.

[0014] Optionally, the above scheme may also include: Obtain an interface subscription application sent by an external business platform. When the interface subscription application is approved, generate an interface access token associated with the external business platform and its retrieval permissions, and obtain interface authorization information. Receive an external knowledge retrieval request sent by the external business platform, and extract the access token to be verified from the external knowledge retrieval request; The access token to be verified is matched with the interface authorization information to obtain the interface authentication result; When the interface authentication result is successful, external query information is extracted from the external knowledge retrieval request, and the external query information is retrieved based on the water conservancy knowledge base to obtain the external knowledge retrieval result; The search scores in the external knowledge retrieval results are mapped to a preset numerical range, and the external knowledge retrieval results are converted according to the interface field rules corresponding to the external business platform to obtain standard search response data. The standard search response data is sent to the external business platform.

[0015] Secondly, an intelligent knowledge management system for the water conservancy industry, the system comprising: The knowledge unit generation module is used to acquire water conservancy knowledge resources and segmentation configuration information corresponding to the water conservancy knowledge resources, and to perform content processing and segmentation processing on the water conservancy knowledge resources according to the segmentation configuration information to obtain water conservancy knowledge units. The knowledge base construction module is used to establish retrieval indexes corresponding to multiple retrieval methods and contextual relationships between the water conservancy knowledge units based on the water conservancy knowledge units, thereby obtaining a water conservancy knowledge base; wherein, the contextual relationships are established according to the positional relationship of the water conservancy knowledge units in the corresponding water conservancy knowledge resources, and are used to represent the correspondence between the water conservancy knowledge units and other water conservancy knowledge units that can supplement the context of the water conservancy knowledge units. The fusion retrieval module is used to obtain user query information, construct context query information based on the user query information, retrieve the context query information based on multiple retrieval indexes to obtain multiple candidate retrieval results, and fuse the multiple candidate retrieval results to obtain knowledge retrieval results; The knowledge response management module is used to determine the contextual knowledge content based on the knowledge retrieval results and the contextual association, combine the contextual query information and the contextual knowledge content to obtain knowledge response input information, input the knowledge response input information into the language model to obtain knowledge response information, and perform association management of the user query information, the knowledge retrieval results and the knowledge response information; The differential update module is used to determine the affected water conservancy knowledge units based on the change information of the water conservancy knowledge resources when the water conservancy knowledge resources change, and to perform differential updates on the affected water conservancy knowledge units and their corresponding retrieval indexes to obtain the updated water conservancy knowledge base.

[0016] Compared with the prior art, this application has at least the following beneficial effects: This application, based on further analysis and research of existing technical problems, recognizes that existing technologies in the knowledge management process of the water conservancy industry suffer from several shortcomings: difficulty in uniformly processing multi-source heterogeneous knowledge, insufficient adaptability of document segmentation and updating methods, low accuracy of professional knowledge retrieval and continuous question answering, difficulty in flexibly configuring knowledge structures, and insufficient cross-system utilization capabilities of knowledge services. By acquiring water conservancy knowledge resources and corresponding segmentation configuration information, this application performs content processing and segmentation on the water conservancy knowledge resources to obtain water conservancy knowledge units. This transforms water conservancy knowledge resources from different sources and in different formats into content objects that can be uniformly stored and retrieved. Based on the water conservancy knowledge units, a retrieval index is established corresponding to multiple retrieval methods. Contextual query information is constructed based on user query information, and candidate retrieval results obtained from multi-way retrieval based on contextual query information are fused to enhance the effectiveness of each retrieval method. The matching capabilities complement each other, reducing the omission of relevant knowledge caused by a single search method and improving the matching degree between search results and user query needs. By preserving the contextual relationships between water conservancy knowledge units, the associated contextual content is further obtained after obtaining the fused search results, enabling knowledge responses to be generated by combining contextual query information, search-hit content, and associated context, reducing the impact of semantic fragmentation caused by knowledge segmentation on the completeness and accuracy of the answers. At the same time, when water conservancy knowledge resources change, the affected water conservancy knowledge units and their processing types are identified, and the corresponding content and search indexes are updated accordingly, so that the knowledge base can be kept updated as resources change, reducing the computational overhead caused by repeatedly processing unchanged content, thereby alleviating the problems of scattered water conservancy knowledge resources, insufficient search matching, inadequate use of context, and low knowledge update efficiency. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating an intelligent knowledge management method for the water conservancy industry, provided as an embodiment of this application. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0019] In one embodiment, such as Figure 1 As shown, an intelligent knowledge management method for the water conservancy industry is provided. This method is executed by a knowledge management program deployed on a server, used to process, retrieve, respond to, and update water conservancy knowledge resources such as policies and regulations, standards and specifications, engineering data, hydrological data, flood control plans, operation and maintenance manuals, and accident cases. Water conservancy knowledge resources can originate from water conservancy government affairs platforms, engineering archive systems, hydrological monitoring systems, or user-uploaded files. Their content carriers include electronic text, tables, text information in drawings, scanned copies, and images.

[0020] First, the water resources knowledge resources and their corresponding segmentation configuration information are obtained. The segmentation configuration information determines the segmentation rules and parameters used when converting document content into water resources knowledge units. This information can be bound to a single document or to the knowledge base to which the document belongs. If document-level configuration exists, it is used; otherwise, knowledge base-level configuration is used. Content processing converts resources of different formats into content that can be segmented and indexed. Segmentation processing then divides the processed content into water resources knowledge units according to the selected configuration.

[0021] Water resources knowledge units are the basic content objects involved in storage, retrieval, or context organization. In one implementation, water resources knowledge units are stored in the form of knowledge slices. Each knowledge slice records the slice identifier, content, type, affiliated resource, and its position within the resource. Slice types can include text and table types, corresponding to the Text and Table fields in the interface, respectively. By associating slices with their affiliated resources, the original document can be located based on the slice found during retrieval, without relying on the document name as a unique identifier.

[0022] Subsequently, retrieval indexes corresponding to multiple retrieval methods are established based on water conservancy knowledge units. In one implementation, the multiple retrieval methods include semantic retrieval and text retrieval: the semantic retrieval index stores the feature vectors corresponding to the water conservancy knowledge units, and the text retrieval index stores the index data formed by the text content of the water conservancy knowledge units. Each retrieval index is associated with a corresponding water conservancy knowledge unit identifier, so that the results returned by different retrieval methods can locate the same content object.

[0023] While establishing the retrieval index, the contextual relationships between water conservancy knowledge units are preserved. These contextual relationships are established based on the positional relationship of each water conservancy knowledge unit within its corresponding water conservancy knowledge resource, representing the correspondence between a water conservancy knowledge unit and other water conservancy knowledge units that can supplement the context of that unit. In one specific implementation, a parent-child relationship is used between parent and child knowledge slices. The child knowledge slice records the identifier of its parent knowledge slice. The parent knowledge slice contains the more complete content of its respective chapter, while the child knowledge slice contains the local content within that chapter used for retrieval matching.

[0024] The water resources knowledge base is organized according to primary business categories, secondary business scenarios, and tertiary knowledge entries, and stores index information such as keywords, scenarios, and time. Business categories can correspond to engineering construction, hydrological monitoring, flood control and drought relief, river management, equipment operation and maintenance, or water affairs administration. Information such as river basins, projects, and effective time periods are stored as descriptive information for related resources, enabling the same knowledge object to be associated with different business dimensions simultaneously. For example, a reservoir flood control scheduling procedure can be associated with its river basin, corresponding water conservancy project, and flood season scheduling scenario.

[0025] After obtaining user query information, contextual query information is constructed based on this information. This contextual query information is then retrieved using multiple retrieval indexes to obtain multiple candidate search results. The user query information represents the content of the current query; the contextual query information is constructed by combining historical session information with the user query information, or, if no historical session information is available, only the user query information is used. Each candidate search result contains at least the identifier of the matched water conservancy knowledge unit, its content, and the corresponding search score. The same object from different channels is merged using the water conservancy knowledge unit identifier, and then the search scores are processed and fused to obtain the knowledge retrieval results. Therefore, content with identical textual descriptions and content with different textual descriptions but similar semantics can both enter the candidate scope.

[0026] Based on the water conservancy knowledge unit identifiers in the knowledge retrieval results, their contextual relationships are read, and the associated contextual knowledge content is obtained. In the parent-child level slice implementation, after the retrieval hits a child-level knowledge slice, its parent-level knowledge slice is traced back, and the content of the parent-level knowledge slice is used to supplement the chapter context of the retrieved segment. The contextual query information and contextual knowledge content are combined into knowledge response input information, which is then input into the language model to generate knowledge response information. The language model can be ChatGLM4; the model name used does not change the aforementioned data processing and context organization process.

[0027] After generating knowledge response information, the user query information, knowledge retrieval results, and knowledge response information are linked and saved. The document title, resource identifier, and slice identifier in the knowledge retrieval results are used to record the knowledge source used in the response; the user query information and knowledge response information are used to form historical messages that can be read in subsequent conversations. For continuous question-and-answer sessions, historical conversation information can be further utilized according to the following conversation record management method.

[0028] When changes occur in water resources knowledge resources, the affected water resources knowledge units are identified based on the operation markers and slice identifiers in the change information. New content corresponds to newly added water resources knowledge units, modified content corresponds to the replacement of content in existing water resources knowledge units, and deleted content corresponds to the removal of existing water resources knowledge units. The affected water resources knowledge units and their search indexes are updated accordingly, while unaffected water resources knowledge units and their existing vectors remain unchanged. The updated water resources knowledge base is used for subsequent retrieval and response.

[0029] This embodiment converts heterogeneous water conservancy knowledge resources into water conservancy knowledge units with indexes and contextual relationships, enabling multiple retrieval methods to merge results around the same content object and obtain its associated context after hitting local content, thereby reducing missed detections caused by a single matching method and response deviations caused by insufficient local fragment information; furthermore, it uses the affected water conservancy knowledge units as the update objects to avoid local changes triggering the reprocessing of all content, reducing the overhead of repeated calculations and storage while maintaining knowledge retrieval.

[0030] In this embodiment, the original water conservancy knowledge documents are obtained through one or more of the following methods: targeted web crawling, third-party system interface integration, and manual uploading. Targeted web crawling retrieves policy regulations, standards, and specifications according to the configured data sources; third-party system interfaces are used to receive engineering data, hydrological data, or business documents; and manual uploading is used to receive local files and historical archives. After collection, source information and resource identifiers are saved to support subsequent document processing and result traceability.

[0031] Different formats of original water conservancy knowledge documents are parsed and their content recognized. For Word documents, text-based PDFs, and electronic texts that can directly read text, the main text, paragraphs, and headings are parsed; for spreadsheets and reports, the table content is read; for scanned documents and images, OCR text recognition is used to extract text. When engineering drawings are involved, the recognizable text content and related instructions are extracted, but text recognition is not equated with understanding the entire geometric structure of the drawings.

[0032] Through the above processing, the original water conservancy knowledge content is obtained for subsequent cleaning. For table content, the table type identifier is retained to distinguish it from ordinary text during previewing, editing, and saving. For the parsed titles, chapters, and paragraph structures, the corresponding hierarchical information is retained to provide input for subsequent parent-child level segmentation.

[0033] Duplicate content identification is performed on the original water conservancy knowledge content. Duplicate uploaded or collected content is identified through text similarity calculation, and duplicate content is removed. Redundant content generated during OCR recognition and format conversion is cleaned up to obtain candidate water conservancy knowledge content. Duplicate content identification aims to reduce the repeated storage of the same content, preventing specifications with different validity periods or revisions from being automatically considered the same content simply because of identical titles.

[0034] Subsequently, semantic annotation was performed on candidate water conservancy knowledge content based on water conservancy professional terminology. Semantic annotation is used to characterize professional terms and their semantic relationships, such as identifying similar expressions corresponding to "flood control limit water level" and "flood prevention limit water level," as well as the association between concepts such as "flood control scheduling" and "flood discharge." The annotated content maintains a correspondence with the original text, enabling subsequent searches to utilize terminology semantics while preserving original expressions such as standard numbers and professional names.

[0035] The format of the annotated content is standardized, and fragmented information belonging to the same content object is integrated to obtain standardized water conservancy knowledge content. Format standardization is mainly used to ensure that content from different carriers has a consistent processing entry point, without changing the original technical meaning, numerical values, and validity information of the document.

[0036] After obtaining the segmentation configuration information corresponding to the standardized water conservancy knowledge content, water conservancy knowledge units are formed according to rules such as identifier segmentation, line segmentation, or parent-child segmentation. Identifier segmentation can use user-configured separators such as "###" or "==="; line segmentation uses parsed text lines as units; parent-child segmentation is performed according to the parent-child knowledge slice generation process described below. Each segmentation result retains its association with the resource to which it belongs.

[0037] This embodiment performs format parsing and text recognition based on the content carrier, and then sequentially performs deduplication and cleaning, semantic annotation of professional terms, and format unification. This transforms documents that are originally difficult to process uniformly into standardized content that can be used in the same segmentation and indexing process, reduces the interference of duplicate resources on search results, and provides a consistent data foundation for professional term matching, document structure preservation, and subsequent knowledge unit generation.

[0038] In this embodiment, segmentation configuration information is stored in the knowledge base segmentation rule table `KNOWLEDGE_SLICE_RULE`, and the knowledge base resource table `KNOWLEDGE_SOURCE` stores information related to segmentation processing and slice editing. Users can set default segmentation configuration information for the knowledge base or for individual documents. When processing a document, document-level configuration is read first; if no document-level configuration exists, the default configuration of its respective knowledge base is read.

[0039] When selecting parent-child level segmentation, the parent-child level segmentation rules, maximum slice length, and overlap length are obtained from the segmentation configuration information to form the target segmentation parameters. The maximum slice length limits the number of characters in a single child-level knowledge slice after sliding segmentation, and the overlap length determines the number of characters that adjacent child-level knowledge slices jointly retain. The overlap length should be less than the maximum slice length to allow sliding segmentation to advance further into the document.

[0040] Based on parent-child segmentation rules, the headings and chapter structures in standardized water conservancy knowledge content are parsed to obtain document hierarchy information. Parent knowledge slices are generated according to chapter boundaries, ensuring that each parent knowledge slice preserves the context content of its corresponding chapter. The headings and chapter structures are derived from the parsed results of previous documents, and parent knowledge slices are not formed by arbitrarily concatenating unrelated paragraphs.

[0041] Within each parent knowledge slice, child knowledge slices are generated based on paragraph content, maximum slice length, and overlap length. For paragraphs not exceeding the maximum slice length, their complete content is retained; for paragraphs exceeding the maximum slice length, a second segmentation is performed to ensure that the generated child knowledge slices do not exceed their corresponding length limits. The sliding segmentation uses the following relationship:

[0042] The starting and ending positions both use the same character position counting method. The overlapping content retained at the end of the current child-level knowledge slice serves as the starting content for the next child-level knowledge slice, ensuring that limiting conditions or technical terms near the segmentation boundary can coexist in adjacent slices. Upon reaching the end of the parent-level knowledge slice, the remaining content forms the last child-level knowledge slice.

[0043] Each time a child knowledge slice is generated, its parent knowledge slice and its source position within that parent slice are recorded. This establishes a parent-child relationship, avoiding the need to generate slices without a hierarchical relationship and then guess their parent affiliation. Child knowledge slices are used to build the retrieval index, while parent knowledge slices provide contextual knowledge content after a child knowledge slice is matched.

[0044] Before the formal submission, you can call POST / api / knowledge / knowledge_source / preview_split to perform a split preview. The request parameters include the resource file identifier sys_source_id and the split configuration config. The type field in the config distinguishes between processing types such as excel and document. The returned slice list includes chunk_index, chunk_name, chunk_content, and type, which represent the slice index, slice name, slice content, and slice type, respectively.

[0045] Users can check the slice boundaries and content integrity based on the preview results, and can add, modify, or delete slices. Confirmed slices serve as input for formal storage and index building; subsequent modifications to already stored slices are performed according to the slice-level differential update process described below. Previewing and editing do not change the fundamental division of labor between parent and child slices for retrieval and contextual organization.

[0046] This embodiment first forms a chapter-level parent knowledge slice, and then forms child knowledge slices within it, so that each retrieval unit has a clear contextual source; by overlapping the segmentation, the impact of semantic truncation at the boundary is reduced, and by previewing and manually editing to correct inappropriate segmentation results, the local retrieval granularity and the integrity of the response context are taken into account, thereby improving the segmentation adaptability under different document structures.

[0047] In this embodiment, users create entity category groups through a visual interface, configure entity categories, entity attributes, and entity relationships within the category groups, and obtain knowledge entity structure information. Entity categories can be "reservoir" and "river." Entity attributes for a reservoir can include name, location, and capacity, while entity attributes for a river can include name. Entity relationships specify the relationship name, source entity category, and target entity category, for example, "reservoir—located at—river." Category and attribute configurations can also be imported in batches by uploading an Excel file.

[0048] The knowledge entity structure information is stored in the entity category group table TEMP_GRAPH_LABEL_GROUP, the entity category configuration table TEMP_GRAPH_LABEL, the category attribute configuration table TEMP_GRAPH_LABEL_PROPERTIES, and the category relationship configuration table TEMP_GRAPH_LABEL_REL. The entity category group table records ID, NAME, DESCRIPTTION, CREATOR_ID, and CREATED_AT; the entity category configuration table records ID, GROUP_ID, NAME, SHOW_LABEL, and ENABLE, used to represent category affiliation, displayed fields, and enabled status.

[0049] The category attribute configuration table records ID, NAME, TYPE, LABEL_ID, and TARGET_LABEL_ID. TYPE values ​​of 0, 1, and 2 represent the display column, relation, and text, respectively. TARGET_LABEL_ID points to the target entity category in the relation configuration. The category relation configuration table records the correspondence between attributes, source entity categories, and target entity categories through PROPERTIES_ID, FROM_LABEL_ID, and TARGET_LABEL_ID.

[0050] The above configuration is converted into structured JSON, forming the structural constraint input for the entity extraction instruction. In the structured JSON, the labels section describes the entity categories and attribute list, while the relations section describes the relation names and their source and target categories. The system embeds this structured JSON into a pre-defined prompt template, forming the entity extraction instruction, which requires the language model to output entity relation data according to the specified categories, attributes, and relation structure.

[0051] When calling `POST / api / graph / temp_graph_source / handler_temp`, you can submit `file`, `struct`, and `prompts` via `multipart / form-data`. Here, `file` represents the document to be processed, `struct` represents a JSON string containing the knowledge entity structure information, and `prompts` represents optional domain hints. For example, a domain hint could request the extraction of reservoir information from the document, unifying the reservoir capacity unit to 100 million cubic meters. After the document content is processed to form water resources knowledge units, it is used as input to the language model along with the entity extraction instructions.

[0052] The language model outputs candidate entity nodes and candidate entity relationships. Candidate entity nodes are represented by the `nodes` array, where each node includes `id`, `label`, and `properties`, representing the node identifier, entity category, and attribute key-value pair, respectively. Candidate entity relationships are represented by the `rels` array, where each relationship includes `source`, `target`, and `label`, representing the starting node, target node, and relationship type, respectively.

[0053] For example, for a document containing information about the Danjiangkou Reservoir and the Han River, the language model can output a node n1 of the category "reservoir" and a node n2 of the category "river," and output a relation from n1 to n2 with the relation type "located in." The node's name, location, and reservoir capacity are taken from the document to be processed, and saved after review and confirmation, rather than being preset by the system as factual values ​​of these engineering attributes.

[0054] The model returns results and undergoes entity category validity verification to check if the node category exists in the knowledge entity structure information; entity attribute integrity verification to check if the node attributes meet the configuration requirements; and category matching verification at both ends of the relationship to check if the categories of the nodes connected by the relationship meet the source and target category constraints. Entity relationship data that does not meet the constraints is filtered or corrected during the review stage to obtain the verified entity relationship data.

[0055] Subsequently, nodes with the same name within the same entity category are merged, confirmed aliases are normalized, and duplicates are removed based on the relationship triples consisting of source, target, and label. During the node merging process, attribute conflicts are handled using the latest extracted result with non-empty field values. For cases where the automatic rules cannot distinguish between nodes with the same name but actually pointing to different project objects, manual review and confirmation are required to avoid incorrect merging simply due to the same name.

[0056] The temporary gravitational resource table TEMP_GRAPH_SOURCE stores the ID, GROUP_ID, TEMP_GRAPH_ID, SOURCE_NAME, SOURCE_TYPE, STATUS, SYS_SOURCE_ID, DATA_JSON, STEPS, CREATOR_ID, CREATED_AT, and UPDATED_AT. DATA_JSON stores the gravitational data in CLOB format, STEPS records extraction and processing steps, and STATUS records the processing status. The processing step record is used to locate failed stages and supports retries from recorded processing stages.

[0057] The model output and validation results are initially stored in a temporary graph resource table and are not directly written to the official graph database. After user approval, the resource identifier (id), nodes, and rels are submitted via POST / api / graph / temp_graph_source / submit_data to write the confirmed target knowledge graph data to the official graph database; alternatively, the graph data can be downloaded via GET / api / graph / temp_graph_source / download_data.

[0058] Regarding contextual relationships, based on the parent-child relationship records formed by the aforementioned parent-child segmentation process, child-level knowledge slices are associated with their corresponding parent-level knowledge slices. This association describes the hierarchical affiliation of document content, which differs from entity relationships such as "located" in the graph. The two are stored separately, and the semantic relationship between entities does not replace the contextual affiliation between document slices.

[0059] For the water conservancy knowledge units involved in the retrieval, BCE-Embedding is used to generate feature vectors, which are then associated with and saved with knowledge unit identifiers to obtain a semantic retrieval index. A text retrieval index is also created for the text content of the same water conservancy knowledge units. PostgreSQL, in conjunction with pgvector, stores document slice vectors and related keyword vectors; Neo4j stores the target knowledge graph data; and a relational database stores resource, category configuration, and knowledge base metadata. Associations are maintained through resource identifiers, knowledge unit identifiers, and graph resource records.

[0060] The knowledge base uses UUIDs as unique identifiers and association criteria; names are used only for display purposes. Child knowledge bases under the same parent node retain name restrictions, while different parent nodes are allowed to use the same name, enabling different watersheds or projects to use names such as "standard library" without confusing their data ownership.

[0061] This embodiment converts user-defined knowledge entity structure information into extraction instructions that the language model can execute. By combining structure verification, entity merging, relation deduplication, and manual review, changes in structure configuration are transformed into changes in extraction constraints, eliminating the need to rewrite the extraction program for each category adjustment. By separately saving graph relations, contextual relations, and retrieval indexes, knowledge organization, document context backtracking, and multi-method retrieval have a clear data foundation, and the risk of model outputs that do not conform to structural constraints being directly entered into the formal knowledge base is reduced.

[0062] In this embodiment, the system sets up a session record table CHAT_RECORD and a session message history table CHAT_RECORD_HISTORY to store session-level information and message-level information, respectively. In the session record table, ID is a unique identifier for the session, RECORD_TYPE indicates the record type, CHAT indicates a question-and-answer session, TITLE indicates the session title, CREATOR_ID indicates the creating user, CREATED_AT and UPDATED_AT indicate the creation time and last update time, respectively, PINNED_AT indicates the pinning time, and null values ​​indicate that it was not pinned. The identifier and name fields can use VARCHAR(255), and the time field uses DATETIME.

[0063] The ID in the session message history table is a unique identifier for the message. RECORD_ID is associated with the ID in the session record table. ROLE distinguishes between two message roles: user and ai. CONTENT stores the message content in TEXT format. EXTEND_JSON stores structured extended information such as referenced documents and knowledge retrieval results in TEXT format. CREATED_AT and CREATOR_ID record the message time and the user who created it.

[0064] When a user submits a query, the system reads the session identifier carried by the user and queries the session record. If an existing record is found, it is used as the target session record. For the first question-and-answer session or when no session record has been established, a session record is created and a unique session identifier is generated, and subsequent messages are associated with this record. After the session record is established, its identifier is used for subsequent retrieval of message history and storage of the current round of questions and answers.

[0065] Based on the target session record, extract the most recent N rounds of complete question-and-answer sessions during the database read phase. In one implementation, N=10, and each round consists of a user message and its corresponding response message. Select the most recent complete question-and-answer rounds in reverse chronological order, and then organize the selected messages in forward chronological order to form historical session information. No arbitrarily recent 20 messages should be directly equated to 10 rounds of complete question-and-answer sessions; the pairing relationship between user messages and their corresponding response messages should be maintained.

[0066] If the number of historical messages is less than N rounds, read the existing complete Q&A; if a new session has no historical messages, process it with empty historical session information, and construct context query information only based on the current user's query information. Messages outside the window continue to be stored in the session message history table for retrieval and tracing, but do not participate in the construction of this context query information.

[0067] Based on role and time sequence, historical session information is combined with the current user's query information to obtain contextual query information. Referenced documents and search results in the extended fields are read as needed; not all historical extended data is appended to the model input by default. It should be noted that the fixed number of question-and-answer rounds limits the number of historical messages; only when input conditions such as message length are also controlled can the total input length be further limited. A constant character count cannot be derived solely from the "last 10 rounds".

[0068] For example, when a user initiates a "Reservoir Dispatch Procedure Consultation" session, they first ask "What principles should be followed in reservoir flood control dispatching?" and then ask "How is the flood control limit water level determined?" When constructing the context query information for the second query, the first question and answer are combined with the current question, so that the retrieval and response process can obtain the preceding context of "flood control dispatching".

[0069] The session management interfaces include POST / api / chat / record / create, GET / api / chat / record / page, GET / api / chat / record / detail, POST / api / chat / record / update, and POST / api / chat / record / delete, used for creating, paginating, querying details, updating, and deleting session records, respectively. The create interface receives title and record_type, while the pagination interface receives page, page_size, title, and record_type.

[0070] The pinning API (POST / api / chat / record / pin) receives `id` and `pinned`. `pinned` is true when pinned, and false when pinned. The message history API includes `GET / api / chat / record / history / list`, `GET / api / chat / record / history / by_record`, `POST / api / chat / record / history / create`, and `POST / api / chat / record / history / delete`, used for conditional queries, reading messages by session, creating messages, and deleting messages, respectively. `record_id` is used to locate the associated session, and `role` is used to filter messages by role.

[0071] This embodiment achieves session location and message tracing by separating and storing session-level records and message-level records. By selecting the most recent complete question-and-answer round during the database reading stage, it reduces the overhead of loading the full history and input concatenation, and enables the current query to inherit the relevant preceding context, thereby reducing the need to repeatedly describe the business background when continuously asking follow-up questions, while avoiding the number of historical messages entering the current processing process indefinitely as the session continues.

[0072] In this embodiment, the context query information is vectorized using the same vector model as when it was entered into the database, resulting in a query feature vector. The cosine similarity between the query feature vector and the water conservancy knowledge unit vector is calculated using pgvector to obtain the first candidate retrieval result. The first candidate retrieval result saves the candidate water conservancy knowledge unit identifier, content, and semantic retrieval score, avoiding the situation where only the score is saved without being able to locate the corresponding text.

[0073] Based on the contextual query information, a text retrieval index is used to obtain the second candidate search result. Text retrieval utilizes text matching information based on standard numbers, terms, and keywords. When using the BM25 channel, text relevance is calculated using the corresponding BM25 score; when using the full-text search channel, the matching content is retrieved using the PostgreSQL full-text index. The original scores are retained for both channels, and the values ​​generated by different scoring methods are not directly added together.

[0074] The system supports five search modes: vector, BM25, fulltext, ts_rank_cd, and hybrid, corresponding to pure vector search, BM25 search, full-text search, coverage-ranked search based on ts_rank_cd, and hybrid search, respectively. Hybrid search can employ parallel retrieval using vector search, BM25 search, and full-text search. Both BM25 search and full-text search are specific implementations of text retrieval.

[0075] Using the water conservancy knowledge unit identifier as the alignment key, candidate objects from different channels are merged to obtain the candidate fusion result. When the same knowledge unit appears in multiple channels, it corresponds to the same candidate object, and the score of each channel is retained respectively; objects that appear only in some channels are still retained in the candidate fusion result, and the score of the channels that do not appear is recorded as 0.

[0076] For each retrieval channel, the candidate hit score is normalized using the min-max method, with the following formula:

[0077] Where s represents the original score of a hit candidate within that channel. and These represent the minimum and maximum scores of the candidate hits for that channel in the same query, respectively. This represents the normalized score. Normalization is calculated based on the hit set of each channel. Zeros added to missing channels are not included in the original score of that channel in the extreme value calculation.

[0078] When a channel has no candidate results, its contribution to the candidate fusion result is 0. When a channel has only one hit result or all hit results have the same score, it cannot be directly calculated with a denominator of 0. Instead, the implementation program should set and fix the boundary processing rules for equal scoring. These boundary rules are executed differently from the normalization processing used for other candidates to prevent abnormal values ​​from entering the fusion sorting.

[0079] The comprehensive score for the three-way hybrid retrieval is calculated using the following formula:

[0080] Here, "Score" represents the comprehensive retrieval score for the same water conservancy knowledge unit. , and These represent the raw scores for vector search, BM25 search, and full-text search, respectively. , and These represent the weights of the corresponding channels. When a channel is not hit, the normalized score for that channel is set to 0.

[0081] In one specific configuration =0.5 =0.3 =0.2, this is the default configuration used when no weight is specified by the user. Vector search assigns higher weights to leverage semantically similar expressions for matching; BM25 search is used to supplement precise matching of technical terms and numbers; full-text search provides another text matching channel. Users can also adjust the weights of each channel through configuration.

[0082] Candidate fusion results are sorted in descending order based on the comprehensive search score, ensuring that only one fusion record is output for each knowledge unit. Then, a specified number of results are filtered and returned based on a set threshold. The threshold in pure vector retrieval is used to filter semantic matching scores, while the threshold in hybrid retrieval is used to filter comprehensive search scores. These two thresholds are interpreted according to their respective retrieval modes and should not be used interchangeably without specifying the scoring criteria.

[0083] The search interface is POST / api / knowledge / knowledge_source / search. In the request, knowledge_ids specifies the knowledge base scope, query represents the search text, top_k represents the number of results returned, score_threshold represents the filtering threshold, search_mode specifies the search mode, and weights configures the mixed search weights, where vector, bm25, and fulltext correspond to the three channels respectively.

[0084] The search results are returned as a `records` array. Each record includes `title`, `knowledge_id`, `knowledge_name`, `source`, `source_id`, `file_id`, `file_name`, `chunk_id`, `chunk_index`, `chunk_type`, `chunk`, and `score`, which respectively store the title, knowledge base identifier, knowledge base name, resource name, resource identifier, file identifier, file name, slice identifier, slice sequence number, slice type, hit content, and search score, providing data for subsequent reordering, contextual backtracking, and source record analysis.

[0085] This embodiment aligns multiple retrieval channels with the same knowledge unit identifier, first processes the differences in scoring scales within each channel, and then integrates semantic matching and text matching information, so that synonyms and precise matching of professional terms can jointly influence candidate ranking; through ranking, deduplication, and threshold filtering, it reduces duplicate candidates and low-relevance candidates from entering the response stage, thereby improving the problem that a single retrieval method is not adaptable to different query types.

[0086] In this embodiment, after obtaining the knowledge retrieval results, the context query information and candidate water conservancy knowledge units are used as the relevance judgment input, and the BCE-Rerank text re-ranking model is used for secondary ranking. The re-ranking re-evaluates the degree of matching between the context query information and the candidate texts to obtain the ranked target water conservancy knowledge units, so as to further distinguish professional content with similar semantics but different applicable conditions.

[0087] Based on the contextual relationships stored in the target water conservancy knowledge unit, the corresponding contextual water conservancy knowledge unit is read. In the parent-child slicing implementation, the target water conservancy knowledge unit is the target child knowledge slice, and its contextual water conservancy knowledge unit is its parent knowledge slice. Location is determined by the parent knowledge slice identifier; established parent-child relationships are not replaced by identical names or similar scores.

[0088] The target water conservancy knowledge unit is organized with its associated contextual water conservancy knowledge unit to obtain contextual knowledge content. When the target sub-level knowledge slice is already contained in the read parent level knowledge slice, the parent content containing the target sub-level knowledge slice is used to provide the context, avoiding the mechanical re-concatenation of the same text. When multiple hit sub-level knowledge slices belong to the same parent level knowledge slice, their references to the same parent content can be merged.

[0089] The contextual query information and contextual knowledge content are combined into the knowledge response input. The contextual query information provides the current question and, if historical session information exists, includes historical questions and answers; the contextual knowledge content provides the document reference obtained from the water resources knowledge base. The two are kept distinct in the input to avoid confusing historical response text with the document content retrieved in this search.

[0090] The language model generates knowledge response information based on the input information. In a question-and-answer session involving a specific clause, the target sub-level knowledge slice is used to locate the relevant clause, while the parent knowledge slice can supplement the scope of application, preconditions, and related explanations, enabling the language model to organize the response within the complete context. The generated result is associated with the title and resource identifier of the document used.

[0091] After completing the response, the user query information is saved as a "user" role, and the knowledge response information is saved as an "ai" role, along with the corresponding time. Knowledge retrieval results and cited document information are stored in EXTEND_JSON, and the message is associated with the target session record via RECORD_ID. Subsequently, the UPDATED_AT of the session record is updated so that the session list reflects the most recent activity time.

[0092] The updated historical session data is used for subsequent continuous queries. When a user initiates a question-and-answer session again, the most recent complete question-and-answer round is selected again according to the aforementioned historical session information extraction method, instead of repeatedly accumulating all previously constructed knowledge-response input information into the next round of input.

[0093] This embodiment rearranges and selects target water conservancy knowledge units that are more relevant to the context query information, and supplements their document context according to the established context relationship, so that the local hit content can participate in the response generation together with the applicable conditions; by associating and saving the question, response and document source of this round, it not only provides historical information for subsequent continuous question and answer, but also provides a basis for querying the source of the response, reducing the impact of isolated use of fragments and loss of session information.

[0094] In this embodiment, after the user completes the slice preview or edits an existing slice, they submit the slice editing information via POST / api / knowledge / knowledge_source / fast_submit_document. The chunks array in the request records the slice operations to be performed. Each item includes id, action, chunk_content, and type, where action includes add, update, and delete, representing addition, modification, and deletion, respectively.

[0095] Each operation retrieves the required fields according to its type. When adding a new element, existing slice identifiers do not need to be submitted; the system will assign an identifier to the new water conservancy knowledge unit, but the slice content must be submitted. When modifying an element, existing slice identifiers and the modified content must be submitted. When deleting an element, the slice identifier to be deleted must be submitted, but the content to be deleted is not required. The `type` parameter distinguishes between Text and Table. Therefore, field extraction is performed according to the actual operation, and deletion operations do not require unnecessary content.

[0096] Based on the operation markers, the changed data of each slice is organized into a slice differential operation set. A slice differential operation set can contain only add operations, or it can contain modify, delete operations, or a combination of multiple operations. The system processes each actual operation in the set one by one; operation categories that do not appear are not executed in their corresponding branches.

[0097] When performing a new operation, the newly added water conservancy knowledge unit is saved, the new content is vectorized, the generated vector and the newly assigned knowledge unit identifier are written into the vector database, and a corresponding text retrieval index is established.

[0098] When performing a modification operation, the original water conservancy knowledge unit is located based on the slice identifier, the modified content is saved, the vectors corresponding to the old content are deleted, a new vector is generated for the modified content and written to the vector database, and the corresponding text search index is made to point to the modified content. Unmodified knowledge units and their existing vectors remain unchanged.

[0099] When performing a deletion operation, the corresponding knowledge unit record and vector record are deleted based on the slice identifier, and their text retrieval indexes are removed. For context-related records referencing the deleted knowledge unit, the corresponding associations are simultaneously cleaned up so that subsequent searches or context backtracking no longer access the deleted object.

[0100] For edits involving parent-child slices, update the corresponding contextual records according to the confirmed slice content and hierarchical relationships after the edit. The content of the parent knowledge slice and the child knowledge slice should be consistent; if the edit affects both simultaneously, the corresponding objects should be included in this change processing. It is not permissible to modify only the child content while continuing to generate responses with inconsistent parent content. This update applies to the objects affected by the edit and does not require rebuilding the entire document.

[0101] The actual knowledge unit change results and index change results obtained from each operation are summarized to update the corresponding knowledge units, contextual relationships, and retrieval indexes. When only deletion is performed, the vectorization of newly added or modified content is not performed; when only addition is performed, non-existent deletion results are not accessed. This avoids mutual exclusion branches referencing data that has not yet been generated.

[0102] Let M be the total number of document slices, and Δ be the number of slices that changed. Slice-level differential processing reduces the number of slices that need to be reprocessed from a total of O(M) to an incremental O(Δ). This expression is used to illustrate the vectorization processing scale per slice number; actual runtime is also affected by factors such as changed slice length, model execution time, and database writes. Deletion operations do not require re-vectorization of the text.

[0103] Knowledge updates can also be triggered by scheduled data collection. The system continuously captures new content from the official platforms of the Ministry of Water Resources and local water affairs through scheduled tasks. After cleaning and deduplication, the content enters a queue for review and is incrementally added to the database after multi-level manual review and confirmation. For existing policies and standards, their validity status is checked regularly, and abolished or invalid resources are marked, disabled, or removed.

[0104] Document disabling and physical deletion are handled differently. Disabling retains the document record but stops its participation in knowledge-based question-and-answer retrieval, suitable for temporarily removed or reviewed resources; deletion removes the corresponding record and index. Subsequent searches are constrained by the document's enabled status to prevent disabled documents from continuing to enter the response context through existing indexes.

[0105] This embodiment organizes the slice differential operation set according to operation tags, so that adding, modifying and deleting perform corresponding data and index processing respectively, avoiding full re-slicing and vectorization caused by local changes; by synchronously maintaining contextual relationships and document validity status, it reduces the situation where invalid references, inconsistent content or obsolete knowledge continue to participate in retrieval after updates, thus reducing computational overhead while maintaining the availability and timeliness of knowledge services.

[0106] In this embodiment, the system sets up a service interface table SERVICE_API and a service subscription table SERVICE_APPLY to store the available search services and their subscription requests, respectively. External business platforms submit api_id, api_name, and remark via POST / api / service / api / subscribe, specifying the requested interface, interface name, and request description, thus forming an interface subscription request record.

[0107] After reviewing an API subscription application, the administrator associates the review result with the subscription record. For approved applications, an available API access token and retrieval permissions are configured to create API authorization information. The API access token can be in the form of an API Key and carried through Bearer Token authentication. When an application is in an unapproved state, retrieval permissions are not granted simply because an application record has been created.

[0108] Upon receiving an external knowledge retrieval request, the access token to be verified is extracted from the Authorization request header and matched against the token and subscription status in the interface authorization information to obtain the interface authentication result. Only after successful authentication will the corresponding knowledge retrieval be parsed and executed; if authentication fails, protected knowledge content will be refused to be returned.

[0109] The external retrieval interface can be set to POST / api / knowledge / knowledge_chunks_query / retrieval. The request data includes query and top_k, representing the external query information and the expected number of results, respectively. Within the authorized scope, the system calls the internal retrieval service to obtain the external knowledge retrieval results. The multi-path retrieval and fusion processing of the internal service follows the aforementioned multi-path retrieval and weighted fusion process.

[0110] Scores from external knowledge retrieval results are mapped to a 0-1 range according to interface conventions, and result field transformations are performed. The records array in the standard retrieval response data contains content, score, title, and metadata, representing the hit content, output score, document title, and metadata, respectively. Metadata can include source, chunk_id, and knowledge_name, which are used by external business platforms to display the source or associate it with subsequent processing.

[0111] Scores are standardized to a range of 0 to 1 to eliminate differences in numerical ranges. This ensures that the interface receiver reads the scores according to the agreed-upon method, without automatically interpreting them as a probability of a correct answer, nor presuming that the same score has completely identical relevance across different queries. The thresholds used by external applications should correspond to the scoring and normalization methods employed by the interface.

[0112] External business platforms can be application platforms such as Dify. After configuring the platform's search address and API Key, the system will use Authorization: Bearer.<api_key> The API is invoked in a specific way. For example, if the query is "hydrological monitoring station network deployment principles" and top_k is 5, the internal retrieval service returns relevant water conservancy knowledge content, and then converts the results into a records array with text, score, title, and source information for external applications. When integrating with a specific platform, the request parameters and response fields are adapted according to its interface conventions.

[0113] The system uses a 200 status code when the API returns successfully, a 403 status code when permissions are insufficient, a 422 status code when parameter validation fails, and a 500 status code when an internal processing exception occurs. The system records subscription status, approval process, and call details, allowing for a direct correlation between authorization activation and actual usage.

[0114] In addition to passive retrieval, it can also interface with hydrological monitoring, flood control command, engineering management, and equipment operation and maintenance platforms via standardized APIs. When an external business event triggers a corresponding scenario, the business linkage adaptation function invokes the knowledge retrieval service and pushes the matching knowledge content to the corresponding platform. The business linkage reuses the retrieval and authorization mechanisms without bypassing access control of knowledge resources.

[0115] This embodiment enables external queries to be executed within the authorized scope by associating subscription status, access tokens, and retrieval permissions; by converting internal results into unified response fields and score ranges, it reduces the burden on external business platforms to understand the internal data structure and retains knowledge source information, thereby achieving controlled output and cross-system reuse of water conservancy knowledge retrieval capabilities.

[0116] This embodiment provides an intelligent knowledge management system for the water conservancy industry, including a knowledge unit generation module, a knowledge base construction module, a fusion retrieval module, a knowledge response management module, and a differential update module. Each module can be implemented by a program executed by a server, and its specific data processing procedures adopt the methods described in the aforementioned embodiments.

[0117] The knowledge unit generation module receives water conservancy knowledge resources and segmentation configuration information, performs content recognition, cleaning, semantic annotation, and segmentation processing, and outputs water conservancy knowledge units and their source information to the knowledge base construction module. The knowledge base construction module receives water conservancy knowledge units, establishes corresponding search indexes, establishes contextual relationships based on the positional relationship of water conservancy knowledge units in corresponding water conservancy knowledge resources, and manages knowledge base metadata and optional target knowledge graph data.

[0118] The fusion retrieval module receives user query information, constructs contextual query information based on the user query information, retrieves the contextual query information through multiple retrieval indexes formed by the knowledge base construction module, obtains candidate results, performs alignment, scoring processing and fusion, and outputs the knowledge retrieval results. The knowledge response management module reads the knowledge retrieval results and contextual relationships, determines the contextual knowledge content, combines the contextual query information and contextual knowledge content into knowledge response input information, calls the language model to generate knowledge response information, and saves the association between user query information, knowledge retrieval results and knowledge response information.

[0119] The differential update module receives resource change information or slice editing information, determines the affected water conservancy knowledge units and their processing types, and writes the updated content and index back to the water conservancy knowledge base. These modules transmit data through knowledge unit identifiers, resource identifiers, and session identifiers, enabling content processing, retrieval, response, and updates to locate the same data object.

[0120] The system adopts a layered architecture consisting of a data layer, a model layer, a capability layer, and an application layer. The data layer uses DM8 to store session records, entity configurations, and knowledge base metadata; PostgreSQL and pgvector to store document slice vectors and keyword vectors; Neo4j to store graph data; and Redis to store session cache and hotspot data. Different storage components undertake corresponding storage tasks according to data types and maintain associations through identifiers.

[0121] The model layer is configured with ChatGLM4, BCE-Embedding, and BCE-Rerank, responsible for language generation, feature vector generation, and relevance reordering, respectively. The capability layer provides document processing, graph extraction, large model agents, and knowledge-based question answering capabilities. The application layer provides entry points for knowledge base management, document processing, entity definition, graph generation, graph visualization, graph statistics, document-based question answering, and graph-based question answering, and can connect to business applications such as voice question answering and flood prediction. Flood prediction is presented here as an application scenario using knowledge services; no additional flood prediction algorithms are added based on this, unless otherwise specified.

[0122] In one deployment instance, the server is developed using Python 3.10, with FastAPI 0.106.0 providing the interface. SQLAlchemy handles database access, PyJWT 2.8.0 handles JWT authentication, Loguru handles logging, and Nginx 1.24.0 acts as a reverse proxy and service entry point. The frontend uses Vue 3 3.2.44, Vite 4.5.1, and ant-design-vue 3.2.14 to build the pages. The software and versions mentioned above are used to illustrate a deployable environment and do not constitute a necessary limitation on the module collaboration method.

[0123] The model server can be configured with a 12-core CPU, 32GB of RAM, and at least 48GB of dedicated video memory; the database server can be configured with a 12-core CPU, 32GB of RAM, and 2TB of storage; and the application server can be configured with a 12-core CPU, 16GB of RAM, and 2TB of storage. Users access the system through a browser, preferably Chrome, and the page can be adapted to a 1920×1080 resolution. Requests pass through the firewall to Nginx, which then proxies them to the front-end page or back-end interface. The back-end service accesses the model server and data storage server according to the task.

[0124] The system also features access control, employing the RBAC model to configure role permissions based on job position, department, and business function. Data is managed according to public, internal, and confidential categories, with different roles possessing different viewing, searching, downloading, and editing permissions. User authentication uses the JWT mechanism, and external interface tokens are managed according to the aforementioned interface subscription and authentication process. When dealing with confidential data, access should be granted only under deployment and access conditions that meet the confidentiality requirements; role-based permission configuration alone cannot be used to assume that all confidentiality requirements are met.

[0125] During resource access and retrieval, permission checks are performed to ensure that users and external applications can only access content within their authorized scope. Log entries include request path, request method, request IP address, operating system, browser, response status code, operator, and operation time. Request and response bodies can also be recorded for issue tracing. When sensitive content or authentication credentials are involved, the scope of log entries should be consistent with access control requirements to prevent logs from becoming an additional source of data leakage.

[0126] The knowledge application statistics function collects user behaviors such as searching, browsing, downloading, and saving, and generates statistical analysis reports to understand the usage of knowledge resources and industry training needs. The statistical results are used to assist in knowledge base maintenance and are not directly equivalent to the criteria for judging the correctness of knowledge content, nor do they replace the manual maintenance process with an automated learning algorithm that is not specifically described.

[0127] The system establishes a continuously running knowledge management process through scheduled data collection, manual review, differential updates, document activation control, access management, and usage statistics. Data collection and update tasks handle changes in knowledge resources, while retrieval and response tasks utilize currently available knowledge. Access control and logging functions permeate the entire access process, enabling different functions to operate collaboratively around the same knowledge base.

[0128] This embodiment enables document content, retrieval index, contextual relationships, and response records to form a consistent processing chain through identifier-based data transfer between modules for knowledge unit generation, knowledge base construction, fusion retrieval, knowledge response management, and differential update. By deploying in a layered manner, storage, vector computation, reordering, and language generation tasks are assigned to corresponding components for execution, and combined with update review and access control, it supports the continuous maintenance, controlled retrieval, and reuse of water conservancy knowledge for internal and external applications.

[0129] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

Claims

1. An intelligent knowledge management method for the water conservancy industry, characterized in that, The method includes: Obtain water conservancy knowledge resources and corresponding segmentation configuration information; perform content processing and segmentation processing on the water conservancy knowledge resources according to the segmentation configuration information to obtain water conservancy knowledge units. Based on the water conservancy knowledge units, a retrieval index corresponding to multiple retrieval methods is established, along with the contextual relationships between the water conservancy knowledge units, to obtain a water conservancy knowledge base. The contextual relationships are established based on the positional relationships of the water conservancy knowledge units in the corresponding water conservancy knowledge resources, and are used to represent the correspondence between the water conservancy knowledge units and other water conservancy knowledge units that can supplement the context of the water conservancy knowledge units. Obtain user query information, construct context query information based on the user query information, retrieve the context query information based on multiple retrieval indexes to obtain multiple candidate retrieval results, and fuse the multiple candidate retrieval results to obtain knowledge retrieval results; The contextual knowledge content is determined based on the knowledge retrieval results and the contextual association relationship. The contextual query information and the contextual knowledge content are combined to obtain the knowledge response input information. The knowledge response input information is input into the language model to obtain the knowledge response information. The user query information, the knowledge retrieval results and the knowledge response information are associated and managed. When the water conservancy knowledge resources change, the affected water conservancy knowledge units are determined based on the change information of the water conservancy knowledge resources, and the affected water conservancy knowledge units and their corresponding retrieval indexes are differentially updated to obtain the updated water conservancy knowledge base.

2. The intelligent knowledge management method for the water conservancy industry according to claim 1, characterized in that, The process of acquiring water conservancy knowledge resources and corresponding segmentation configuration information, and then performing content processing and segmentation processing on the water conservancy knowledge resources based on the segmentation configuration information to obtain water conservancy knowledge units includes: Original water conservancy knowledge documents with different data formats and content carriers are obtained, and the original water conservancy knowledge documents are parsed and their content is identified to obtain the original water conservancy knowledge content. The original water conservancy knowledge content is subjected to duplicate content identification and data cleaning to obtain candidate water conservancy knowledge content; Based on water conservancy terminology, the candidate water conservancy knowledge content is semantically annotated and formatted to obtain standardized water conservancy knowledge content. Obtain the segmentation configuration information corresponding to the standardized water conservancy knowledge content, and segment the standardized water conservancy knowledge content according to the segmentation configuration information to obtain the water conservancy knowledge unit.

3. The intelligent knowledge management method for the water conservancy industry according to claim 2, characterized in that, The step of segmenting the standardized water conservancy knowledge content according to the segmentation configuration information to obtain the water conservancy knowledge unit includes: The parent-child level segmentation rules, maximum slice length, and overlap region length are extracted from the segmentation configuration information to obtain the target segmentation parameters; The title and chapter structure of the standardized water conservancy knowledge content are parsed according to the parent-child segmentation rules in the target segmentation parameters to obtain document hierarchy information; Based on the document hierarchy information, the standardized water conservancy knowledge content is divided into chapter-level segments to obtain parent-level knowledge slices; Within each parent knowledge slice, sliding segmentation is performed based on the maximum slice length and the overlap area length to obtain child knowledge slices; Based on the source location of each child knowledge slice, a parent-child association relationship is established between the child knowledge slice and its corresponding parent knowledge slice to obtain the water conservancy knowledge unit. The child knowledge slice is used for knowledge retrieval, and the parent knowledge slice is used to determine the contextual knowledge content.

4. The intelligent knowledge management method for the water conservancy industry according to claim 1, characterized in that, The process involves establishing retrieval indexes corresponding to multiple retrieval methods based on the water conservancy knowledge units, as well as establishing contextual relationships between the water conservancy knowledge units, to obtain a water conservancy knowledge base, including: Obtain the entity categories, entity attributes, and entity relationships configured by the user to obtain knowledge entity structure information; Based on the knowledge entity structure information, an entity extraction instruction is constructed. The entity extraction instruction and the water conservancy knowledge unit are input into the language model to obtain candidate entity nodes and candidate entity relationships. Based on the knowledge entity structure information, the candidate entity nodes and the candidate entity relationships are subjected to entity category legality verification, entity attribute integrity verification, and relationship end-to-end category matching verification to obtain the verified entity relationship data. The verified entity relationship data is then merged with entities of the same type and name and deduplicated to obtain the target knowledge graph data. Based on the positional relationship of the water conservancy knowledge units in the corresponding water conservancy knowledge resources, the contextual association relationship between the water conservancy knowledge units is established to obtain knowledge association data; The water conservancy knowledge units are vectorized and indexed by text respectively to obtain semantic retrieval index and text retrieval index; The water conservancy knowledge units, the target knowledge graph data, the knowledge association data, the semantic retrieval index, and the text retrieval index are associated and stored to obtain the water conservancy knowledge base.

5. The intelligent knowledge management method for the water conservancy industry according to claim 1, characterized in that, The process involves obtaining user query information, constructing context query information based on the user query information, retrieving the context query information based on multiple retrieval indexes to obtain multiple candidate search results, and fusing the multiple candidate search results to obtain knowledge retrieval results, including: Obtain the user query information and its corresponding session identifier, and query the session record based on the session identifier; When a session record corresponding to the session identifier is found, the found session record is identified as the target session record; when no session record corresponding to the session identifier is found, a session record corresponding to the session identifier is created to obtain the target session record. Based on the target session record, extract the complete question-and-answer rounds within the preset window from the session message history data to obtain historical session information; The historical session information and the user query information are combined in chronological order to obtain the context query information; The context query information is retrieved based on multiple retrieval indexes, and the multiple candidate retrieval results are merged to obtain the knowledge retrieval result.

6. The intelligent knowledge management method for the water conservancy industry according to claim 5, characterized in that, The multiple retrieval indexes include semantic retrieval indexes and text retrieval indexes; the retrieval of the context query information based on the multiple retrieval indexes, and the fusion of the multiple candidate retrieval results to obtain the knowledge retrieval result, includes: The context query information is vectorized to obtain the query feature vector; Based on the query feature vector and the semantic retrieval index, a semantic retrieval of the water conservancy knowledge unit is performed to obtain a first candidate retrieval result containing the first candidate water conservancy knowledge unit and its semantic retrieval score; Based on the context query information and the text retrieval index, a text retrieval of the water conservancy knowledge unit is performed to obtain a second candidate retrieval result containing the second candidate water conservancy knowledge unit and its text retrieval score; Align the first candidate search result and the second candidate search result according to the water conservancy knowledge unit identifier to obtain the candidate fusion result; The semantic retrieval score and text retrieval score in the candidate fusion results are normalized respectively to obtain the normalized retrieval score; The normalized search scores corresponding to the same water conservancy knowledge unit are weighted and fused according to the preset search weights to obtain the comprehensive search score. The candidate fusion results are sorted, deduplicated, and threshold-filtered based on the comprehensive retrieval score to obtain the knowledge retrieval results.

7. The intelligent knowledge management method for the water conservancy industry according to claim 6, characterized in that, The process of determining contextual knowledge content based on the knowledge retrieval results and the contextual association, combining the contextual query information and the contextual knowledge content to obtain knowledge response input information, inputting the knowledge response input information into a language model to obtain knowledge response information, and managing the association between the user query information, the knowledge retrieval results, and the knowledge response information includes: The knowledge retrieval results are reordered based on relevance to obtain the target water conservancy knowledge unit; Based on the contextual association, determine the contextual water conservancy knowledge unit associated with the target water conservancy knowledge unit; The target water conservancy knowledge unit and the context water conservancy knowledge unit are combined to obtain the context knowledge content; The context query information and the context knowledge content are combined to obtain the knowledge response input information; The knowledge response input information is input into the language model to obtain the knowledge response information; The user query information, the knowledge retrieval results, and the knowledge response information are associated and stored in the session message history data corresponding to the target session record to obtain the updated session message history data.

8. The intelligent knowledge management method for the water conservancy industry according to claim 1, characterized in that, When changes occur in the water resources knowledge resources, the affected water resources knowledge units are determined based on the change information of the water resources knowledge resources. The affected water resources knowledge units and their corresponding retrieval indexes are then differentially updated to obtain an updated water resources knowledge base, including: Obtain slice editing information for the water conservancy knowledge resource, extract operation markers from the slice editing information, and extract the slice identifier and / or slice content required for the corresponding operation based on the operation markers to obtain slice change data; Based on the operation marker, the slice change data is divided into at least one of the following: new operation data, modification operation data, and deletion operation data, to obtain a slice differential operation set; Based on the slice difference operation set, perform corresponding add, modify or delete operations on the water conservancy knowledge units in the water conservancy knowledge base to obtain the knowledge unit change results. Based on the knowledge unit change results, the newly added or modified water conservancy knowledge units are vectorized and text indexed, and the corresponding search indexes of the deleted water conservancy knowledge units are deleted to obtain the index change results. Based on the changes to the knowledge units and the indexes, the water conservancy knowledge units, contextual relationships, and retrieval indexes in the water conservancy knowledge base are updated synchronously to obtain the updated water conservancy knowledge base.

9. The intelligent knowledge management method for the water conservancy industry according to claim 1, characterized in that, Also includes: Obtain an interface subscription application sent by an external business platform. When the interface subscription application is approved, generate an interface access token associated with the external business platform and its retrieval permissions, and obtain interface authorization information. Receive an external knowledge retrieval request sent by the external business platform, and extract the access token to be verified from the external knowledge retrieval request; The access token to be verified is matched with the interface authorization information to obtain the interface authentication result; When the interface authentication result is successful, external query information is extracted from the external knowledge retrieval request, and the external query information is retrieved based on the water conservancy knowledge base to obtain the external knowledge retrieval result; The search scores in the external knowledge retrieval results are mapped to a preset numerical range, and the external knowledge retrieval results are converted according to the interface field rules corresponding to the external business platform to obtain standard search response data. The standard search response data is sent to the external business platform.

10. An intelligent knowledge management system for the water conservancy industry, characterized in that, include: The knowledge unit generation module is used to acquire water conservancy knowledge resources and segmentation configuration information corresponding to the water conservancy knowledge resources, and to perform content processing and segmentation processing on the water conservancy knowledge resources according to the segmentation configuration information to obtain water conservancy knowledge units. The knowledge base construction module is used to establish retrieval indexes corresponding to multiple retrieval methods and contextual relationships between the water conservancy knowledge units based on the water conservancy knowledge units, thereby obtaining a water conservancy knowledge base; wherein, the contextual relationships are established according to the positional relationship of the water conservancy knowledge units in the corresponding water conservancy knowledge resources, and are used to represent the correspondence between the water conservancy knowledge units and other water conservancy knowledge units that can supplement the context of the water conservancy knowledge units. The fusion retrieval module is used to obtain user query information, construct context query information based on the user query information, retrieve the context query information based on multiple retrieval indexes to obtain multiple candidate retrieval results, and fuse the multiple candidate retrieval results to obtain knowledge retrieval results; The knowledge response management module is used to determine the contextual knowledge content based on the knowledge retrieval results and the contextual association, combine the contextual query information and the contextual knowledge content to obtain knowledge response input information, input the knowledge response input information into the language model to obtain knowledge response information, and perform association management of the user query information, the knowledge retrieval results and the knowledge response information; The differential update module is used to determine the affected water conservancy knowledge units based on the change information of the water conservancy knowledge resources when the water conservancy knowledge resources change, and to perform differential updates on the affected water conservancy knowledge units and their corresponding retrieval indexes to obtain the updated water conservancy knowledge base.