Knowledge base construction method, code document generation method and computing equipment

By obtaining project development resources and code bases, and using relational data to build a knowledge base for private domain projects, the accuracy and efficiency of private domain project knowledge base construction is solved, the close connection between code logic and business requirements and the dynamic update of knowledge bases is achieved, and the efficiency of code document generation and problem-solving accuracy are improved.

CN120353440APending Publication Date: 2025-07-22XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510330431.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-19
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

It is difficult for the existing technology to effectively build an exclusive knowledge base for private domain projects, resulting in insufficient accuracy and efficiency of the knowledge base.

Method used

Obtain the project's development resources and code base through computing devices, use relational data to build a knowledge base for private domain projects, including splitting code blocks and functional units, establishing a close connection between code and business needs, increasing dependencies and call relationships, and dynamically updating the knowledge base.

Benefits of technology

It has achieved the accuracy and efficiency improvement of the private domain project knowledge base, can better understand code logic and business needs, and improve the efficiency of code document generation and question answering accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120353440A_ABST
    Figure CN120353440A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a knowledge base construction method and computing equipment, is applied to the technical field of servers, and is used for constructing a knowledge base, particularly an exclusive knowledge base of a private domain project. Specifically, the computing device obtains development resources of the project and a corresponding code library, the development resources indicate files or documents related to the project in the software development process, and the code library comprises source codes of the project. And the computing device corresponds the content of the development resources to the source codes in the code library to obtain relational data, and constructs a knowledge base of the project by using the relational data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of servers, and in particular to a knowledge base construction method, a code document generation method, and a computing device. Background Art

[0002] A knowledge base is a systematic collection of knowledge, usually storing, organizing, and managing knowledge in a preset manner so that the knowledge can be retrieved, shared, and utilized. Currently, a knowledge base often binds to a language model. A computing device can retrieve in the knowledge base according to a question submitted by a user, splice the retrieval result and the question submitted by the user, and construct a prompt to consult the language model to obtain a corresponding answer result for the question. Therefore, how to construct a knowledge base, especially a dedicated knowledge base for a private project, becomes the key. Summary of the Invention

[0003] Embodiments of this application provide a knowledge base construction method and a computing device for constructing a knowledge base and improving the generation efficiency of code documents.

[0004] In a first aspect, embodiments of this application provide a knowledge base construction method applied to a computing device. The computing device can be a server or other electronic devices with computing functions, and embodiments of this application do not specifically limit it. When the computing device is a server, the computing device can be a blade server, a rack server, or a server with other structures, and embodiments of this application do not specifically limit it.

[0005] Specifically, the computing device obtains the development resources of a project and the corresponding code library, where the development resources indicate the files or documents involved in the software development process of the project, and the code library includes the source code of the project. The computing device corresponds the content of the development resources with the source code in the code library to obtain relationship data, and constructs a knowledge base of the project by using the relationship data. Even if the project is a private project, the computing device can obtain the code library and development resources inside the private project, and construct a dedicated code knowledge base for the private project by corresponding the content of the development resources with the source code in the code block. Further, the content of the development resources in the private project corresponds to the source code in the code library, so that the business requirements of software development can be closely linked to the technical implementation, ensuring the effectiveness of the knowledge base.

[0006] In one implementation, the computing device may split the source code according to the syntactic structure to obtain a plurality of code blocks; the plurality of code blocks include function code blocks and / or class code blocks; split the content of the development resources to obtain a plurality of functional units; one functional unit corresponds to one functional point; and establish a correspondence between the plurality of functional units and the plurality of code blocks according to the functional points to form the relationship data. Thus, the computing device can ensure the precise matching of the content of the development resources and the code blocks by splitting the software development code and the development resources according to the syntactic structure and establishing a correspondence according to the functional points, helping the language model to more accurately understand the association between the implementation logic of the code and the internal description of the development resources.

[0007] In another implementation, the computing device may split the annotation information in the source code to obtain a plurality of annotation units; one annotation unit corresponds to one functional point; and based on the plurality of annotation units, establish a correspondence between the plurality of functional units and the plurality of code blocks according to the function to obtain the relationship data. Since there is a lot of key information in the annotation units, these information can further achieve the precise matching of the content of the development resources and the code blocks.

[0008] In yet another implementation, the computing device may obtain the dependency relationships between the plurality of code blocks; the dependency relationships include call relationships between function codes and / or inheritance relationships between class codes; and construct the knowledge base according to the dependency relationships and the relationship data. Thus, the computing device can more accurately understand the semantics of the code by adding the dependency relationships between the code blocks, and thus more accurately construct the knowledge entries in the knowledge base.

[0009] In yet another implementation, the computing device may obtain the call relationships between the variable meanings and the plurality of code blocks; and construct the knowledge base according to the association relationships, the call relationships and the relationship data. Thus, the computing device can further use the call relationships for constructing the association between the submitted questions and the code, so that the computing device can directly retrieve the relevant code from the knowledge base.

[0010] In a specific implementation, if the development resources of the project are documents, the documents include project documents, user documents and / or interface documents, the computing device may split the document content of the documents to obtain a plurality of paragraphs or key sentences; the paragraphs or key sentences can independently convey complete information.

[0011] In yet another specific implementation, the computing device can receive a question submitted by a user; obtain retrieval information corresponding to the question from the knowledge base; construct a prompt word based on the retrieval information; input the prompt word into a language model to obtain a response result corresponding to the question; if the response result meets a preset condition, write the question and the response result into the knowledge base to update the knowledge base. Thus, the computing device can dynamically update the knowledge base based on question-and-answer feedback, further ensuring the comprehensiveness and accuracy of the constructed knowledge base.

[0012] In a second aspect, an embodiment of the present application further provides a code document generation method, which is applied to a computing device. The method includes:

[0013] The computing device receives semantic information submitted by a user; the semantic information is used to obtain a code document of a project; according to the knowledge base of the project and a language model associated with the knowledge base, a code document corresponding to the semantic information is obtained; wherein, the knowledge base is constructed based on relational data, and the relational data is obtained by corresponding the content of development resources in the project with the source code in the corresponding code library, the development resources indicate files or documents involved in the project during the software development process, and the code library includes the source code of the project; the code document includes one or more of a project overview of the project, a functional module description, the code type for implementing the functional module, and the call relationship between codes.

[0014] In yet another implementation, the computing device can receive semantic information submitted by a user; the semantic information is used to obtain a code document of a project; construct a document prompt word according to the knowledge base and the document template; input the document prompt word into a language model to obtain the code document of the project; the code document includes one or more of a project overview of the project, a functional module description, the code type for implementing the functional module, and the call relationship between codes.

