Method for generating knowledge base, method for generating product requirement document, and electronic device
Patent Information
- Application Number
- CN202610838027.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-10
- Publication Date
- 2026-10-20
AI Technical Summary
但是,现有技术中,由于无结构化关系,因此,通过需要通过纯人工方式维护知识库(产品经理或技术负责人手动编写产品知识库,定期人工更新),AI(ArtificialIntelligence,人工智能)技术无法有效利用,即使借助于AI技术,也需要依赖人工进行知识输入,使得知识库的维护成本很高
通过本申请实施例,可以在由用户输入用于生成知识库的生成指令文本,以及目标领域名称,另外,还可以指定关联的目标代码仓库和/或所需关注的目标模块标识。之后,具体的Agent可以获取所述目标代码仓库和/或目标模块关联的多个目标应用的全量代码文件,并按照代码文件的层级组织结构,对代码文件进行多层次扫描,以获取通过自然语言文本表达的代码上下文信息。另外,还可以根据所述生成指令文本以及预置的提示文本模板,组装生成提示文本。之后,可以以模块为单位将所述提示文本以及所述代码上下文信息分批提交给生成式语言模型执行逆向解析,以生成对应的知识库。其中,具体的提示文本中的指令可以包括以下各项中的一项或多项:识别目标应用涉及的实体对象及其属性、关系、状态流转,提取业务规则及其代码引用位置,梳理接口清单,标注数据流向。最后,还可以感知所述目标代码仓库和/或所需关注的目标模块的代码更新事件,并根据代码更新情况对所述知识库进行自动更新。也就是说,通过预先对代码文件进行多层次扫描,生成了代码上下文信息,使得后续可以通过AI技术实现从代码到知识库的自动生成,并且,在代码发生变更时,还可以触发知识库中具体知识内容的同步更新,使得具体的知识库成为“活知识库”,保持知识库与线上实际运行代码的同步。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application relates to the field of content generation technology, and in particular to methods and electronic devices for generating knowledge bases and product requirement documents. Background Technology
[0002] In the product management and iteration process of software systems, the writing of product requirement documents is frequently involved, followed by code development based on these documents. For example, developing a functional module might involve multiple pages, state transitions, exception handling, etc. Alternatively, a specific function might require collaboration from design, development, and testing teams. Furthermore, during complex feature iterations, specific iterations might affect multiple existing modules or involve cross-team collaboration (e.g., payment, order, and user center integration). In all these situations, product managers and other personnel may need to write product requirement documents. Of course, not all scenarios require product requirement documents. For example, simpler code iterations may not require them. However, even with simple iterations, after multiple iterations, the original product requirement document can become inconsistent with the actual code running online. At this point, if new requirements arise and a new product requirement document needs to be written with reference to the original product requirement document, the original product requirement document is outdated and cannot reflect the actual online code operation. Furthermore, a seemingly simple requirement in a complex system may involve changes to multiple systems, requiring repeated communication with multiple technical engineers to confirm the scope of impact, which usually takes several days. Therefore, a large amount of rework and confirmation is required in the technical solution phase.
[0003] To address the above situation, a feasible solution is to build a knowledge base where all product change information is synchronized. This knowledge base represents the current state of the technology, and product requirement documents can be written by simply referring to it. However, in existing technologies, due to the lack of structured relationships, the knowledge base needs to be maintained manually (product managers or technical leads manually write the product knowledge base and update it periodically). AI (Artificial Intelligence) technology cannot be effectively utilized, and even with the help of AI, manual knowledge input is still required, making the maintenance cost of the knowledge base very high. Summary of the Invention
[0004] This application provides methods and electronic devices for generating knowledge bases and product requirement documents, which can automatically generate knowledge bases from code using AI technology and maintain consistency with online running code.
[0005] This application provides the following solution: A method for generating a knowledge base includes: Upon receiving a user's request to create a knowledge base, determine the user's input of the generation instruction text, the target domain name, and the specified target code repository and / or the identifier of the target module to be of interest; Obtain the full code files of the target code repository and / or multiple target applications associated with the target module, and perform multi-level scanning of the code files according to their hierarchical organization structure to obtain code context information expressed through natural language text. Based on the generated instruction text and the preset prompt text template, the prompt text is assembled and generated. The prompt text and the code context information are submitted to the generative language model in batches by module for reverse parsing to generate the corresponding knowledge base. The instructions in the prompt text include one or more of the following: identifying the entity objects involved in the target application and their attributes, relationships, and state transitions; extracting business rules and their code reference locations; sorting out the interface list; and marking the data flow. The system detects code update events of the target code repository and / or the target modules to be monitored, and automatically updates the knowledge base based on the code update information.
[0006] The code context information includes some or all of the information from the following layers: The responsibilities and core module division information of multiple applications in the application layer; The class inheritance relationship, strategy pattern chain, and enumeration definition of multiple modules in the module layer; The interface layer exposes the interface signature, data transmission object structure, and parameter information to the outside world; The database table structure, field meanings, and index design information in the data layer; The process layer reconstructs the business processing flow through call chain analysis; The dependency layer identifies upstream and downstream application dependencies, message listeners, and scheduled tasks.
[0007] This also includes: A multi-dimensional index structure is established for the generated knowledge base to support indexing by entity name, by interface path, by business rule, by code reference, or full-text semantic indexing.
[0008] This also includes: The generative language model labels the knowledge that it has not inferred and provides an option to manually supplement the knowledge content so that the corresponding knowledge can be supplemented manually.
[0009] The option to manually supplement knowledge content is also used to receive tacit knowledge content supplemented manually.
[0010] The instructions in the prompt text also include: three-view structure definition information, which includes an entity view, a business rule view, and an interface view, so that the entity view describes the entity objects involved in the target application and their attributes, relationships, and state transitions; the business rule view describes the business rules and their code reference locations; and the interface view describes the interface list and data flow.
[0011] The system displays the prompt text template and provides editing options so that the knowledge base can be generated after the prompt text template is edited.
[0012] The step of obtaining code update events for the target code repository and / or the target modules to be monitored, and automatically updating the knowledge base based on the code update information, includes: Receive code update notifications for the target code repository and / or the target modules to be monitored, and obtain the changed code content and the corresponding code context information; Generate knowledge base update instructions and assemble them into prompt text by combining them with the preset prompt text template, so that the generative language model can be used to perform reverse parsing on the code context information corresponding to the changed code content; The reverse parsing results are compared with the current knowledge base, and the current knowledge base is updated based on the comparison results.
[0013] This also includes: In the process of using the knowledge base to generate product requirement documents, review product requirement documents submitted by users, or answer user questions, the discrepancies between the knowledge base and business understanding are identified and corrected.
[0014] The process of identifying and correcting discrepancies between the knowledge base and business understanding includes: During the review of user-submitted product requirement documents using the knowledge base, it is determined that the user-submitted product requirement documents contain business rules or domain knowledge that are not present in the knowledge base, so that the corresponding business rules or domain knowledge can be added to the knowledge base.
[0015] The process of identifying and correcting discrepancies between the knowledge base and business understanding includes: During the review of user-submitted product requirement documents using the knowledge base, if the business rules or domain knowledge described in the user-submitted product requirement documents are inconsistent with the records in the knowledge base, the code library is searched to obtain the actual implementation status of the code in the system. By comparing the business rules or domain knowledge described in the user-submitted product requirement documents, the knowledge base records, and the actual implementation status of the code, the source of the conflict is determined, and corresponding determination result prompt information is provided.
[0016] The process of identifying and correcting discrepancies between the knowledge base and business understanding includes: During the process of answering user questions using the knowledge base, if the user points out that the answer is incorrect, the answer is corrected and the source of the error is analyzed. If there are errors in the domain knowledge in the knowledge base, prompts are provided regarding the original knowledge, the suggested corrected knowledge, and the suggested updated knowledge base entries.
[0017] This also includes: During the process of users expanding the business rule information in the knowledge base, the knowledge in the knowledge base is confirmed or corrected.
[0018] A method for generating product requirements documents, comprising: Receive product requirement documents from users when product logic changes are needed and generate requirement information. The intent parsing result is obtained by performing natural language understanding on the generated requirement information, wherein the intent parsing result includes the target system, change type, and core logic; Retrieve target information that matches the generated requirement information from a pre-established knowledge base. The target information includes one or more of the following: key entity information, business rule information referencing relevant fields, interfaces involving relevant calculations and their upstream and downstream information, and extended information extending upstream and downstream along the interface dependency chain; the knowledge base is generated according to the method described in any of the foregoing items. Based on the intent parsing results and the target information retrieved from the knowledge base, an interface-level change impact analysis result is generated; Based on the results of the change impact analysis, a corresponding product requirement document is generated so that corresponding product logic changes can be made based on the product requirement document.
[0019] The interface-level change impact analysis results include one or more of the following: New entity fields, business rules, and / or interfaces that need to be added; The interface that needs to be modified, its current status, the status after the change, the caller, and the scope of impact; Affected downstream systems, including cross-system impacts traced through interface dependency chains; Risks associated with cross-team coordination, compatibility, and data migration.
[0020] This also includes: By comparing the data fields involved in the document generation requirements with the fields of existing entities in the knowledge base, the fields, logic, or dependencies necessary for the implementation of the document generation requirements, as well as those not explicitly expressed in the document generation requirements, are identified to deduce the user's implicit requirements. In order to combine the intent parsing results with the implicit requirements, a product requirement document is generated.
[0021] The interface-level change impact analysis results also include: Suggestions for handling exceptions derived from implicit requirements.
[0022] A computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of any of the preceding methods.
[0023] An electronic device, comprising: One or more processors; and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of any of the preceding methods.
[0024] A computer program product includes a computer program / computer executable instructions that, when executed by a processor in an electronic device, implement the steps of any of the preceding methods.
[0025] According to the specific embodiments provided in this application, the following technical effects are disclosed: Through the embodiments of this application, a user can input generation instruction text for generating a knowledge base, along with the target domain name. Additionally, the user can specify the associated target code repository and / or the identifier of the target module to be monitored. Then, a specific agent can obtain the full code files of multiple target applications associated with the target code repository and / or target module, and perform multi-level scanning of the code files according to their hierarchical organization to obtain code context information expressed in natural language text. Furthermore, it can assemble and generate prompt text based on the generation instruction text and a pre-set prompt text template. Then, the prompt text and the code context information can be submitted in batches to a generative language model for reverse engineering, module by module, to generate the corresponding knowledge base. The instructions in the specific prompt text may include one or more of the following: identifying entity objects involved in the target application and their attributes, relationships, and state transitions; extracting business rules and their code reference locations; compiling an interface list; and marking data flow. Finally, it can also detect code update events of the target code repository and / or the target module to be monitored, and automatically update the knowledge base according to the code update status. In other words, by performing multi-level scanning of code files in advance, code context information is generated, which enables the automatic generation of knowledge bases from code through AI technology. Furthermore, when the code changes, it can trigger the synchronous update of specific knowledge content in the knowledge base, making the specific knowledge base a "living knowledge base" and keeping the knowledge base synchronized with the actual online code.
[0026] In addition to triggering incremental updates through code releases to ensure consistency between the knowledge base and the online code, multiple calibration trigger points can be set during the process of using the knowledge base to support user needs. These points correct cognitive biases by utilizing the knowledge base to support processes such as product requirement document writing, review, and Q&A. These two channels address code-level synchronization and business-level accuracy respectively, making the knowledge base more dynamic.
[0027] Of course, any product implementing this application does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a schematic diagram of the system architecture provided in the embodiments of this application; Figure 2 This is a schematic diagram of the iterative closed loop provided in the embodiments of this application; Figure 3 This is a flowchart of the knowledge base generation method provided in the embodiments of this application; Figure 4 This is a schematic diagram of the knowledge base update process provided in an embodiment of this application; Figure 5 This is a schematic diagram of the conflict determination process provided in the embodiments of this application; Figure 6 This is a flowchart of a method for generating product requirements documents provided in an embodiment of this application; Figure 7 This is a flowchart illustrating the analysis of implicit requirements provided in an embodiment of this application; Figure 8 This is a schematic diagram of the electronic device provided in the embodiments of this application. Detailed Implementation
[0030] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0031] In the embodiments of this application, such as Figure 1 As shown, AI technology can be used to automatically extract domain knowledge from code repositories and generate structured knowledge bases. Furthermore, a link can be established between the knowledge base and specific code repositories, driving incremental updates through code release events to ensure the knowledge base remains consistent with the online code. This makes the knowledge base a "living knowledge base," which can then be used to automate the generation of product requirement documents, review manually written product requirement documents, answer user questions, and so on.
[0032] It should be noted that, as described in the background section, existing technologies cannot effectively utilize AI to assist in the generation of knowledge bases. This is mainly because ordinary knowledge bases cannot clarify the relationships between business processes at the business layer or the relationships between modules at the code layer. Even if these relationships are rigidly clarified, the maintenance cost is very high. Therefore, in this embodiment, in order to automatically generate a knowledge base using AI technology, the specific dependent code repositories and / or modules can first be identified. Then, the full code files of multiple target applications associated with the target code repository and / or target module can be obtained. Following the hierarchical organization of the code files, the code files are scanned at multiple levels to obtain code context information expressed in natural language text. This context information can include information at multiple levels, such as relationships between applications in the system, relationships between modules, business rules, interfaces, data, processes, and dependencies. This information can be described in natural language. Furthermore, specific prompt text can be assembled based on the user's command text and a pre-set prompt text template. Then, by inputting the prompt text into a generative language model (a type of AI model), the generative language model can reverse-engineer the user's command text and this code context information to generate the corresponding knowledge base. The specific prompt text may include instructions such as identifying the entity objects involved in the target application and their attributes, relationships, and state transitions, extracting business rules and their code reference locations, compiling an interface list, marking data flow, etc., so that the generated knowledge base can include the above information.
[0033] The model's reasoning results are stored in a structured knowledge base (which, in practice, may include entity views, rule views, interface views, etc.). This knowledge base serves as a first-level cache for the model. When supporting specific user needs (including writing, reviewing, and answering product requirement documents), this knowledge base can be retrieved first, ensuring that the search results directly match verified knowledge without requiring re-reasoning each time. The specific codebase serves as a second-level cache for the model, allowing for on-demand retrieval. For example, after retrieving the knowledge base from the first-level cache, information such as enumerations, interfaces, database tables, and linking mechanisms can be obtained by searching the codebase.
[0034] Furthermore, after generating the knowledge base, a dual-channel "keeping it fresh" mechanism can be provided. First, there's the system channel. Because the knowledge base is linked to the specific code repository, events such as code updates in the linked repository can be monitored. By using code release webhooks to detect code updates, the updated code content can be retrieved, and the corresponding knowledge base can be updated accordingly. This ensures that the knowledge content in the knowledge base remains consistent with the code actually running online. Subsequently, when writing and reviewing product requirement documents or answering user questions based on this knowledge base, the likelihood of needing rework for product requirement documents is greatly reduced because the knowledge content in the knowledge base is consistent with the actual online code state. The accuracy of reviews and answers is also guaranteed.
[0035] Furthermore, in the preferred implementation, during the process of using the knowledge base generated in the above manner to support intelligent requirements engineering (including writing product requirement documents, reviewing user-submitted product requirement documents, or answering user questions), the discrepancy between the knowledge base and business cognition can be identified, and the knowledge content in the knowledge base can be calibrated or corrected. Specifically, business cognition can originate from the content described in the user-submitted product requirement documents, or from errors pointed out by users in the AI's responses. By incorporating the above calibration process, such as... Figure 2 As shown, a continuous iterative closed loop can be formed: "code → knowledge base → product requirement document generation / review / answering user questions → knowledge base calibration". In addition, combined with automatic knowledge base updates driven by code updates, it is possible to achieve code change-driven knowledge base updates → knowledge base supporting requirements engineering → knowledge base calibration during requirements engineering process → the calibrated knowledge base better supporting the next requirements engineering, thus forming a continuous improvement cycle, making the knowledge base "more accurate the more it is used".
[0036] The specific implementation schemes provided in the embodiments of this application will be described in detail below.
[0037] Example 1 First, in this first embodiment, a method for creating a knowledge base is provided, see [link to previous document]. Figure 3 The method may specifically include: S301: After receiving a user's request to create a knowledge base, determine the user's input of the generation instruction text, the target domain name, and the specified target code repository and / or the identifier of the target module to be concerned.
[0038] In this embodiment, a system for automatically generating structured knowledge bases using AI technology (referred to as a "knowledge base generation system") can be provided. Users of this system can be product managers (primarily responsible for proposing product requirements) or technical and development personnel (primarily responsible for the technical implementation of the product) within a software system. Specifically, the knowledge base generation system can provide users with an interface. This interface may include entry points or operation options for specifying target subdomain names, a list of associated application code repositories, and modules of interest. Additionally, interactive controls for inputting generation command text can be provided to users through dialog windows or similar means. The specific target subdomain name can be named by the user based on the function of the knowledge base to be generated. For example, if the knowledge base to be generated is related to billing or resource networking, the name can reflect the corresponding function, facilitating knowledge base retrieval based on the name.
[0039] After entering the subdomain name, users can also specify the associated target code repository and / or the identifier of the target module they wish to focus on. In other words, in this embodiment, the specific knowledge base can be generated based on the associated code. Therefore, before generating the specific knowledge base, the user can specify the specific associated target code repository and / or the identifier of the target module they wish to focus on. In practice, a list of candidate code repositories, a list of modules, etc., can be provided to facilitate user selection. The specific code repository can store the code of various applications currently running in the software system. The specific knowledge base is generated by selecting this actual online running code.
[0040] After selecting the target code repository and / or the target module of interest, the scope of information sources for generating the knowledge base is essentially defined. Additionally, users can input specific generation command text, which expresses their specific generation needs. Specifically, users can input the above command text in the chat dialog box with the AI, for example, "Generate a knowledge base for C-end billing and settlement, focusing on describing [specific aspect]," and so on.
[0041] S302: Obtain the full code files of the target code repository and / or multiple target applications associated with the target module, and perform multi-level scanning of the code files according to the hierarchical organization structure of the code files to obtain code context information expressed through natural language text.
[0042] After the user specifies the target code repository and / or target module, the full code files of the application contained therein can be obtained through the code repository API (Application Programming Interface). Specifically, the code files can be obtained through an agent (intelligent agent, or intelligent component, etc.) with code repository permissions. Then, after obtaining the full code files, the agent can perform multi-level scanning of the code repository, organizing it into a code context according to the hierarchical structure of modules, packages, classes, etc. This code context can be expressed in natural language for subsequent knowledge base generation.
[0043] It's important to note that the basic unit of a code repository is the application, the next layer is the functional module, and the next layer is the actual code. Different applications or modules may have interrelationships, involving related data, interfaces, and so on. For example, the billing and customer service applications might collaborate to complete tasks: Suppose the customer service system receives a user complaint ticket, confirms compensation, and generates a compensation slip. This slip then flows to the billing application, which calls the settlement application to generate a settlement bill. In this process of processing the user's claim, the customer service application first processes and confirms the complaint. After confirming the need for compensation, it generates a compensation slip. This is the internal workflow of the customer service application, involving data fields such as the user's complaint number and user ID. Furthermore, the above process involves call chains. For instance, after a ticket is generated, it's sent to the customer service application for assessment. If the assessment is successful, the customer service application generates a compensation slip. Simultaneously, it uses a capability of the billing application, requiring the billing application to create a settlement bill. This involves API calls to the billing application to enable communication between different applications.
[0044] To facilitate the subsequent generation of a knowledge base using AI, this embodiment first performs a multi-level scan of the code file to generate code context information expressed in natural language. This process can be implemented using a generative language model. Specifically, code information can be input into the model using prompt text, and specific instructions, i.e., the tasks that the model needs to complete, can be described in the prompt text, enabling the model to complete the aforementioned multi-level scan according to the instructions.
[0045] In specific implementations, the generated code context may include some or all of the information from the following layers: The responsibilities and core module division information of multiple applications in the application layer; The class inheritance relationship, strategy pattern chain, and enumeration definition of multiple modules in the module layer; The interface layer exposes the interface signature, data transmission object structure, and parameter information to the outside world; The database table structure, field meanings, and index design information in the data layer; The process layer reconstructs the business processing flow through call chain analysis; The dependency layer identifies upstream and downstream application dependencies, message listeners, and scheduled tasks.
[0046] S303: Based on the generated instruction text and the preset prompt text template, assemble and generate prompt text, and submit the prompt text and the code context information to the generative language model in batches by module to perform reverse parsing in order to generate the corresponding knowledge base; the instructions in the prompt text include one or more of the following: identify the entity objects involved in the target application and their attributes, relationships, and state transitions, extract business rules and their code reference locations, sort out the interface list, and mark the data flow direction.
[0047] In addition to performing multi-level scanning of code files to generate code context information, it can also assemble and generate prompt text based on received user instruction text and pre-set prompt text templates. The specific user instruction text refers to the specific generation requirements input by the user through chat dialog boxes, etc., while the prompt text template can be pre-provided by the system. The prompt text assembled from the user instruction text and the prompt text template is used to guide the language generation model in generating the knowledge base.
[0048] The prompt text template can include instructions to guide the language generation model on how to generate the knowledge base. Specifically, it can include one or more of the following: identifying the entity objects involved in the target application and their attributes, relationships, and state transitions; extracting business rules and their code reference locations; compiling an interface list; and marking data flow. In other words, to avoid users describing these instructions in the prompt message every time they generate a knowledge base, the prompt text template can be provided. This template can also exist in the form of a Skill. A Skill can be a special Prompt or a pre-packaged high-level Prompt. The core difference is that a Prompt is a "one-time instruction," while a Skill is a "reusable package of professional skills." For example, a Prompt is a request made by the user each time they interact with the AI, while a Skill packages and solidifies these requests, rules, and workflows, enabling the AI to handle specific tasks stably and professionally. The various instructions and execution steps for generating the knowledge base described in the prompt text template can exist in the form of a Skill. By providing such prompt text templates and assembling user-inputted instruction text into them, specific prompt text can be generated and fed into a generative language model for knowledge base generation.
[0049] In practical implementation, the system can provide a basic version of the prompt text template. In addition, this prompt text template can also be displayed to the user, and editing options can be provided. In this way, the user can edit the prompt text template and then assemble the prompt text, thereby guiding the generation of the knowledge base.
[0050] In addition, the specific prompt text may also include: a three-view structure definition, which can include: an entity view, a business rule view, and an interface view. The entity view describes the entity objects involved in the target application, their attributes, relationships, and state transitions; the business rule view describes business rules and their code reference locations; and the interface view describes the interface list and data flow. In other words, three different types of knowledge content in the knowledge base can be expressed through different views. Furthermore, depending on the user's role, only certain views can be selected to be displayed to the user, avoiding presenting too much redundant information.
[0051] For example, the same knowledge base can be presented with differentiated views based on user roles through different System Prompts, as shown in Table 1: Table 1
[0052] Furthermore, through the methods described above, generative language models perform semantic analysis and abstraction of code, not only extracting interface signatures but also inferring business entities, business rules, and inter-domain relationships, outputting a three-view structured knowledge base from a product perspective. This three-view format enables AI to accurately determine the type, validity status, and relationships of each piece of knowledge.
[0053] As can be seen, Prompt-driven generative language models can be used to perform multi-level semantic analysis (application / module / interface / data / process / dependency, etc.) on codebases, automatically generating a structured software product knowledge base containing information such as entities, rules, and interfaces. Each piece of knowledge can be associated with information such as code reference locations, facilitating subsequent knowledge updates based on code updates.
[0054] S304: Sensing code update events of the target code repository and / or the target modules to be monitored, and automatically updating the knowledge base according to the code update situation.
[0055] After the knowledge base is generated, because it is associated with the target code repository and / or the target modules to be monitored, it can also detect code update events in the target code repository and / or the target modules to be monitored, and automatically update the knowledge base accordingly. In this way, the knowledge content in the knowledge base can be kept consistent with the code actually running online, making the knowledge base a "living knowledge base" rather than static and requiring no manual maintenance.
[0056] Specifically, when automatically updating the knowledge base, the system can receive code update notifications from the target code repository and / or the target modules it is interested in, and obtain the changed code content and corresponding code context information. Then, a knowledge base update instruction can be generated and assembled into a prompt text using the aforementioned pre-set prompt text template. This prompt text is then used to perform reverse parsing of the code context information corresponding to the changed code content through a generative language model. Finally, the reverse parsing result can be compared with the current knowledge base, and the current knowledge base can be updated based on the comparison result.
[0057] After generating the knowledge base, a multi-dimensional index structure can be established to facilitate subsequent access to the knowledge base, thus supporting multi-dimensional indexing. For example, this could include indexing by entity name (supporting "querying rules related to freight bills"), by interface path (supporting "querying which downstream interfaces were called"), by business rule (supporting "querying the logic of continued weight billing," etc.), by code reference (supporting "which business rules are associated with a certain class," etc.), or full-text semantic indexing (supporting fuzzy natural language queries).
[0058] In one specific implementation, the above update process can be as follows: Figure 4 As shown, it can specifically include: Step 1: When a piece of code is updated, the code publishing system can send a notification message that the code has been successfully published by triggering a Webhook (a method of adding or changing the behavior of a webpage through a custom callback function). Step 2: After receiving the above notification message, the knowledge base incremental update module in the system can obtain the list of changed files, and also obtain the commit message (the text description generated every time the system saves code changes (i.e., makes a commit), which can be used to describe what changes were made, the reasons for the changes, etc.). Step 3: Only obtain the code content of the changed file, not the full code content; Step 4: Reverse analyze the code content of the modified file (you can use the same Prompt template as the full analysis); Step 5: Compare the parsing results with the existing knowledge base; Step 6: If new entities, rules, interfaces, etc. are extracted from the modified file code, the operation of adding entities, rules, and interfaces to the knowledge base can be performed, and the creation version number can be marked at the same time; Step 7: If reverse analysis of the modified file code reveals that an entity, rule, or interface has been deleted, the corresponding entity, rule, or interface can be marked as obsolete in the knowledge base (without actually deleting it), and the reason for obsolescence can also be marked. Step 8: If reverse analysis of the change file code reveals that the change file code has modified the information of a certain entity, rule, or interface, then the information of the corresponding entity, rule, or interface can be modified in the knowledge base, and the reason for the change can also be marked. Step 9: Rebuild the affected index entries; Step 10: Alternatively, a change summary can be generated to notify subscribers.
[0059] Furthermore, since the instructions in the prompt text include tasks that the generative language model needs to complete, such as identifying entity objects and their attributes, relationships, and state transitions involved in the target application, extracting business rules and their code reference locations, compiling an interface list, and annotating data flow, the generative language model can perceive which tasks have been completed and which have not. In practical implementation, to make the knowledge base more complete, knowledge not inferred by the generative language model can be annotated, and options for manually supplementing the knowledge can be provided. For example, if the generative language model finds that it cannot extract business rules and their code reference locations, a corresponding prompt can be given to allow for manual supplementation of the relevant knowledge.
[0060] Furthermore, the aforementioned option for manually supplementing knowledge content can also be used to receive tacit knowledge content supplemented manually. This can include knowledge that cannot be directly reflected in the code due to architectural decisions, historical context, business constraints, cross-domain collaboration, etc. For example, in some scenarios, it might be desirable to create two work orders of the same type simultaneously. However, the system may not support the simultaneous existence of two work orders of the same type. This is due to architectural decisions, and the information cannot be directly obtained from the code. Therefore, it can be supplemented manually. After completing the supplementation of various knowledge contents, a formal knowledge base can be formed. In this way, when supporting user needs through the knowledge base, in addition to significantly reducing retrieval latency and computational power consumption (compared to directly retrieving code) by using the knowledge base as a first-level cache, the knowledge base can also record tacit knowledge not present in the code (manually supplemented architectural decisions, business constraints, etc.), thus improving the quality and consistency of responses.
[0061] After generating the aforementioned knowledge base, it can be used to generate product requirement documents, review user-submitted product requirement documents, answer user questions, and so on. During this process, discrepancies between the knowledge base and business understanding can be identified and corrected (such as misunderstandings of business intent, missing tacit knowledge, or inaccurate rule descriptions). In other words, the generated knowledge base may contain some biases, which can be discovered and corrected during actual use, ensuring the knowledge base becomes increasingly accurate with use.
[0062] There are various ways to identify and correct these deviations. For example, during the review of user-submitted product requirement documents using a knowledge base, if there are business rules or domain knowledge described in the submitted documents but not present in the knowledge base, these rules or knowledge can be added to the knowledge base. Specifically, the agent can mark these deviations as knowledge accumulation suggestions and provide recommendations to the user, such as prompting the user: "[A certain business rule] is not recorded in the knowledge base; it is recommended to add it to the rule view of the knowledge base," etc. After the user confirms the content and classification, the agent can automatically write the knowledge into the corresponding view of the knowledge base and record the change log.
[0063] Furthermore, during the review of user-submitted product requirement documents using the knowledge base, if the business rules or domain knowledge described in the submitted product requirement document are inconsistent with the records in the knowledge base, there are two possibilities: the product requirement is incorrect, or the knowledge base is outdated. Therefore, the system can automatically determine the source of the conflict through three-way cross-validation. Specifically, it can first search the code repository to obtain the actual implementation status of the code in the system; then, it can compare the business rules or domain knowledge described in the user-submitted product requirement document, the knowledge base records, and the actual implementation status of the code to determine the source of the conflict and provide corresponding judgment result prompts. For example, this could include... Figure 5 The steps shown are as follows: Step 1: Conflict detected: Product requirement description does not match knowledge base record; Step 2: Search the code repository to obtain the actual implementation status of the current system; Step 3: Perform a three-way comparison between the product requirement description, knowledge base records, and code implementation, and then proceed with further processing based on the comparison results. Specifically, the comparison results can automatically distinguish four conflict situations (outdated knowledge base / incorrect product requirements / multiple deviations / code not synchronized), ensuring the correctness of the calibration direction.
[0064] Case A: If the code implementation equals the product requirement description If the knowledge base records this information, it can be determined that the knowledge base is outdated. That is, the code has been changed, but the knowledge base has not been synchronized. In this case, it can be suggested to update the knowledge base and indicate the reason for the change.
[0065] Scenario B: If code implementation = knowledge base record If so, it can be determined that the product requirements may be incorrect or inconsistent with the current system status. In this case, the product manager can be reminded to verify the requirements in the review report.
[0066] Scenario C: If the three are different, it can be determined that there are multiple deviations and manual intervention is required. In this case, it can be marked as a high-priority item to be confirmed, and the contents of the three parties can be displayed for manual decision-making.
[0067] Case D: If the code is implemented If the knowledge base record equals the product requirement description, it can be determined that the code may have new changes that have not yet been released, or that there are legacy defects (bugs). In this case, it can be marked as pending confirmation to remind people to check the code change history.
[0068] In addition to reviewing product requirement documents submitted by users using the knowledge base, the knowledge base can also be used to answer user questions. During this process, if the user points out that the answer is incorrect, the answer can be corrected, and the source of the error can be analyzed. If there are errors in the domain knowledge in the knowledge base, prompts about the original knowledge, the suggested corrected knowledge, and the suggested updated knowledge base entries can be provided. After the user confirms, the knowledge base can be automatically updated and a change log can be recorded.
[0069] Furthermore, during the process of users expanding the business rule information in the knowledge base, the knowledge in the knowledge base can be confirmed or corrected. For example, confirmed knowledge can be automatically suggested to be added to the knowledge base (supplementing new knowledge), and corrected knowledge can trigger the knowledge base update process (correcting old knowledge).
[0070] It is evident that in utilizing knowledge bases to serve user needs (including product requirement document generation / review / Q&A, etc.), multiple calibration trigger points can be set to correct cognitive biases. This ensures that the knowledge base remains synchronized not only at the code level but also at the business understanding level, making the knowledge base truly "alive." Simultaneously, through continuous accumulation and correction of knowledge via product requirement calibration and Q&A correction, user correction information is not lost. Furthermore, maintenance is integrated into daily R&D processes, requiring no additional maintenance investment. Each calibration update can be recorded with a complete change log.
[0071] In summary, through the embodiments of this application, a user can input generation instruction text for generating a knowledge base, along with the target domain name. Additionally, the user can specify the associated target code repository and / or the identifier of the target module to be monitored. Then, a specific agent can obtain the full code files of multiple target applications associated with the target code repository and / or target module, and perform multi-level scanning of the code files according to their hierarchical organization to obtain code context information expressed in natural language text. Furthermore, prompt text can be generated based on the generation instruction text and a pre-set prompt text template. Then, the prompt text and the code context information can be submitted in batches to a generative language model for reverse engineering, module by module, to generate the corresponding knowledge base. The instructions in the specific prompt text may include one or more of the following: identifying entity objects involved in the target application and their attributes, relationships, and state transitions; extracting business rules and their code reference locations; compiling an interface list; and marking data flow. Finally, the agent can also detect code update events of the target code repository and / or the target module to be monitored, and automatically update the knowledge base based on the code update status. In other words, by performing multi-level scanning of code files in advance, code context information is generated, which enables the automatic generation of knowledge bases from code through AI technology. Furthermore, when the code changes, it can trigger the synchronous update of specific knowledge content in the knowledge base, making the specific knowledge base a "living knowledge base" and keeping the knowledge base synchronized with the actual online code.
[0072] In addition to triggering incremental updates through code releases to ensure consistency between the knowledge base and the online code, multiple calibration trigger points can be set during the process of using the knowledge base to support user needs. These points correct cognitive biases by utilizing the knowledge base to support processes such as product requirement document writing, review, and Q&A. These two channels address code-level synchronization and business-level accuracy respectively, making the knowledge base more dynamic.
[0073] Example 2 The aforementioned Embodiment 1 described the specific generation of a knowledge base and the maintenance of consistency between the knowledge base and code, business understanding, and other related content. Embodiment 2 of this application provides a method for generating product requirement documents, see [link to embodiment]. Figure 6 The method may include: S601: Receive product requirement documents input by users when product logic changes are required, and generate requirement information.
[0074] Specifically, in a given software system, the need to generate product requirement documents typically arises when product logic changes are required. Therefore, this application embodiment primarily addresses the processing of product requirement document generation requirements arising from such product logic changes.
[0075] S602: Obtain intent parsing results by performing natural language understanding on the generated requirement information, wherein the intent parsing results include the target system, change type, and core logic.
[0076] Upon receiving a request, natural language understanding can be used to obtain intent parsing results, including the target system, change type, and core logic. For example, a user-inputted request might be: "Add a rule to the billing system that charges by volumetric weight; when volumetric weight > actual weight, charge by volumetric weight." In this case, the intent recognition result could include: { "target_application (target system)": "Billing and Settlement System", "change_type" (change type): "add_rule" (add rule) "change_description": "New volumetric weight billing rule", "core_logic (core logic)": { "condition": "Volume weight > Actual weight", Action: "Use volumetric weight instead of actual weight for billing" } } In an optional approach, the system can not only parse the user's explicitly stated needs, but also automatically identify fields, logic, or dependencies necessary for fulfilling the needs but not explicitly stated by the user by comparing the data fields related to the needs with the fields of existing entities in the knowledge base. This allows the system to deduce the user's implicit needs, and then combine the intent parsing results with the implicit needs to generate a product requirements document. In one specific implementation, the process of analyzing implicit needs can be as follows: Figure 7 As shown: Step 1: Extract the relevant data fields from the requirements analysis results; Step 2: Find the corresponding entity in the entity knowledge of the knowledge base (e.g., entity view); Step 3: Compare the fields that the requirement depends on with the existing fields of the entity; If the field that the requirement depends on does not exist in the entity, it is marked as an implicit requirement: "Field needs to be added"; If the interface affected by the requirement is called by other systems, the caller is traced back from the interface knowledge in the knowledge base (e.g., interface view) and marked as "requiring coordination with downstream systems"; If the computational logic involved in the requirement depends on other rules, then the dependency chain is found from the rule knowledge in the knowledge base (e.g., rule view) and marked as "related rules need to be modified".
[0077] For example, assuming the user's input includes "billing by volume and weight", the system finds from the knowledge base entity view that the Package entity currently does not have length / width / height fields, and automatically derives three implicit requirements: 1. The package length, width, and height fields need to be added (current entity is missing); 2. A volume-to-weight conversion formula needs to be defined (current rules do not exist); 3. A fallback logic is needed to handle missing volume and weight data (abnormal scenarios).
[0078] By comparing the data fields involved in user requirements with the existing fields in the knowledge base entity view, the system can automatically identify the data fields, calculation logic, and exception handling requirements that are necessary for the fulfillment of the requirements but have not been explicitly stated by the user. This elevates the requirement assessment from "doing what the user says" to "the system proactively filling in the gaps".
[0079] S603: Retrieve target information matching the generated requirement information from a pre-established knowledge base. The target information includes one or more of the following: key entity information, business rule information referencing relevant fields, interfaces involving relevant calculations and their upstream and downstream information, and extended information extending upstream and downstream along the interface dependency chain. The knowledge base is generated according to the method described in the aforementioned embodiment one.
[0080] After determining the user's intent, target information matching the generated requirement information can be retrieved from the knowledge base, specifically including: Keyword matching: Extracting key entities and concepts from requirements; Rule association: Find all business rules that reference related fields; Interface tracing: Locate all interfaces involved in related calculations and their upstream and downstream processes; Dependency diffusion: extending upstream and downstream along the interface dependency chain (such as called_by and depends_on relationships).
[0081] S604: Based on the intent parsing results and the target information retrieved from the knowledge base, generate interface-level change impact analysis results.
[0082] In this step, based on the requirements analysis results and knowledge base retrieval results, the system can automatically generate an interface-level change impact analysis report. For example, it may include: The following need to be added: new entity fields, business rules, interfaces (including input and output parameter definitions), etc. Modifications required: Affected existing interfaces (current status → modified status → callee → scope of impact); Affected downstream systems: Cross-system impacts automatically traced through interface dependency chains; Risk assessment: Risks such as cross-team coordination, compatibility, and data migration are categorized as high / medium / low. Fallback logic suggestion: Exception handling suggestions derived from implicit requirements.
[0083] In summary, based on the interface dependency chain relationship in the knowledge base interface view, it can automatically trace the propagation path of changes along the dependency chain, generate impact analysis results accurate to the interface and field level, automatically identify cross-system impacts, and mark change points that require cross-team coordination, etc.
[0084] S605: Generate a corresponding product requirement document based on the change impact analysis results, so as to make corresponding product logic changes based on the product requirement document.
[0085] After obtaining the change impact analysis results, the system can automatically generate structured product requirement documents or technical specifications (rules), which may include, for example: Background of the requirement (using existing rules from the knowledge base as context) List of entity changes involved (each item is marked with its source: explicit user requirement / implicit requirement derivation / existing information in the knowledge base); List of business rule changes (including code reference locations); List of interface changes (including caller and cross-system flags); Scope of impact on upstream and downstream industries; backup and exception handling; Test point suggestions, etc.
[0086] In this document, every item can be marked with its source to ensure complete traceability. Product managers can then directly review and submit it for technical review.
[0087] In summary, through Embodiment 2 of this application, product requirement documents can be automatically generated based on the knowledge base generated in Embodiment 1. Furthermore, during the generation process, target information matching the generated requirement information can be retrieved from the knowledge base. This target information includes one or more of the following: key entity information, business rule information referencing relevant fields, interfaces involving related calculations and their upstream and downstream information, and extended information extending upstream and downstream along the interface dependency chain. Additionally, interface-level change impact analysis results can be generated based on the intent parsing results and the target information retrieved from the knowledge base. Finally, a corresponding product requirement document is generated based on the change impact analysis results, enabling corresponding product logic changes to be made based on the product requirement document.
[0088] It should be noted that the embodiments of this application may involve the use of user data. In practical applications, user-specific personal data may be used in the scheme described herein within the scope permitted by applicable laws and regulations, provided that it complies with the applicable laws and regulations of the country (e.g., with the user's explicit consent, with the user being properly notified, etc.).
[0089] Corresponding to Embodiment 1, this application also provides an apparatus for generating a knowledge base, which may include: The request receiving unit is used to, upon receiving a user's request to create a knowledge base, determine the user's input generation instruction text, target domain name, and specified target code repository and / or the identifier of the target module to be of interest. The code file acquisition unit is used to acquire the full code files of the target code repository and / or multiple target applications associated with the target module, and to perform multi-level scanning of the code files according to the hierarchical organization structure of the code files in order to obtain code context information expressed through natural language text. The prompt text assembly unit is used to assemble and generate prompt text based on the generated instruction text and the preset prompt text template, and submit the prompt text and the code context information to the generative language model in batches on a module-by-module basis for reverse parsing to generate the corresponding knowledge base; the instructions in the prompt text include one or more of the following: identifying the entity objects involved in the target application and their attributes, relationships, and state transitions, extracting business rules and their code reference locations, sorting out the interface list, and marking the data flow direction; The update unit is used to detect code update events of the target code repository and / or the target modules to be followed, and to automatically update the knowledge base according to the code update situation.
[0090] The code context information includes some or all of the information from the following layers: The responsibilities and core module division information of multiple applications in the application layer; The class inheritance relationship, strategy pattern chain, and enumeration definition of multiple modules in the module layer; The interface layer exposes the interface signature, data transmission object structure, and parameter information to the outside world; The database table structure, field meanings, and index design information in the data layer; The process layer reconstructs the business processing flow through call chain analysis; The dependency layer identifies upstream and downstream application dependencies, message listeners, and scheduled tasks.
[0091] In a specific implementation, the device may further include: The index generation unit is used to establish a multi-dimensional index structure for the generated knowledge base, so as to support indexing by entity name, indexing by interface path, indexing by business rules, indexing by code reference, or full-text semantic indexing.
[0092] The annotation unit is used to annotate the knowledge that the generative language model has not inferred, and provides the option to manually supplement the knowledge content so that the corresponding knowledge can be supplemented manually.
[0093] The option to manually supplement knowledge content is also used to receive tacit knowledge content supplemented manually.
[0094] In addition, the instructions in the prompt text also include: three-view structure definition information, the three views including entity view, business rule view and interface view, so that the entity view describes the entity objects involved in the target application and their attributes, relationships and state transitions, the business rule view describes the business rules and their code reference locations, and the interface view describes the interface list and data flow.
[0095] Furthermore, the device may also include: The prompt text template display unit is used to display the prompt text template and provide editing operation options so that the knowledge base can be generated after the prompt text template is edited.
[0096] The update unit can specifically be used for: Receive code update notifications for the target code repository and / or the target modules to be monitored, and obtain the changed code content and the corresponding code context information; Generate knowledge base update instructions and assemble them into prompt text by combining them with the preset prompt text template, so that the generative language model can be used to perform reverse parsing on the code context information corresponding to the changed code content; The reverse parsing results are compared with the current knowledge base, and the current knowledge base is updated based on the comparison results.
[0097] Additionally, it may include: The perception deviation correction unit is used to identify and correct the deviation between the knowledge base and business perception during the process of generating product requirement documents using the knowledge base, reviewing product requirement documents submitted by users, or answering user questions.
[0098] Specifically, the cognitive bias correction unit can be used for: During the review of user-submitted product requirement documents using the knowledge base, it is determined that the user-submitted product requirement documents contain business rules or domain knowledge that are not present in the knowledge base, so that the corresponding business rules or domain knowledge can be added to the knowledge base.
[0099] Alternatively, the cognitive bias correction unit can be specifically used for: During the review of user-submitted product requirement documents using the knowledge base, if the business rules or domain knowledge described in the user-submitted product requirement documents are inconsistent with the records in the knowledge base, the code library is searched to obtain the actual implementation status of the code in the system. By comparing the business rules or domain knowledge described in the user-submitted product requirement documents, the knowledge base records, and the actual implementation status of the code, the source of the conflict is determined, and corresponding determination result prompt information is provided.
[0100] Alternatively, the cognitive bias correction unit can be specifically used for: During the process of answering user questions using the knowledge base, if the user points out that the answer is incorrect, the answer is corrected and the source of the error is analyzed. If there are errors in the domain knowledge in the knowledge base, prompts are provided regarding the original knowledge, the suggested corrected knowledge, and the suggested updated knowledge base entries.
[0101] Additionally, it may include: The expansion and correction unit is used to confirm or correct the knowledge in the knowledge base during the process of the user expanding the business rule information in the knowledge base.
[0102] Corresponding to Embodiment 2, this application also provides an apparatus for generating product requirement documents, which may include: The requirement receiving unit is used to receive product requirement documents input by users when product logic changes are required, and generate requirement information. The intent parsing result acquisition unit is used to acquire intent parsing results by performing natural language understanding on the generated requirement information, wherein the intent parsing results include the target system, change type, and core logic; A matching unit is used to retrieve target information that matches the generated requirement information from a pre-established knowledge base. The target information includes one or more of the following: key entity information, business rule information referencing relevant fields, interfaces involving relevant calculations and their upstream and downstream information, and extended information extending upstream and downstream along the interface dependency chain. The knowledge base is generated according to the method described in Embodiment 1. The change impact analysis result generation unit is used to generate interface-level change impact analysis results based on the intent parsing results and the target information retrieved from the knowledge base. The product requirement document generation unit is used to generate a corresponding product requirement document based on the change impact analysis results, so as to make corresponding product logic changes based on the product requirement document.
[0103] Specifically, the results of the interface-level change impact analysis may include one or more of the following: New entity fields, business rules, and / or interfaces that need to be added; The interface that needs to be modified, its current status, the status after the change, the caller, and the scope of impact; Affected downstream systems, including cross-system impacts traced through interface dependency chains; Risks associated with cross-team coordination, compatibility, and data migration.
[0104] In a specific implementation, the device may further include: The implicit requirement derivation unit is used to compare the data fields involved in the document generation requirement with the fields of existing entities in the knowledge base to identify the fields, logic, or dependencies that are necessary for the implementation of the document generation requirement, or that are not explicitly expressed in the document generation requirement, so as to deduce the user's implicit requirements. In order to combine the intent parsing result with the implicit requirements, a product requirement document is generated.
[0105] In addition, the interface-level change impact analysis results also include: Suggestions for handling exceptions derived from implicit requirements.
[0106] In addition, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.
[0107] And an electronic device, comprising: One or more processors; and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any of the foregoing method embodiments.
[0108] A computer program product includes a computer program / computer executable instructions that, when executed by a processor in an electronic device, implement the steps of the method described in the foregoing method embodiments.
[0109] in, Figure 8 An exemplary architecture of an electronic device is shown, which may include a processor 810, a video display adapter 811, a disk drive 812, an input / output interface 813, a network interface 814, and a memory 820. The processor 810, video display adapter 811, disk drive 812, input / output interface 813, network interface 814, and memory 820 can communicate with each other via a communication bus 830.
[0110] The processor 810 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solution provided in this application.
[0111] The memory 820 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 820 can store the operating system 821 for controlling the operation of the electronic device 800, and the basic input / output system (BIOS) for controlling the low-level operations of the electronic device 800. Additionally, it can store a web browser 823, a data storage management system 824, and a knowledge base generation and processing system 825, etc. The aforementioned knowledge base generation and processing system 825 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when implementing the technical solution provided in this application through software or firmware, the relevant program code is stored in the memory 820 and executed by the processor 810.
[0112] The input / output interface 813 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.
[0113] Network interface 814 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0114] Bus 830 includes a pathway for transmitting information between various components of the device, such as processor 810, video display adapter 811, disk drive 812, input / output interface 813, network interface 814, and memory 820.
[0115] It should be noted that although the above-described device only shows the processor 810, video display adapter 811, disk drive 812, input / output interface 813, network interface 814, memory 820, bus 830, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.
[0116] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0117] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0118] The foregoing has provided a detailed description of the methods and implementations of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of these embodiments are merely for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for generating a knowledge base, characterized in that, include: Upon receiving a user's request to create a knowledge base, determine the user's input of the generation instruction text, the target domain name, and the specified target code repository and / or the identifier of the target module to be of interest; Obtain the full code files of the target code repository and / or multiple target applications associated with the target module, and perform multi-level scanning of the code files according to their hierarchical organization structure to obtain code context information expressed through natural language text. Based on the generated instruction text and the preset prompt text template, the prompt text is assembled and generated. The prompt text and the code context information are submitted to the generative language model in batches by module for reverse parsing to generate the corresponding knowledge base. The instructions in the prompt text include one or more of the following: identifying the entity objects involved in the target application and their attributes, relationships, and state transitions; extracting business rules and their code reference locations; sorting out the interface list; and marking the data flow. The system detects code update events of the target code repository and / or the target modules to be monitored, and automatically updates the knowledge base based on the code update information.
2. The method according to claim 1, characterized in that, The code context information includes some or all of the information from the following layers: The responsibilities and core module division information of multiple applications in the application layer; The class inheritance relationship, strategy pattern chain, and enumeration definition of multiple modules in the module layer; The interface layer exposes the interface signature, data transmission object structure, and parameter information to the outside world; The database table structure, field meanings, and index design information in the data layer; The process layer reconstructs the business processing flow through call chain analysis; The dependency layer identifies upstream and downstream application dependencies, message listeners, and scheduled tasks.
3. The method according to claim 1, characterized in that, Also includes: A multi-dimensional index structure is established for the generated knowledge base to support indexing by entity name, by interface path, by business rule, by code reference, or full-text semantic indexing.
4. The method according to claim 1, characterized in that, Also includes: The generative language model labels the knowledge that it has not inferred and provides an option to manually supplement the knowledge content so that the corresponding knowledge can be supplemented manually.
5. The method according to claim 4, characterized in that, The option to manually supplement knowledge content is also used to receive tacit knowledge content supplemented manually.
6. The method according to claim 1, characterized in that, The instructions in the prompt text also include: three-view structure definition information, the three views including entity view, business rule view and interface view, so that the entity view describes the entity objects involved in the target application and their attributes, relationships and state transitions, the business rule view describes the business rules and their code reference locations, and the interface view describes the interface list and data flow.
7. The method according to claim 1, characterized in that, The prompt text template is displayed, and editing options are provided so that the knowledge base can be generated after the prompt text template is edited.
8. The method according to claim 1, characterized in that, The step of obtaining code update events for the target code repository and / or the target modules to be monitored, and automatically updating the knowledge base based on the code update information, includes: Receive code update notifications for the target code repository and / or the target modules to be monitored, and obtain the changed code content and the corresponding code context information; Generate knowledge base update instructions and assemble them into prompt text by combining them with the preset prompt text template, so that the generative language model can be used to perform reverse parsing on the code context information corresponding to the changed code content; The reverse parsing results are compared with the current knowledge base, and the current knowledge base is updated based on the comparison results.
9. The method according to claim 1, characterized in that, Also includes: In the process of using the knowledge base to generate product requirement documents, review product requirement documents submitted by users, or answer user questions, the discrepancies between the knowledge base and business understanding are identified and corrected.
10. The method according to claim 9, characterized in that, The process of identifying and correcting discrepancies between the knowledge base and business understanding includes: During the review of user-submitted product requirement documents using the knowledge base, it is determined that the user-submitted product requirement documents contain business rules or domain knowledge that are not present in the knowledge base, so that the corresponding business rules or domain knowledge can be added to the knowledge base.
11. The method according to claim 9, characterized in that, The process of identifying and correcting discrepancies between the knowledge base and business understanding includes: During the review of user-submitted product requirement documents using the knowledge base, if the business rules or domain knowledge described in the user-submitted product requirement documents are inconsistent with the records in the knowledge base, the code library is searched to obtain the actual implementation status of the code in the system. By comparing the business rules or domain knowledge described in the user-submitted product requirement documents, the knowledge base records, and the actual implementation status of the code, the source of the conflict is determined, and corresponding determination result prompt information is provided.
12. The method according to claim 9, characterized in that, The process of identifying and correcting discrepancies between the knowledge base and business understanding includes: During the process of answering user questions using the knowledge base, if the user points out that the answer is incorrect, the answer is corrected and the source of the error is analyzed. If there are errors in the domain knowledge in the knowledge base, prompts are provided regarding the original knowledge, the suggested corrected knowledge, and the suggested updated knowledge base entries.
13. The method according to claim 1, characterized in that, Also includes: During the process of users expanding the business rule information in the knowledge base, the knowledge in the knowledge base is confirmed or corrected.
14. A method for generating product requirements documents, characterized in that, include: Receive product requirement documents from users when product logic changes are needed and generate requirement information. The intent parsing result is obtained by performing natural language understanding on the generated requirement information, wherein the intent parsing result includes the target system, change type, and core logic; The target information matching the generated requirement information is retrieved from a pre-established knowledge base. The target information includes one or more of the following: key entity information, business rule information referencing relevant fields, interfaces involving relevant calculations and their upstream and downstream information, and extended information extending upstream and downstream along the interface dependency chain; the knowledge base is generated by the method according to any one of claims 1 to 13. Based on the intent parsing results and the target information retrieved from the knowledge base, an interface-level change impact analysis result is generated; Based on the results of the change impact analysis, a corresponding product requirement document is generated so that corresponding product logic changes can be made based on the product requirement document.
15. The method according to claim 14, characterized in that, The results of the interface-level change impact analysis include one or more of the following: New entity fields, business rules, and / or interfaces that need to be added; The interface that needs to be modified, its current status, the status after the change, the caller, and the scope of impact; Affected downstream systems, including cross-system impacts traced through interface dependency chains; Risks associated with cross-team coordination, compatibility, and data migration.
16. The method according to claim 14, characterized in that, Also includes: By comparing the data fields involved in the document generation requirements with the fields of existing entities in the knowledge base, the fields, logic, or dependencies necessary for the implementation of the document generation requirements, as well as those not explicitly expressed in the document generation requirements, are identified to deduce the user's implicit requirements. In order to combine the intent parsing results with the implicit requirements, a product requirement document is generated.
17. The method according to claim 16, characterized in that, The interface-level change impact analysis results also include: Suggestions for handling exceptions derived from implicit requirements.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program performs the steps of the method described in any one of claims 1 to 17.
19. An electronic device, characterized in that, include: One or more processors; as well as A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method according to any one of claims 1 to 17.
20. A computer program product comprising a computer program / computer-executable instructions, characterized in that, When the computer program / computer-executable instructions are executed by a processor in an electronic device, they implement the steps of the method according to any one of claims 1 to 17.