[0015] In a third aspect, an embodiment of the present application further provides a knowledge base construction device, which is applied to a computing device. The computing device can be a server or other electronic devices with computing functions, and the embodiments of the present application do not specifically limit this. When the computing device is a server, the computing device can be a blade server, a rack server, or a server with other structures, and the embodiments of the present application do not specifically limit this.

[0016] Specifically, the device includes:

[0017] An obtaining unit, configured to obtain development resources of a project and a corresponding code library, wherein the development resources indicate files or documents involved in the project during the software development process, and the code library includes the source code of the project;

[0018] A building block for corresponding the content of development resources with the source code in the code library to obtain relationship data, and constructing a knowledge base for the project by using the relationship data.

[0019] Fourthly, an embodiment of the present application provides a computing device, including:

[0020] A memory for storing programs;

[0021] A processor for executing the programs stored in the memory. When the programs stored in the memory are executed, the processor is used to execute the method according to any one of the first aspect or the second aspect.

[0022] Fifthly, the present application provides a computer storage medium for storing a computer program. When the computer program is executed, it is used to implement the method provided by any one of the implementation manners in the first aspect or the second aspect of the present application.

[0023] Sixthly, the present application provides a computer program product containing instructions. When it runs on at least one computing device, it enables at least one computing device to implement the method provided by any one of the implementation manners in the first aspect or the second aspect of the present application.

[0024] Any of the above-provided knowledge base construction methods or code document generation methods, corresponding computing devices, computer-readable storage media, computer program products, etc. are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods, which will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application;

[0026] Figure 2 A flowchart of a knowledge base construction method provided by an embodiment of the present application;

[0027] Figure 3 A schematic diagram of the structure of a knowledge graph provided by an embodiment of the present application;

[0028] Figure 4 A flowchart of another knowledge base construction method provided by an embodiment of the present application;

[0029] Figure 5 A flowchart of another knowledge base construction method provided by an embodiment of the present application;

[0030] Figure 6A A schematic diagram of the structure of another knowledge graph provided by an embodiment of the present application;

[0031] Figure 6BThis is a schematic diagram of another knowledge graph structure provided by an embodiment of the present application;

[0032] Figure 7 This is a flowchart of another method for constructing a knowledge base provided by an embodiment of the present application;

[0033] Figure 8 This is a flowchart of the usage of a knowledge base binding a language model provided by an embodiment of the present application;

[0034] Figure 9 This is a flowchart of the usage of another knowledge base binding a language model provided by an embodiment of the present application;

[0035] Figure 10 This is a schematic diagram of the structure of a knowledge base construction device provided by an embodiment of the present application;

[0036] Figure 11 This is a schematic diagram of the structure of a server provided by an embodiment of the present application. Detailed implementation manners

[0037] The technical solutions in the embodiments of the present application will be clearly and completely described below. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0038] To facilitate the understanding of those skilled in the art of the embodiments of the present application, the technical terms involved in the embodiments of the present application will be introduced first.

[0039] Knowledge base: It is a systematic collection of knowledge that stores, organizes, and manages information in a certain form. For example, the knowledge base stores, organizes, and manages information in the form of vectors. The information in the knowledge base can be retrieved, shared, and utilized to solve specific problems, support decision-making, and automate processes, etc. In the embodiments of the present application, the information in the knowledge base includes the business requirements of the project and the corresponding codes, etc.

[0040] Code library: It includes the source code written for the project. Source code refers to a series of instructions and statements written by developers using programming languages, and these instructions and statements describe the functions, logics, and structures of the project. The functions and methods in the source code are code blocks for completing specific tasks, with clear inputs and outputs. The source code organizes the code through classes and uses variables to operate data, etc. In the embodiments of the present application, the code library can specifically be a private code library.

[0041] A private code repository refers to code written by an enterprise or an individual for specific needs or product development. For example, the source code in a private code repository can be the source code of a software project corresponding to a private domain e-commerce platform, that is, an e-commerce platform that an enterprise hopes to develop for e-commerce sales through private domain traffic. These codes are not open to the public and are only for internal use.

[0042] Language model: Also known as a large language model (LLM), it is an artificial intelligence model that uses deep learning algorithms. Through a large amount of data training, it learns the patterns and structures of language, enabling it to understand and generate natural language text. In the embodiments of this application, a computing device can bind a knowledge base and a language model. After receiving the semantic information submitted by a user, the computing device can obtain retrieval results (i.e., retrieval information) related to the semantic information from the knowledge base, construct a prompt word based on the retrieval results, and consult the language model to obtain a response result corresponding to the semantic information. In the embodiments of this application, the language model can be, for example, DeepSeek, or it can be Wenyan Yixin or Tongyi Qianwen, etc. The embodiments of this application do not specifically limit it.

[0043] The following provides a detailed and complete description of a knowledge base construction method provided by the embodiments of this application with reference to the accompanying drawings.

[0044] First, the application scenario of the knowledge base construction method provided by the embodiments of this application is introduced.

[0045] Exemplarily, Figure 1 FIG. is a schematic diagram of an application scenario provided by the embodiments of this application. This application scenario is a question-and-answer application scenario. This scenario specifically involves a computing device 101 and a terminal device 102. The terminal device 102 and the computing device 101 can be interconnected through a network, such as through a communication network including at least one switch.

[0046] The terminal device 102 is the front-end interface for a user to interact with the computing device 101. In the embodiments of this application, the terminal device 102 can be an electronic device deployed with a question-and-answer interface, such as a mobile phone, a laptop computer, a wearable electronic device (such as a smart watch), a tablet computer, a server, a computer, etc. A user can input a question through the question-and-answer interface. For example, as Figure 1 shown, it shows that the question input by the user is "Develop coupons for a certain e-commerce platform".

[0047] The terminal device 102 sends the semantic information input by the user to the computing device 101 for interaction with the computing device 101.

[0048] Among them, the computing device 101 refers to an electronic device with computing capabilities. For example, the computing device 101 can be a server or other electronic devices, which is not specifically limited in the embodiments of the present application. When the computing device 101 is a server, the computing device 101 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and large databases and artificial intelligence platforms. When the above server is a server cluster or a distributed system composed of multiple physical servers, the multiple physical servers can form a blockchain, and each physical server is a node on the blockchain. The physical type of the server area can be a rack server, a high-density server, a GPU server, a tower server, or a blade server, a whole cabinet server, etc., which is not specifically limited in the present application.

[0049] In the embodiments of the present application, the computing device 101 includes a knowledge base construction module, and the computing device 101 constructs a knowledge base in the knowledge base construction module. Specifically, the computing device 101 loads the code library of the project and the corresponding development resources. Among them, the code library includes the source code of the project. The development resources are documents or files involved in the software development process of the project. The computing device 101 can correspond the content of the development resources with the source code of the code library to obtain relationship data. The computing device can construct a knowledge base of the project based on the relationship data.

[0050] Exemplarily, if the project is an e-commerce project, among them, the source code of the code library includes function code blocks (also called function code segments, used to implement function functions) 1 and 2. Function code block 1 is a user login verification function, and function code block 2 is a user information acquisition function. The development resources of the project are user documents, which are used to describe the user login function. The content of the user document includes information 1 for describing user login and information 2 for describing user information acquisition. The computing device 101 can correspond information 1 with function code block 1 and information 2 with function code block 2 to obtain relationship data. The computing device 101 can construct a knowledge base of the e-commerce project based on the relationship data.

[0051] It should be noted that in the embodiments of the present application, the computing device 101 can construct a knowledge base after receiving the user input semantic information, or can directly construct a knowledge base after the computing device 101 is started, which is not specifically limited in the embodiments of the present application.

[0052] In an embodiment of the present application, the computing device 101 may further include a retrieval module, a prompt word construction module, and a model module. Specifically, after the computing device 101 receives a question input by the user, in the retrieval module, based on a pre-constructed knowledge base, retrieval results related to semantic information are obtained. The retrieval module sends the retrieval results to the prompt word module. The prompt word module may construct prompt words based on the retrieval results. The prompt word module sends the prompt words to the model module. The model module inputs the prompt words into a pre-bound language model to obtain a reply result of semantic information.

[0053] For example, if the semantic information input by the user is "How to implement the user login function". After the retrieval module receives the question input by the user, based on the pre-constructed knowledge base, retrieval results related to the question are obtained. For example, the retrieval results are "Information 1 and function code block 1". The retrieval module sends the retrieval results to the prompt word construction module. The prompt word construction module concatenates with the user question to construct prompt words, and the obtained prompt words are "How to implement the user login function? Users can perform login verification through the username and password". The prompt word module sends the prompt words to the model module, and the model module obtains a reply result based on the prompt words: "The user login function can be verified through the username and password, and the relevant code is Code A".

[0054] It should be noted that Code A is an implementation code for implementing user login verification through the username and password.

[0055] It should be noted that in the embodiment of the present application, the computing device 101 and the terminal device 102 are taken as examples belonging to different devices for illustrative purposes. In an actual application scenario, the terminal device 102 may also be located in the same computing device as the computing device 101. At this time, the terminal device 102 and the computing device 101 are respectively the display module and the computing module of the same computing device, and the embodiment of the present application does not specifically limit this.

[0056] It should be noted that the above application scenarios and the hardware structure of the computing device are only schematic representations. In actual use, those skilled in the art can also make adjustments according to needs. For example, the computing device 101 communicates with multiple terminal devices at the same time to obtain questions sent by multiple terminal devices, and provides corresponding language models for multiple terminal devices respectively to perform reply operations. The embodiment of the present application does not specifically limit this.

[0057] The following will be described in detail with reference to the drawings the knowledge base construction method provided by the embodiment of the present application.

[0058] Att Figure 2 FIG. is a flowchart of a knowledge base construction method provided by an embodiment of the present application. This method takes Application Scenario 1 as an example, and the method includes the following content:

[0059] S10. The computing device 101 obtains the development resources of the project and the corresponding code libraries.

[0060] The development resources of the project refer to the documents or files involved in the software process of the project.

[0061] Among them, the software development process of the project involves the entire process of project development, including the project establishment stage, the project development stage, the project conclusion stage, and the project usage stage, etc.

[0062] The development resources of the project are the resources generated and used by the project team during the development process, and are crucial for understanding the business logic, technical implementation, and development process of the project. In the embodiments of the present application, the development resources of the project include project requirements, project design, and project technology, etc.

[0063] Specifically, the development resources of the project include but are not limited to the following: project establishment documents, technical documents, project documents, user documents, interface documents, test cases, and submission records, etc.

[0064] Among them, the project documents are the information written by the project team that details aspects such as project requirements, requirements analysis, and design specifications, etc. They are the basis for the project team to understand and implement the project and belong to the internal core knowledge assets. In one example, the project documents may include but are not limited to: requirements documents, design documents, and technical documents. Among them, the requirements documents are used to describe project requirements, the design documents are used to describe project design, and the technical documents are used to describe project technology.

[0065] The user documents are used to help the project team clarify user requirements and usage scenarios, and ensure that the development direction meets user expectations. In one example, the user documents include but are not limited to user manuals and operation guides. Among them, the user manual refers to the document that helps users understand and use the product, and the operation guide refers to the document that provides user operation steps and examples.

[0066] The interface documents define the interaction methods between different modules or systems in the project, and are an important basis for the project team to conduct system integration and interface development within the project, directly related to the functional implementation and system stability of the project.

[0067] The test cases refer to the test plans and steps written by the project team according to project requirements and designs for verifying the system functions and performance, and are the key internal tools for ensuring project quality. In one example, the test cases include but are not limited to: performance test cases and functional test cases. Among them, the performance test cases are the test plans and steps for verifying system performance, and the functional test cases are the test plans and steps for verifying system functions.

[0068] A commit record refers to the operation history of a project team in a code management tool, including records such as code commits, modifications, merges, etc., which reflects the progress of project development and team collaboration. In one example, the commit record includes but is not limited to code commit records and change logs.

[0069] It can be understood that the development resources of a project include the requirements analysis involved in the entire software development process of the project. Therefore, using the development resources of the project to develop a knowledge base helps to build a comprehensive, systematic and useful knowledge base.

[0070] The code repository is a core component in the software development process of a project, storing the source code of the project. Exemplarily, for example, if the project is an e-commerce project, its code blocks may include Code Block 1 and Code Block 2. Among them, Code Block 1 is the source code of the knowledge management module, and Code Block 2 indicates the source code of the order processing module. It can be understood that the code repository includes the code implementation of the project requirements analysis.

[0071] It should be noted that in the embodiments of this application, the code repository may also include but is not limited to configuration files, script files, document files, dependencies, etc. Among them, the document files in the code repository refer to the documents directly related to the source code. The configuration file is used to configure the project running environment, build process, etc. The script file includes script files for tasks such as automated building, deployment, and testing. The embodiments of this application do not specifically limit.

[0072] It can be understood that the development resources of a project and the content in the corresponding code repository cover multiple stages from requirements analysis to code implementation. Therefore, using the development resources of the project and the corresponding code repository can provide comprehensive knowledge content for the knowledge base.

[0073] In actual use, the computing device 101 can load the development resources of the project through a document loader, including but not limited to development resources such as project documents, user documents, and / or interface documents. For example, the document loader includes a cloud storage loader, a database loader, etc. The computing device 101 can also automatically load the code repository corresponding to the project through a code block loading tool, such as a Git loading tool, a GitHub Actions loading tool, etc.

[0074] In addition, the computing device 101 can also load the development resources and code repository of the project through an automated script. For example, the computing device 101 writes a script to automatically copy the development resources of the project from a specified path or network location, or pulls the development resources through an interface from a document management system, etc. The computing device 101 writes a script to automatically obtain the code repository from a code hosting platform, etc. The embodiments of this application do not specifically limit the method for the computing device 101 to obtain the development resources and code blocks of the project.

[0075] S20. The computing device 101 correlates the content of the development resources with the source code in the code library to obtain relationship data.

[0076] In the embodiments of the present application, the relationship data includes not only the content of the development resources and the source code in the code library, but also the corresponding relationship between the content of the development resources and the source code in the code library.

[0077] Exemplarily, if the information in the development resources includes information A1, information A2, information A3, and information A4. The source code in the code library specifically includes code B1, code B2, code B3, and code B4. Among them, information A1 corresponds to code B1, information A2 corresponds to code B2, information A3 corresponds to code B3, and information A4 corresponds to code B4. Then the relationship data includes information A1, information A2, information A3, information A4, code B1, code B2, code B3, and code B4, and also includes the four corresponding relationships: information A1 corresponds to code B1, information A2 corresponds to code B2, information A3 corresponds to code B3, and information A4 corresponds to code B4.

[0078] It should be noted that the relationship data can be in tabular format or represented in JavaScript Object Notation (Json) format, where each object contains knowledge, code blocks, and the corresponding relationship between the two. In addition, the relationship data can also be in other formats, which are not specifically limited in the embodiments of the present application.

[0079] In the embodiments of the present application, the content of the development resources and the source code in the code library can also be correlated based on the code structure. For example, information A1 is used to describe the overall function and interface of a certain module, and code B1 is the source code file of the corresponding module, which contains multiple function codes or class codes. Information A1 and code B1 can be correlated based on the code structure.

[0080] In addition, the content of the development resources and the source code in the code library can also be correlated based on the tasks or requirements in the development process. For example, knowledge A2 is used to describe user management tasks, including user login, registration, and information modification, etc. Code B2 is the source code of the user management module, which contains multiple functions to implement login, registration, information modification, etc. The computing device 101 can correlate knowledge A2 with code B2 based on the tasks or requirements in the development process.

[0081] In another example, the correspondence between the content of the development resources and the source code in the code library can be based on function points. For example, Knowledge A1 and Code B1 have the same function points, Knowledge A2 and Code B2 have the same function points, Knowledge A3 and Code B3 have the same function points, and Knowledge A4 and Code B4 have the same function points. Then the relationship data specifically includes: Knowledge A1 corresponds to Code B1, Knowledge A2 corresponds to Code B2, Knowledge A3 corresponds to Code B3, and Knowledge A4 corresponds to Code B4.

[0082] It should be noted that the embodiments of the present application can also be corresponded in other ways, and the embodiments of the present application do not specifically limit.

[0083] S30. The computing device 101 constructs a knowledge base for the project based on the relationship data.

[0084] In the embodiments of the present application, the content included in the knowledge base of the project specifically relates to the content of the development resources and the source code in the code library. For the convenience of subsequent use of the knowledge base, the knowledge in the knowledge base also includes the correspondence between the content in the development resources and the source code in the code library. That is, the knowledge base of the project includes relationship data.

[0085] As described above, the relationship data includes the content of the development resources, the source code in the code library, and the correspondence between the content of the development resources and the source code in the code library. Since the development resources of the project and the corresponding code library cover multiple stages from requirements analysis to code implementation, and the correspondence relationship builds a bridge between the business requirement description and the code implementation, the computing device 101 constructs a knowledge base based on the relationship data, which can cover the complete project knowledge system, and the relationship data in the knowledge base can accurately reflect the bridge between the business requirements and the code implementation, realizing the precise matching of the knowledge and the code in the knowledge base.

[0086] In the embodiments of the present application, the information in the knowledge base can exist in the form of a knowledge graph. Specifically, the computing device 101 converts the relationship data into a preset storage format. The preset storage format is the format in which the computing device 101 presets the storage information of the knowledge base. For example, the preset storage format is the Json format. The computing device 101 takes the information and code in the relationship data as knowledge entries, takes the knowledge entries as nodes, and takes the correspondence between the two as edges to construct a knowledge graph. The relationship data is stored in the knowledge base in the form of a knowledge graph.

[0087] Exemplarily, if information A1 and code B1 have the same function point 1, information A2 and code B2 have the same function point 2, information A3 and code B3 have the same function point 3, and information A4 and code B4 have the same function point 4. That is, the relational data is: information A1 corresponds to code B1, information A2 corresponds to code B2, information A3 corresponds to code B3, and information A4 corresponds to code B4. The knowledge graph constructed by computing device 101 based on the relational data is as Figure 3 shown, where Figure 3 is a schematic structural diagram of a knowledge graph provided by an embodiment of the present application.

[0088] In addition, computing device 101 may also exist in other ways. For example, computing device 101 may store knowledge through a relational database. For example, computing device 101 stores knowledge, source code, and their corresponding relationships in one or more tables, and each table may include types of knowledge, source code, and corresponding relationships. The embodiments of the present application do not specifically limit this.

[0089] Thus, embodiments of the present application can construct a knowledge base by using the development resources within the project and the source code in the code library, by establishing the corresponding relationship between the content of the development resources and the source code in the code library. Even if the project is a private project, the computing device can obtain the code library and development resources within the private project, and by corresponding the content of the development resources with the source code in the code blocks, construct a code knowledge base exclusive to the private project. Further, the content of the development resources in the private project corresponds to the source code in the code library, so that the business requirements of software development can be closely linked to the technical implementation, ensuring the effectiveness of the knowledge base.

[0090] Further, to more clearly understand the structure and organization of the code library, computing device 101 may refine step S20 into the Figure 4 S201 - S203 shown. Wherein, the Figure 4 is a flowchart of another method for constructing a knowledge base provided by an embodiment of the present application. In this method, step S20 specifically includes:

[0091] S201: Computing device 101 splits the content of the development resources of the project to obtain multiple functional units.

[0092] In the embodiments of the present application, to make the knowledge in the relational data more refined, computing device 101 splits the content of the development resources of the project to obtain multiple functional units.

[0093] Among them, the content of splitting development resources refers to classifying and organizing the knowledge in development resources to obtain multiple relatively independent functional modules or functional parts with descriptions. These relatively independent functional modules or functional parts with descriptions are functional units. That is, each functional unit is relatively independent in function, can be understood and implemented separately, and each functional unit can clearly describe its functional use, etc.

[0094] In the embodiment of the present application, one functional unit corresponds to one function point. One function point is used to implement a specific function. For example, the user login function point is used to implement the user login function. The computing device 101 obtains multiple functional units by splitting the content of the development resources, and one functional unit corresponds to one function point, so that the knowledge granularity in the relational data is small and can convey complete functional information. The computing device 101 can better implement the storage and retrieval of the knowledge base by obtaining a smaller knowledge granularity.

[0095] Example 1: If the development resource of the project is a project document, the computing device 101 can split the document content of the project document to obtain multiple units such as project description, requirement analysis, and design description.

[0096] In one example, the computing device 101 can use units such as the project description unit, requirement analysis unit, and design description unit as functional units. In another example, the computing device 101 can further split the above units to obtain paragraphs or key sentences. Among them, these paragraphs or key sentences focus on specific functions, and the computing device 101 can call the paragraphs or key sentences functional units. It can be understood that these paragraphs or key sentences focusing on specific functions have a smaller granularity and can more accurately and comprehensively establish the correspondence between functional units and code blocks.

[0097] For example, if the development resource is a project document of an e-commerce project, which includes descriptions of functions such as user management, order processing, and commodity management, the document content of the project document can be split to obtain the following multiple functional units, specifically including: a user registration functional unit for user registration; a user login functional unit for user login; a user information modification functional unit for user information modification; an order creation functional unit for order creation; an order payment functional unit for order payment, etc.

[0098] Example 2: If the development resource of the project is a user document, the computing device 101 can split the user document according to functions or according to the task process to obtain multiple paragraphs or key sentences. Among them, these paragraphs or key sentences focus on specific functions, and the computing device 101 can call the paragraphs or key sentences functional units.

[0099] Example 3: If the development resources of the project are test cases, the computing device 101 can classify and organize the test cases according to functional modules or business processes to form multiple test case sets. Each test case set is a functional unit.

[0100] For example, if an e-commerce project includes the following test cases: user registration test case, user login test case, user information modification test case, order creation test case, order payment test case, order processing test case, etc. The computing device 101 can split the above test cases to obtain multiple functional units, specifically the user management functional unit and the order processing functional unit. Among them, the user management module: includes test cases such as user registration, user login, and user information modification. The order processing module: includes test cases such as order creation, order payment, and order processing.

[0101] Example 4: If the development resources of the project are commit records, the computing device 101 can split the change descriptions and code details in the record entries.

[0102] For example, if the commit record is as follows:

[0103] Commit Identifier (ID): XXXXXXX

[0104] Committer: XX

[0105] Commit Time: xxxx-xx-xx

[0106] Change Description: Optimize the user login function, add a verification code function, and fix the vulnerability of the password reset function

[0107] Code Details:

[0108] Modified File: user / login.py

[0109] Modified Content: Add verification code verification logic to the login function

[0110] Newly Added File: user / captcha.py

[0111] Newly Added Content: Implement the verification code generation and verification function

[0112] Modified File: user / reset_password.py

[0113] Modified Content: Fix the vulnerability of the password reset function to ensure successful password update

[0114] The computing device 101 splits the above-mentioned submission record according to function points to obtain multiple functional units. Specifically, it includes: a user login functional unit, a verification code addition functional unit, and a password reset function repair functional unit.

[0115] Among them, the user login functional unit optimizes the user login function, specifically including:

[0116] Change description: Optimize the user login function

[0117] Code details:

[0118] File: user / login.py

[0119] Modified content: Add verification code verification logic to the login function

[0120] The verification code addition functional unit adds a verification code function, specifically including:

[0121] Change description: Add a verification code function

[0122] Code details:

[0123] File: user / captcha.py

[0124] New content: Implement the functions of generating and verifying verification codes

[0125] The password reset function repair functional unit repairs the vulnerability of the password reset function

[0126] Change description: Repair the vulnerability of the password reset function

[0127] Code details:

[0128] File: user / reset_password.py

[0129] Modified content: Repair the bug of the password reset function to ensure successful password update

[0130] That is, through the above splitting, the computing device 101 can split the change description and code details in the submission record into multiple functional units. Each functional unit corresponds to a function point, so as to more clearly understand the structure and organization of the code library, facilitating the construction and management of the knowledge base.

[0131] It should be noted that the embodiments of the present application can also split the development resources of other projects to obtain multiple functional units, or can also split the project documents, user documents, interface documents, test cases, and submission records described in the above examples at the same time. The embodiments of the present application do not specifically limit.

[0132] S202: The computing device 101 splits the source code according to the syntax structure to obtain multiple code blocks.

[0133] Code can be divided into functions, classes, variables, constants, etc. according to the grammatical structure. Among them, codes such as functions and classes are used to indicate specific functions or functional modules.

[0134] In the embodiment of the present application, the computing device 101 can split the source code according to the grammatical structure to obtain multiple code blocks. Among them, the code blocks are function codes and / or class codes. Thus, the source code is divided into smaller code blocks, which is convenient for establishing corresponding relationships with the cut functional units subsequently.

[0135] In specific implementation, the computing device 101 can first split according to functions to obtain multiple function codes, and then split according to classes to obtain multiple class codes. Or the computing device 101 can split according to functions and classes simultaneously to obtain multiple function codes and multiple class codes. Or the computing device 101 can first split according to classes to obtain multiple class codes, and then split according to functions to obtain multiple function codes. The embodiment of the present application does not specifically limit this.

[0136] It should be noted that the source code in the code library also includes annotation information, and the annotation information is used to annotate the functions of the corresponding source code. Therefore, when the computing device 101 splits the source code according to the grammatical structure, it can also split the annotation information according to functional modules to obtain multiple annotation units, and each annotation unit corresponds to a functional point.

[0137] It should be noted that steps S201 and S202 can be executed simultaneously, or S201 can be executed first and then S202, or S202 can be executed first and then S201. The embodiment of the present application does not specifically limit this.

[0138] S203: The computing device 101 corresponds the multiple functional units and the multiple code blocks according to functional points to form relationship data.

[0139] Exemplarily, if the computing device 101 splits the content of the development resources of a project to obtain multiple functional units, specifically functional unit 1, functional unit 2, functional unit 3, and functional unit 4. Among them, for functional unit 1: The user can register an account, and when registering, the user name, password, and email need to be filled in. For functional unit 2: The user can log in to the system, and when logging in, the user name and password need to be entered. For functional unit 3: The user can create an order, and when creating, the user needs to select goods and fill in the delivery address and payment method.

[0140] The computing device 101 splits the source code in the code library, and the multiple code blocks obtained include code block 1, code block 2, and code block 3.

[0141] Code block 1 is function - type code. The variables of the function include username, password, email, etc. For example, the function code is user_register(username, password, email), which is used to implement the user registration function. It should be noted that user_register() is the user registration function.

[0142] Code block 2 is function - type code. The variables of the function include username and password, etc. For example, the function code is user_login(username, password), which is used to implement the user login function code. It should be noted that user_login() is the user login function.

[0143] Code block 3 is function - type code. The variables of the function include user address, product, shipping address, and payment method. For example, it is create_order(user address, product, shipping address, payment method), which is used to implement the function of creating an order. It should be noted that create_order() is the order - creating function.

[0144] The computing device 101 corresponds the code blocks to the functional units according to the function points. The formed relationship data specifically includes: code block 1 corresponds to functional unit 1, code block 2 corresponds to functional unit 2, and code block 3 corresponds to functional unit 3.

[0145] In one example, the computing device can specifically correspond multiple functional units and multiple code blocks based on the annotation unit to obtain the relationship data. Since the annotation unit includes a lot of key information, through the key information, accurate matching between the functional unit and the code block can be achieved. For example, if the function of annotation unit 1 is user registration, the function of annotation unit 2 is user login, and the function of annotation unit 3 is creating an order. Then the computing device 101 can match the annotation units with the functional units and the code blocks respectively to obtain the corresponding relationship between the functional units and the code blocks. Code block 1 corresponds to functional unit 1, code block 2 corresponds to functional unit 2, and code block 3 corresponds to functional unit 3.

[0146] In summary, through the splitting method, the code in the code library can be corresponded to the knowledge in the development resources according to the function points to construct the relationship data. The knowledge base constructed in this way has a clear knowledge structure and organization, which is convenient for the construction of the knowledge base.

[0147] Furthermore, the embodiment of the present application can further refine step S30 to construct a more accurate and more complete knowledge base. Att Figure 5 This is another flowchart of the knowledge - base construction method provided by the embodiment of the present application. After steps S201 and S202, step S30 is further refined into S301 - S305:

[0148] S301: The computing device 101 obtains the dependency relationship between multiple code blocks.

[0149] Due to the complex dependencies between multiple code blocks, for example, one function may call another function, and one class may inherit from another class. Therefore, understanding the dependencies between these code blocks is crucial for understanding the overall architecture of the code and determining the execution order between code blocks.

[0150] In the embodiment of the present application, after the computing device 101 obtains multiple code blocks, it can obtain the dependencies between the multiple code blocks. Among them, the dependencies between code blocks specifically include the call relationship between code blocks and the association relationship between codes. For example, if a certain code block can be implemented only by calling another code block during application, then these two code blocks belong to the call relationship. If the execution of a code block depends on the data of another code block, such as the execution of the code block for verifying user login information depends on the data generated by the user registration code block, then there is an association relationship between these two code blocks.

[0151] For example, if the code blocks include a user registration code block, a user login code block, and a create order code block. Among them, the call relationship during the operation of the computing device 101 is: execute the user login code block after executing the user registration code block, and execute the create order code block after executing the user login code block.

[0152] The computing device 101 can identify the dependencies between code blocks through static analysis, or obtain the actual dependencies between code blocks through dynamic analysis. The embodiments of the present application do not specifically limit this.

[0153] (Optionally) S302. The computing device 101 obtains the variable meanings and the call relationships between multiple code blocks.

[0154] Specifically, the computing device 101 first splits the source code and can obtain multiple variables. The computing device obtains the variable meanings and the call relationships between multiple code blocks. It can be understood that the variable meanings include the generation, use, and transmission of variables. Through the variable meanings, the call relationships with multiple code blocks can be clarified.

[0155] For example, if code block 1 is user_register(username, password, email), code block 2 is user_login(username, password), and code block 3 is create_order(user address, product, shipping address, payment method). Among them, the variable is the user address, and its meaning is generated in the user_register() function, verified in the user_login() function, and the user address is passed to create_order(). Therefore, the computing device 101 can obtain the call relationships between the variable meanings and multiple code blocks based on the variable meanings.

[0156] It should be noted that steps S301 and S302 can be executed simultaneously, or S301 can be executed first and then S302, or S302 can be executed first and then S301. The embodiments of the present application do not specifically limit this.

[0157] S303. The computing device 101 constructs a knowledge base based on the relationship data and the dependency relationship.

[0158] That is to say, the knowledge base includes relationship data and dependency relationships.

[0159] Exemplarily, if knowledge A1 and code B1 have the same function point 1, knowledge A2 and code B2 have the same function point 2, knowledge A3 and code B3 have the same function point 3, and knowledge A4 and code B4 have the same function point 4. That is, the relationship data is: knowledge A1 corresponds to code B1, knowledge A2 corresponds to code B2, knowledge A3 corresponds to code B3, and knowledge A4 corresponds to code B4. And the execution of code B2 depends on the execution result of code B1, the execution of code B3 depends on the execution result of code B2, and the execution of code B4 depends on the execution result of code B3. Then, for the knowledge base constructed by the computing device 101 based on the relationship data and the dependency relationship, if it exists in the form of a knowledge graph, the specifically constructed knowledge graph is as Figure 6A shown. Attached Figure 6A is a schematic structural diagram of another knowledge graph provided by the embodiments of the present application. Figure 6A In the arrow "→" in indicates the dependency relationship, and the node pointed to by the arrow depends on the other node corresponding to the arrow.

[0160] Furthermore, the computing device 101 can also construct a knowledge base based on the relationship data, the call relationship, and the dependency relationship. Exemplarily, if code B1 has a call relationship with variable 1, code B2 has a call relationship with variable 2, code B3 has a call relationship with variable 3, and variable 4 has a call relationship with code B4. Exemplarily, if the knowledge base constructed based on the relationship data, the call relationship, and the dependency relationship exists in the form of a knowledge graph, the specifically constructed knowledge graph is as Figure 6B shown, Figure 6B is a schematic structural diagram of yet another knowledge graph provided by the embodiments of the present application. This knowledge graph includes the call relationship between variables and code blocks.

[0161] It can be understood that for the above knowledge base, not only is the information coverage comprehensive, but there are also detailed dependency relationships, as well as the call relationships between variable meanings and functions. Through this call relationship, the association between problems and code can be constructed, and when the user asks a question, the relevant code can be directly retrieved from the knowledge base.

[0162] Furthermore, in the embodiments of the present application, after obtaining the relationship data, a vector-based data index can be constructed based on data vectorization to store the relationship data in a vector database. It should be noted that vector database technology is a database system specifically used for storing, indexing, and searching vector data. In such a database, data is usually stored in the form of vectors, which can be multi-dimensional numerical arrays used to represent various types of data. By vectorizing text and storing it in a vector database, semantic retrieval can be achieved.

[0163] Exemplary illustration, attached Figure 7 FIG. 7 is a flowchart of another method for constructing a knowledge base provided by an embodiment of the present application. In this method, S20 is specifically refined into S710. Step S301 is refined into S720, step S302 is the same as S730, S303 is the same as S740, and S30 is refined into S750-S760. The method includes the following:

[0164] S710. The computing device 101 loads the project documents, user documents, interface documents, test cases, submission records, and code in the code library.

[0165] S720. The computing device 101 splits the project documents, user documents, interface documents, test case sets, and submission records to obtain multiple functional units.

[0166] S730. The computing device 101 splits the source code in the code library according to the syntax structure to obtain multiple code blocks.

[0167] S740. The computing device 101 integrates the functional units and code blocks to obtain relationship data.

[0168] S750. The computing device 101 vectorizes the data in the relationship data.

[0169] Specifically, the computing device 101 vectorizes the code and vectorizes the knowledge in the development resources to construct a vector-based data index and store the data in the database to implement the construction of a code indication library.

[0170] S760. The computing device 101 constructs a knowledge base based on the vectorized relationship data.

[0171] Furthermore, on this basis, the following steps can be continued:

[0172] S770. The computing device 101 integrates the knowledge base with a language model.

[0173] Thus, the computing device 101 can utilize the information in the knowledge base for retrieval, and based on the retrieval results, enable the language model to make accurate answers and inferences. For example, the computing device can splice based on the retrieval results and semantic information to obtain a prompt word, and use the prompt word to query the language model to enable the language model to make accurate answers and inferences.

[0174] S780. The computing device 101 uses the language model to generate code documents or generate response results related to semantic information.

[0175] In the embodiments of the present application, the computing device 101 can integrate the knowledge base with the language model, and use the grammar model to generate code documents and solve the problems submitted by users.

[0176] The following will be specifically described with reference to the drawings.

[0177] Exemplary 1, attached Figure 8 FIG. is a usage flow chart provided by the embodiments of the present application. The method includes the following:

[0178] S810. The terminal device 102 receives a question input by the user.

[0179] Among them, the question input by the user can specifically be a question related to code generation, test case generation, code explanation, or knowledge retrieval, etc.

[0180] S820. The terminal device 102 sends the question input by the user to the computing device 101.

[0181] S830. The computing device 101 performs a search based on a pre-constructed knowledge base to obtain a retrieval result related to the question.

[0182] S840. The computing device 101 constructs a prompt word based on the retrieval result.

[0183] Among them, the prompt word corresponding to code generation is the code generation prompt word, the prompt word corresponding to test case generation is the test case prompt word, the prompt word corresponding to code explanation is the code explanation prompt word, and the prompt word corresponding to knowledge retrieval is the question prompt word.

[0184] S850. The computing device 101 inputs the prompt word into the language model to obtain a response result.

[0185] It can be understood that the application of the large model combined with the code knowledge base in the development scenario can improve development efficiency and code quality. Code generation reduces the manual coding workload, improves coding speed and consistency, and enables developers to focus on the implementation of the core business logic. Test case generation enhances the comprehensiveness and automation level of testing, ensures software quality, and reduces the time and cost of manually writing test cases. Code explanation helps developers quickly understand the existing code base, promotes knowledge and technology transfer among teams, and improves code maintenance efficiency. Knowledge retrieval improves information retrieval efficiency and speeds up problem-solving.

[0186] Furthermore, the computing device 101 can continue to execute the following to update the knowledge base.

[0187] S860. The computing device 101 sends the response result to the terminal device 102 for display.

[0188] S870. The terminal device 102 receives the user's confirmation operation.

[0189] Wherein, the confirmation operation indicates whether the user accepts the response result or does not accept the response result.

[0190] S880. The terminal device 102 sends the confirmation information to the computing device 101.

[0191] S890. The computing device 101 updates the knowledge base based on the confirmation information.

[0192] Specifically, if the confirmation information is that the response result meets the preset conditions, the question and the response result are added to the knowledge base to update the knowledge base. Wherein, the preset condition is that the generated response result meets the user's needs.

[0193] Specifically, if the confirmation operation is to receive the response result, and the confirmation information is that the response result meets the preset conditions, then the computing device 101 can update the knowledge base based on the confirmation information.

[0194] Example 2, attached Figure 9 This is another usage flowchart provided by the embodiments of the present application. The method includes the following:

[0195] S910. After the computing device 101 receives the semantic information input by the user, it generates a document prompt word according to the knowledge base and the document template.

[0196] Wherein, in the embodiments of the present application, the semantic information indicates generating the code document of the code library.

[0197] S920. The computing device 101 inputs the document prompt word into the language model to obtain the code document corresponding to the code library.

[0198] In the embodiments of the present application, the code document refers to the explanatory document of the code library, which is used to provide clear guidance for developers. The code document includes a project overview, function module descriptions, detailed descriptions of each module, and also includes the types of code for implementing the functions, specifically including interfaces, classes, constants, variables, etc., and also includes the call relationships between the codes.

[0199] It should be noted that there are other usages of the knowledge base in the embodiments of the present application, and the embodiments of the present application do not specifically limit them.

[0200] In addition, the embodiments of the present application also provide a knowledge base construction device, which is applied to a computing device.

[0201] Appendix Figure 10 FIG. is a schematic structural diagram of a knowledge base construction device provided by an embodiment of the present application. The device 1000 includes:

[0202] An obtaining unit 1001, configured to obtain the development resources of a project and the corresponding code library, where the development resources indicate the files or documents involved in the software development process of the project, and the code library includes the source code of the project;

[0203] A construction unit 1002, configured to correspond the content of the development resources with the source code in the code library to obtain relationship data, and use the relationship data to construct the knowledge base of the project.

[0204] Optionally, the construction unit 1002 specifically applies: splitting the source code according to the syntax structure to obtain a plurality of code blocks; the plurality of code blocks include function code blocks and / or class code blocks; splitting the content of the development resources to obtain a plurality of function units; one function unit corresponds to one function point; corresponding the plurality of function units with the plurality of code blocks according to the function points to form the relationship data.

[0205] Optionally, the construction unit 1002 is further configured to: split the comment information in the source code to obtain a plurality of comment units; one comment unit corresponds to one function point; based on the plurality of comment units, corresponding the plurality of function units with the plurality of code blocks according to the function to obtain the relationship data.

[0206] Optionally, the construction unit 1002 is further configured to: obtain the dependency relationship between the plurality of code blocks; the dependency relationship includes the call relationship between function codes and / or the inheritance relationship between class codes; construct the knowledge base according to the dependency relationship and the relationship data.

[0207] Optionally, the construction unit 1002 is further configured to: obtain the call relationship between the variable meanings and the plurality of code blocks; construct the knowledge base according to the association relationship, the call relationship and the relationship data.

[0208] In a specific implementation, if the development resources of the project are documents, where the documents include project documents, user documents, and / or interface documents, the computing device may split the document content of the documents to obtain multiple paragraphs or key sentences; the paragraphs or key sentences can independently convey complete information.

[0209] In yet another specific implementation, the apparatus 1000 further includes an updating unit, and the updating unit is specifically configured to: receive a question submitted by a user; obtain retrieval information corresponding to the question from the knowledge base; construct a prompt word based on the retrieval information; input the prompt word into a language model to obtain a response result corresponding to the question; if the response result meets a preset condition, write the question and the response result into the knowledge base to update the knowledge base.

[0210] Furthermore, an embodiment of the present application further provides a server.

[0211] As Figure 11 shown, an embodiment of the present application further provides a server 1100. The application scenario of the server 1100 is not specifically limited. For example, the server 1100 is introduced by taking a server as an example. Specifically, the type of the server is not limited either. For example, the server may be a rack server or an edge server. The server may be located in a data center or in other areas, which is not specifically limited in the embodiments of the present application.

[0212] The server 1100 includes a processor 1101 and a memory 1103, and the memory 1103 is electrically connected to the processor 1101 respectively; the memory 1103 is used to store program instructions for any one of the methods involved in the above embodiments; the processor 1101 is used to call the corresponding part of the above program instructions so that the server can execute any one of the methods involved in the above embodiments.

[0213] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions in the embodiments of the present application are generated in whole or in part.

[0214] An embodiment of the present application also provides a computer program product containing instructions. The computer program product may be software or a program product containing instructions that can run on a computing device or be stored in any available medium. When the computer program product runs on a computing device, it causes the computing device to execute any one of the above-mentioned methods. An embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium may be any available medium that a computing device can store or a data storage device such as a data center containing one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive), etc. The computer-readable storage medium includes instructions that direct the computing device to execute any one of the above-mentioned methods.

[0215] The descriptions of the processes or structures corresponding to the above respective drawings each have their own focuses. For parts not detailed in a certain process or structure, reference may be made to the relevant descriptions of other processes or structures.

[0216] As described above, the above are only the specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for constructing a knowledge base, characterized in that, The method includes: Obtaining the development resources of the project and the corresponding code library; Wherein, the development resources indicate the documents or files involved in the software development process of the project, and the code library includes the source code of the project; Corresponding the content in the development resources with the source code in the code library to obtain relationship data; constructing the knowledge base of the project by using the relationship data.

2. The method according to claim 1, wherein The corresponding of the content of the development resources with the source code in the code library to obtain relationship data includes: Splitting the source code according to the syntax structure to obtain a plurality of code blocks; the plurality of code blocks include function code blocks and / or class code blocks; Splitting the content of the development resources to obtain a plurality of functional units; one functional unit corresponds to one function point; Corresponding the plurality of functional units with the plurality of code blocks according to the function points to form the relationship data.

3. The method according to claim 2, wherein If the method further includes: Splitting the comment information in the source code to obtain a plurality of comment units; 1 comment unit corresponds to one function point; The corresponding of the content of the development resources with the source code in the code library to obtain relationship data includes: Based on the plurality of comment units, corresponding the plurality of functional units with the plurality of code blocks according to the function to obtain the relationship data.

4. The method according to claim 2, characterized in that, The method further includes: Obtaining the dependency relationship between the plurality of code blocks; the dependency relationship includes the call relationship between function codes and / or the inheritance relationship between class codes; The constructing of the knowledge base according to the relationship data includes: Constructing the knowledge base according to the dependency relationship and the relationship data.

5. The method according to claim 4, characterized in that, The method further includes: Obtaining the call relationship between the variable meanings and the plurality of code blocks; The constructing of the knowledge base according to the association relationship and the relationship data includes: Constructing the knowledge base according to the association relationship, the call relationship and the relationship data.

6. The method according to claim 2, wherein If the development resources of the project are documents, the documents include project documents, user documents and / or interface documents; The splitting of the content of the development resources to obtain a plurality of functional units includes: Splitting the document content of the document to obtain a plurality of paragraphs or key sentences; the paragraphs or key sentences can independently convey complete information.

7. The method according to claim 1, wherein The method further includes: Receiving a question submitted by a user; Obtaining retrieval information corresponding to the question from the knowledge base; Constructing a prompt word based on the retrieval information; Inputting the prompt word into a language model to obtain a response result corresponding to the question; If the response result meets a preset condition, writing the question and the response result into the knowledge base to update the knowledge base.

8. A method for generating code documentation, characterized in that, The method includes: Receiving semantic information input by a user; the semantic information is used to obtain the code document of the code library; Obtain the code document according to the knowledge base of the project and the language model associated with the knowledge base; wherein, the knowledge base is constructed based on relational data, and the relational data is data obtained by corresponding the content of the development resources in the project and the source code in the code library, the development resources indicate files or documents involved in the project during the software development process, and the code library includes the source code of the project; The code document includes one or more of the project overview of the project, the description of the functional modules, the code types for implementing the functional modules, and the call relationships between the codes.

9. The method according to claim 8, wherein Obtaining the code document according to the knowledge base of the project and the language model associated with the knowledge base includes; Construct a document prompt according to the knowledge base and the document template; Input the document prompt into the language model to obtain the code document of the project.

10. A computing device, characterized in that, Including a memory and a processor; The memory is used to store programs; The processor is used to execute the program stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method according to any one of claims 1-9.