Large model-based project code processing method and device, and related equipment
By conducting in-depth analysis of the project code through a large model, functional documentation and dependency diagrams are generated, solving the long-standing problem of understanding project code and improving the efficiency and accuracy of code analysis.
Patent Information
- Application Number
- CN202411815006.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-12-10
AI Technical Summary
In software development, the complexity and lack of documentation in long-term project code make code analysis complex and time-consuming, making it difficult to understand and maintain efficiently.
We utilize large models to build hint information based on reference files in the project code. Through in-depth analysis using large language models or multimodal large models, we generate project code information, including functional documentation and dependency graphs.
It improves the accuracy and analysis efficiency of project code information, helps developers quickly understand code functions and architecture, and reduces development and maintenance complexity.
Smart Images

Figure CN119781823B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of artificial intelligence, in particular to the technical field of deep learning, large model, etc. BACKGROUND
[0002] In the field of software development, due to the complexity of the project and the lengthening of the development cycle, the amount of code of the project code is increasing, and the complexity is also increasing. Especially for the code without relevant instructions in the long-term development process, analyzing the project code is an extremely complex and time-consuming work. SUMMARY
[0003] The present disclosure provides a project code processing method and device based on a large model and related equipment.
[0004] According to an aspect of the present disclosure, a project code processing method based on a large model is provided, comprising:
[0005] constructing a first prompt information based on the reference file of the project code; the first prompt information includes content type information to be generated;
[0006] inputting the first prompt information into a large model to obtain output project code information generated for the content type information.
[0007] According to another aspect of the present disclosure, a project code processing device based on a large model is provided, comprising:
[0008] a construction module configured to construct a first prompt information based on the reference file of the project code; the first prompt information includes content type information to be generated;
[0009] a processing module configured to input the first prompt information into a large model to obtain output project code information generated for the content type information.
[0010] According to another aspect of the present disclosure, an electronic device is provided, comprising:
[0011] at least one processor; and
[0012] a memory in communication with the at least one processor; wherein
[0013] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any of the embodiments of the present disclosure.
[0014] According to another aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to make the computer execute the method according to any of the embodiments of the present disclosure.
[0015] According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method according to any of the embodiments of the present disclosure.
[0016] In the embodiments of the present disclosure, the strong reasoning and understanding ability of the large model for the document can automatically generate the project code information by referring to the in-depth analysis of the project code, which can improve the accuracy of the project code information and improve the efficiency of the code analysis.
[0017] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0018] The accompanying drawings are used to better understand the present scheme and do not constitute a limitation on the present disclosure. Among them:
[0019] Figure 1 is a flowchart of a large model-based project code processing method according to an embodiment of the present disclosure;
[0020] Figure 2 is a schematic diagram of a visualization interface according to an embodiment of the present disclosure;
[0021] Figure 3 is another flowchart of a large model-based project code processing method according to an embodiment of the present disclosure;
[0022] Figure 4 is still another flowchart of a large model-based project code processing method according to an embodiment of the present disclosure;
[0023] Figure 5 is a structural schematic diagram of a large model-based project code processing device according to an embodiment of the present disclosure;
[0024] Figure 6 is a block diagram of an electronic device for implementing a large model-based project code processing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to help understanding, and should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present disclosure. Also, in order to be clear and concise, the description below omits the description of well-known functions and structures.
[0026] The terms "first," "second," and the like in this disclosure are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. Furthermore, the terms "including," "comprising," and "having," and any variations thereof, are intended to cover non-exclusive inclusions, such as, for example, inclusion of a series of steps or elements. A method, system, product, or apparatus is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to such process, method, product, or apparatus.
[0027] In large projects, there are many contents that need to be sorted out, which further increases the difficulty of manual understanding of project codes. In view of this, the embodiment of the present disclosure proposes a project code processing method based on a large model, such as Figure 1 The flowchart of the method is shown, which includes:
[0028] S101, constructing first prompt information based on a reference file of a project code; the first prompt information includes information on a type of content to be generated.
[0029] The reference file may include at least one of a configuration file and a dependency index file in addition to the project code.
[0030] The configuration file is used to parse key configurations in the project code. For example, the configuration file can be a readme file or an info file. The readme file describes the project code, helping large models quickly understand the project content. The info file is used to obtain an overview of relevant information about the project code. For example, the info file includes, but is not limited to, the number of rows, the number of columns, the column index, the number of non-null values in a column, the column type, and memory usage.
[0031] The index file includes the libraries and versions that the project code depends on.
[0032] S102: Input the first prompt information into the large model to obtain output project code information generated according to the content type information.
[0033] The project code information is used to describe the function of the project code and / or the dependency relationship in the code.
[0034] Large models can be large language models (LLMs). Large language models refer to a specific type of large model specifically designed for processing text data. These models are neural network-based natural language processing models that can be used to generate, understand, and process text data. Large language models can have tens of billions of parameters, can generate high-quality text, and can be used for various natural language processing tasks such as question answering, text generation, and dialogue systems.
[0035] The large language model has good reasoning ability and small sample learning ability. The large language model can understand that the model size is large, or can be trained on a large number of samples. Based on the large model, accurate semantic understanding can be achieved.
[0036] In addition, the large model can also be a multimodal large language model (MLLM). In order to process the multimodal information provided by the first prompt information, to generate multimodal project code information.
[0037] In the embodiments of the present disclosure, the first prompt information is constructed based on the reference file of the project code, so that the large model can perform code analysis tasks based on the first prompt information, and comprehensively analyze the reference file of the project code. In the embodiments of the present disclosure, the strong reasoning and understanding ability of the large model for documents can deeply analyze the project code through the reference file, automatically generate project code information, improve the accuracy of the project code information, and improve the efficiency of code analysis.
[0038] The project code information can help developers quickly understand the project code and significantly improve the on-boarding speed of new developers. The large model can automatically maintain the relevant explanations and descriptions of the project code.
[0039] In some embodiments, before inputting the project code into the large model, the project code can also be preprocessed, including but not limited to removing redundant blank lines and redundant information in the project code.
[0040] Exemplary can include indentation normalization, deleting redundant comments, etc. Based on this way, the code style can be unified, and the reasoning process of the large model is more accurate.
[0041] In addition, in the case that the size of the project code is too large, it can be divided into multiple sub-project codes according to the internal modules. The multiple sub-project codes are sequentially input into the large model for processing to obtain the sub-project code information corresponding to each sub-project code. The multiple sub-project code information is re-input into the large model, and then the large model reasons to obtain the logical relationship between the multiple sub-project code information, and finally obtains the final project code information.
[0042] In some embodiments, in order to obtain the internal logic of the project code, the large model can call related tools to perform syntax analysis or semantic understanding on the project code, and the combination of the two lays a foundation for the reasoning process of the large model. The syntax analysis is used to parse the syntax tree of the project code and extract basic structure information. The semantic understanding is used to deeply understand the function, logic flow and data flow of the functions in the project code.
[0043] The syntax analysis of the project code can be implemented by using a compiler tool chain. The compiler tool chain can be ANTLR (ANother Tool for Language Recognition, a cross-language syntax parser) for example. Other tools that can perform semantic understanding can also be applicable to the embodiments of the present disclosure, which are not limited in this regard.
[0044] The semantic understanding of the project code can be implemented by using CodeBERT (A Pre-Trained Model for Programming and Natural Languages, a pre-trained model for code and natural language processing).
[0045] In addition, in the embodiments of the present disclosure, since the large model can be compatible with multiple languages and frameworks (such as Java, Python, JavaScript, etc.), the key structure of the project code can be extracted by using the corresponding parsers of multiple languages, and then input to the large model, so as to facilitate the subsequent deep understanding of the code reference relationship by the large model.
[0046] In some embodiments, the large model can generate project code information with different emphases based on different content types. When the content type information indicates that the project function is explained, the project code information includes project function document information. The project function document information is used to describe the function of the project code and the role of each module in the project code. The project function document information directly affects the success rate of the project and the long-term maintainability of the software product. As a communication medium, it can help team members, related parties and future maintainers to understand the goals, requirements, design and implementation details of the project.
[0047] When the content type information indicates the dependency relationship, the project code information includes code reference relationship information. The code reference relationship information is used to describe the reference graph of the modules, classes, functions and the like in the project code.
[0048] In the embodiments of the present disclosure, the project function document information can help the developer to quickly understand the function of the code, and the code reference relationship information provides clear code dependency relationship, which can help the developer to sort out the code architecture, facilitate the module division and cooperation of the developer, reduce the operation complexity of the code development and maintenance, and improve the development efficiency.
[0049] In some embodiments, when the content type information indicates that the project function is explained, the first prompt information further includes document template information and generated document requirement information.
[0050] The document template information is used to standardize the format of the project code information and the included core modules.
[0051] The document requirement information is used to specify the content that the project code information needs to focus on generating.
[0052] In the embodiments of the present disclosure, the project code information output is limited within the template using the document template information and the document requirement information, so as to avoid irrelevant content output by the large model or hallucination, and further improve the accuracy of the content output by the large model using the specified document requirement.
[0053] In some embodiments, the document template information includes image examples and text examples.
[0054] The text examples in the document are used to explain the project code functions, and even the code logic of the key functions can be explained by text. The image examples are used to understand the function description or key logic together with the text examples.
[0055] In the embodiments of the present disclosure, the form of combination of text and image can improve the detailed and rich degree of the project function document information generation content, and improve the accuracy and readability of the project function document information generation.
[0056] In some embodiments, the document requirement includes at least one of the following: module function information, interface definition information, key algorithm description information, image quality requirement information, image source requirement information, language style information, and project code example information.
[0057] The module function information is used to describe the main function and purpose of each module in the project code.
[0058] The interface definition information is used to describe the input and output parameter description, calling condition, and return value type in the project code.
[0059] The key algorithm description information is used to provide detailed textual description and code implementation example for the core algorithm in the project code.
[0060] The image quality requirement information can be flexibly defined according to actual conditions. For example, the quality, size, and format of the image can be required.
[0061] The image source requirement information is used to require that the image source is included in the reference file, which can be understood as limiting the image in the reference file instead of randomly generating the image, so as to limit the output range of the image, and further avoid hallucination phenomenon or inaccurate expression of the large model.
[0062] Language style information for limiting the language of the generated project code information. For example, the project function document information is an objective and factual document, so the language style can be required to be a scientific thinking narrative mode, not an art thinking narrative mode. In implementation, the project function document can be required to as far as possible not use metaphors, parallel sentences, and exaggeration methods to describe. The project function document information is generated in the pursuit of objective facts.
[0063] Project code example information for describing when to use the project code and providing key code source code.
[0064] In implementation, when the content type is to explain the project function, and the module function information and the key algorithm description information are focused on, the document requirements included in the first prompt information can be exemplarily as follows:
[0065] “Please generate project code information for explaining the project function for the project code:
[0066] 1. Briefly describe the overall goal and purpose of the project code.
[0067] 2. Explain the main functions and division of labor of each module in the project code.
[0068] 3. Provide detailed textual description of the core algorithm in the project code.”
[0069] It can be understood that the specific items of the above document requirements can be respectively limited and explained in the first prompt information, so as to facilitate the large model to accurately understand the requirements of the task.
[0070] Of course, the foregoing document requirements are only used for exemplarily description, and in the case that the generated project code information needs other requirements, the first prompt information can be optimized according to the needs.
[0071] In the embodiments of the present disclosure, the accuracy of the large model to understand the task requirements is improved by accurately describing the document requirements, so as to improve the accuracy of the content required to be combed out from the huge reference file, and further improve the accuracy of the generated project function document information.
[0072] In some embodiments, when the content type information indicates a dependency relationship, the first prompt information includes category information of the dependency relationship to be extracted and key content information contained in the dependency relationship of each category to be extracted;
[0073] The category information includes at least one of the following:
[0074] Module dependency relationship information;
[0075] Function dependency information.
[0076] The module dependency information can be used to generate an architecture diagram based on the project code.
[0077] The function dependency information can be used to generate a function dependency graph based on the function call relationship in the project code.
[0078] In addition, the class information can also include class dependency, which is used to generate a reference relationship diagram of classes in the same module based on the class structure in the project code.
[0079] Based on the above dependency relationships, a flowchart can be formed.
[0080] In implementation, each project code can be divided into at least one module, and the module dependency relationship represents the dependency between each module in the project code. For example, module A needs to depend on module B for operation. The code in a module is usually divided into at least one class, and each class includes at least one function.
[0081] In the case where the required extraction of the dependency relationship in the first prompt information includes module dependency information, class dependency information, and function dependency information, the visualization interface is exemplarily as shown in Figure 2 As shown, the module dependency relationship information indicates that module A depends on module B and module E, module B depends on module C, and module C depends on module D. Clicking module C can view the class dependency relationship information under the module, class A depends on class B and class C, class C depends on class D, and clicking class D can view the function dependency relationship information under the class, function B and function D depend on function A.
[0082] In addition, the first prompt information can also include constraint instructions for key content to capture key content by the large model, for example:
[0083] "Generate class dependency relationship for project code:
[0084] Ensure that the class dependency relationship includes:
[0085] 1. The name of each class, all attributes, and methods.
[0086] 2. The inheritance relationship and association relationship (such as composition, aggregation, etc.) between classes. At the same time, generate a function dependency path, which requires:
[0087] (1) Specify the entry function and all downstream functions called by it.
[0088] (2) Include the parameter and return value types of each function.
[0089] 3. Ensure that the output content format is clear and complete, and does not miss any key points.
[0090] In the embodiments of the present disclosure, the type of the dependency relationship to be extracted is explicitly determined based on the first prompt information, which can improve the accuracy of the large model in understanding the task requirements, thereby improving the accuracy of dependency relationship extraction.
[0091] In some embodiments, the code reference relationship information is described based on a structured language; the method can be implemented as: obtaining the code reference relationship information expressed by the structured language; and generating a visual code reference graph based on the code reference relationship information.
[0092] The structured language can be JSON language, and the large model can analyze the code reference relationship based on the first prompt information output, and describe the reference relationship using JSON language. Then, the code reference relationship can be parsed by means of a JSON language converter, and then converted into a visual code reference graph.
[0093] In the embodiments of the present disclosure, the strong reasoning ability of the large model is used to deeply analyze the project code, and the code reference relationship of the project code can be understood, and a visual code reference graph is obtained to facilitate the developers to quickly understand the code architecture and improve the user experience.
[0094] The large model needs to complete multiple tasks on the reference files of the project code, in which case, the first prompt information can be layered, and the prompt words in each layer are used to process one task. For example, in the case where the generated content type includes project function information, module dependency relationship information, class dependency relationship information, and function dependency relationship information. The first level of the first prompt information is used to generate project code information explaining the project function, and based on the foregoing case of generating project code information explaining the project function, the large model can better complete the subsequent tasks in sequence by using the knowledge learned in the previous task.
[0095] In some embodiments, dynamic updating of project code information can also be supported. For example, due to the long production cycle of the project code, the project code may be updated during the period, and in this case, the large model can be used to update the generated project code information. For example, as shown in Figure 3 , which can be implemented as:
[0096] S301, obtaining an incremental update file of the project code.
[0097] The incremental update file is the part of the project code that has been adjusted.
[0098] S302, obtaining second prompt information based on the incremental update file.
[0099] The second prompt information needs to specify that the task type is to update the project code information according to the incremental updated code part, so that the large model can dynamically update the learned knowledge in the previously generated project code information.
[0100] S303, input the second prompt information into the large model to obtain the output updated project code information for the content type information.
[0101] In implementation, the historical project code information also needs to be input into the large model, and the large model updates the entire project code information in combination with the historical project code information.
[0102] In the embodiments of the present disclosure, the project code information can be dynamically and automatically updated according to the latest state of the project code, and the project code information can be updated synchronously with the iteration of the project, so as to improve the matching degree of the project code information and the actual situation, and further improve the user experience.
[0103] In some embodiments, in order to further improve the accuracy of the project code information output by the large model, as shown in Figure 4 The prompt template of the first prompt information can also be optimized based on the following method;
[0104] S401, obtain training corpus, wherein the training corpus includes functional document samples meeting preset requirements.
[0105] The excellent project documents (such as functional description, technical architecture, model dependency graph, class dependency graph, function dependency graph, etc.) can be collected and analyzed as targeted training corpus to provide high-quality reference standard for the large model.
[0106] The document structure, language style and content completeness in the training corpus are labeled to improve the matching degree between the project code information generated by the large model and the expected project code information.
[0107] The content completeness can be labeled in the following aspects, for example:
[0108] (a) Information coverage, which refers to the description of all main modules and functions required by the project code.
[0109] For example, but not limited to, system target and function, input and output of each module, core algorithm or logic, interaction relationship between key modules, important dependency information such as role of configuration file, dependent library and version, etc.
[0110] (b) Hierarchical description
[0111] The content is layered and gradually expanded from macro to micro.
[0112] Overall Description: System Architecture, Design Goals, Major Functional Module Division.
[0113] Module Level Description: Module Function, Interface Definition, Dependencies.
[0114] Detailed Description: Class Dependencies, Function Dependencies, Concrete Implementation Logic.
[0115] (c) Use Case Coverage
[0116] Provide specific use scenarios or cases to help developers understand how the document content can be applied in actual operations.
[0117] (d) Details Supplement
[0118] Project code information on how to handle special scenarios (such as exception handling, security considerations) or non-functional requirements (such as performance optimization, scalability design).
[0119] Of course, the content of the training corpus can be determined based on actual conditions, and the embodiments of the present disclosure will not be described one by one.
[0120] S402, obtaining a sample prompt based on the training corpus and the prompt template of the first prompt information.
[0121] The way to build the sample prompt is similar to the way to build the first prompt information, and the embodiments of the present disclosure will not be described here.
[0122] S403, inputting the sample prompt into the large model to obtain an output function document to be optimized.
[0123] S404, comparing the function document to be optimized with the functional document sample to obtain a comparison result.
[0124] Among them, the functional document sample includes annotation information of multiple optimization dimensions. The specific annotation information has been described in the foregoing.
[0125] Comparing the function document to be optimized with the functional document sample to obtain a comparison result, the specific implementation is: the comparison result includes: based on the annotation information of the optimization dimension to be optimized of the function document to be optimized relative to the functional document sample.
[0126] In implementation, the content to be optimized in the prompt information needs to be located based on the optimization dimension to be optimized of the function document to be optimized relative to the functional document, and then the prompt information is optimized. Among them, the optimization dimension to be optimized is the dimension to be optimized in the multiple known optimization dimensions.
[0127] Exemplarily, in the case where a class dependency graph needs to be generated, if the class dependency graph is not generated, it can be checked whether the sample prompt contains constraints and instructions for requiring the generation of the class dependency graph. If not, it is added in the corresponding position. If yes, the description method can be modified to make the generated dependency graph more standardized and accurate.
[0128] In the embodiments of the present disclosure, by comparing the to-be-optimized function document generated by the large model and the functional document sample, the to-be-optimized dimension of the to-be-optimized function document can be accurately and quickly determined. Through the annotation information corresponding to the to-be-optimized dimension, the deficiency of the prompt information can be clearly prompted, thereby improving the accuracy of determining the optimization direction, so as to facilitate the iterative updating of the prompt template, and further improve the accuracy of the large model in generating project code information.
[0129] S405, obtaining reconfiguration information according to the comparison result.
[0130] The reconfiguration information is the information that needs to be optimized in the prompt information.
[0131] S406, reconfiguring the prompt template according to the reconfiguration information.
[0132] In the embodiments of the present disclosure, the large model is trained using excellent training corpus, which can provide a high-quality reference standard for the large model, so that the large model can learn better sample data. Meanwhile, by comparing the generated to-be-optimized function document with the functional document sample, clear reconfiguration information can be obtained, and the accuracy of the generation process of the large model can be improved.
[0133] In summary, based on the large model and the corresponding prompt information, the project code analysis method provided by the embodiments of the present disclosure has the following advantages:
[0134] 1. All-around document generation, including:
[0135] Project function document: for the functional modules of the project, mainly including input, output, interaction process, etc., and function introduction of the functional modules. Among them, the function introduction of the functional modules can help users and developers understand the function and responsibility of each module, and in combination with the interaction process, the working process and architecture of the entire system can be better understood. Through the input and output of the functional modules, the maintenance function and the extension function can be facilitated. When problems occur, it can also help developers quickly locate the problem, thereby speeding up the problem diagnosis and solution process. In a large project, different teams may be responsible for different functional modules. Through the description of the functional modules, better communication and cooperation between teams can be achieved. Therefore, through the project function document, the user experience can be improved.
[0136] Code reference graph: based on the output system architecture description, it can cover component division, dependency relationship, deployment scheme, etc., to help developers quickly understand the project.
[0137] The code reference graph can include:
[0138] (1) Engineering subcomponent architecture diagram: generate a clear architecture diagram based on code dependency, such as dependency between modules;
[0139] (2) Class diagram: analyze the class structure of the project through the large model, and automatically generate a relationship diagram of the class, including inheritance, implementation, etc.
[0140] (3) Function dependency flow: extract function call relationships to form a flow-based dependency graph, and intuitively display code execution logic.
[0141] 2. The output of the graphical relationship in JSON format has the following advantages:
[0142] Extensibility support: the generated graphical relationship is represented in JSON format, containing detailed information of each node and connection, facilitating integration with other tools (such as front-end display tools);
[0143] Standardized definition: adopt industry-standard JSON Schema to ensure the universality and compatibility of the output content.
[0144] 3. Fine-grained output control:
[0145] Content integrity: ensure the completeness of each module content in the document, avoiding omission of important information.
[0146] Dynamic update mechanism: when the code or configuration changes, support for regenerating the latest document to keep the content synchronized with the project.
[0147] 4. Engineering platform:
[0148] Graphical tool puzzle: carry architecture diagram, class diagram, function diagram, support users to consult project structure according to dependency relationship and process.
[0149] Based on the same technical concept, the disclosure also proposes a project code processing device 500 based on a large model, as shown in Figure 5 , comprising:
[0150] The construction module 501 is configured to construct first prompt information based on the reference file of the project code; the first prompt information includes content type information to be generated;
[0151] The processing module 502 is configured to input the first prompt information into the large model to obtain output project code information generated for the content type information.
[0152] In some embodiments, when the content type information indicates an interpreted project function, the project code information comprises project function document information.
[0153] When the content type information indicates a dependency relationship, the project code information comprises code reference relationship information.
[0154] In some embodiments, when the content type information indicates the interpreted project function, the first prompt information further comprises document template information and generated document requirement information.
[0155] In some embodiments, the document template information comprises image examples and text examples.
[0156] In some embodiments, the document requirement information comprises at least one of:
[0157] module function information, interface definition information, key algorithm description information, image quality requirement information, image source requirement information, language style information, and project code example information.
[0158] In some embodiments, when the content type information indicates the dependency relationship, the first prompt information comprises category information of the dependency relationship to be extracted and key content information contained in the dependency relationship of each category to be extracted;
[0159] The category information comprises at least one of:
[0160] module dependency relationship information;
[0161] function dependency relationship information.
[0162] In some embodiments, the code reference relationship information is described based on a structured language;
[0163] Further comprising a parsing module, configured to:
[0164] obtain the code reference relationship information expressed by the structured language;
[0165] generate a visual code reference graph based on the code reference relationship information.
[0166] In some embodiments, further comprising an updating module, configured to:
[0167] obtain an incremental update file of the project code;
[0168] obtain second prompt information based on the incremental update file;
[0169] input the second prompt information into the large model to obtain output updated item code information for the content type information.
[0170] In some embodiments, further comprising an optimization module for;
[0171] obtaining a training corpus, wherein the training corpus comprises functional document samples meeting preset requirements;
[0172] obtaining a sample prompt based on the training corpus and a prompt template of the first prompt information;
[0173] inputting the sample prompt into the large model to obtain an output functional document to be optimized;
[0174] comparing the functional document to be optimized with the functional document sample to obtain a comparison result;
[0175] obtaining reconfiguration information according to the comparison result;
[0176] reconfiguring the prompt template according to the reconfiguration information.
[0177] In some embodiments, the functional document sample comprises annotation information of at least two optimization dimensions; and the optimization module is specifically configured to:
[0178] based on the annotation information of the optimization dimension of the functional document to be optimized relative to the functional document sample.
[0179] The specific functions and examples of the modules and sub-modules of the device of the embodiments of the present disclosure are described in the above method embodiments, and will not be described here.
[0180] In the technical solutions of the present disclosure, the acquisition, storage and application of user personal information comply with relevant laws and regulations and do not violate public order and good customs.
[0181] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium and a computer program product.
[0182] Figure 6A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0183] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the device 600 can also be stored in the RAM 603. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0184] Various components in device 600 are connected to I / O interface 605, including an input unit 606, such as a keyboard, mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, optical disk, etc.; and a communication unit 609, such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows device 600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0185] The computing unit 601 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 601 performs various methods and processes described above, such as the large model based project code processing method. For example, in some embodiments, the large model based project code processing method can be implemented as a computer software program tangibly embodied in a machine readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded onto the RAM 603 and executed by the computing unit 601, one or more steps of the large model based project code processing method described above can be performed. Alternatively, in other embodiments, the computing unit 601 can be configured to perform the large model based project code processing method by any other appropriate means, such as by means of firmware.
[0186] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0187] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces a means for implementing the functions / acts specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0188] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0189] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0190] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0191] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0192] It should be understood that the various forms of flow shown above can be used to reorder, add, or remove steps. For example, the steps recited in the present disclosure can be performed in parallel, in series, or in a different order, without limitation herein, so long as the desired results of the technology disclosed in the present disclosure are achieved.
[0193] The specific embodiments discussed above do not constrain the scope of the present disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and alternatives can be made to the specific embodiments without departing from the principles of the present disclosure. Any such modifications, alternatives, and equivalents should be included within the scope of the present disclosure.
Claims
1. A project code processing method based on a large model, comprising: Constructing a first prompt message based on a reference file of the project code; The first prompt information includes information about the type of content to be generated; The first prompt information is input into the large model to obtain the output of the project code information generated for the content type information; Among them, when the large model completes multiple tasks for the reference document, the first prompt information is layered, and the prompt words in each layer are used to process one task; When the generated content types include multiple types, the first level of the first prompt information is used to generate project code information that explains the project function, so that the large model can complete subsequent tasks in sequence based on the project code information that explains the project function and the knowledge learned in previous tasks.
2. The method according to claim 1, wherein In the case where the content type information indicates explaining the function of the project, the project code information includes project function document information; In a case where the content type information indicates a dependency relationship, the project code information includes code reference relationship information.
3. The method according to claim 2, wherein: In the case where the content type information indicates the function of the explanation item, the first prompt information further includes: document template information and generated document requirement information.
4. The method according to claim 3, wherein: The document template information includes an image example and a text example.
5. The method according to claim 3, wherein The document requirement information includes at least one of the following: Module function information, interface definition information, key algorithm description information, image quality requirement information, image source requirement information, language style information, and project code example information.
6. The method according to claim 2, wherein: In the case where the content type information indicates the dependency relationship, the first prompt information includes type information of the dependency relationship to be extracted and key content information contained in each type of dependency relationship to be extracted; The category information includes at least one of the following: Module dependency information; Function dependency information.
7. The method according to claim 2, wherein: The code reference relationship information is described based on a structured language; The method further comprises: Obtaining code reference relationship information expressed in the structured language; Based on the code reference relationship information, a visual code reference graph is generated.
8. The method according to any one of claims 1 to 7, further comprising: Obtaining an incremental update file of the project code; Obtaining second prompt information based on the incremental update file; The second prompt information is input into the large model to obtain output updated project code information for the content type information.
9. The method according to claim 2, further comprising: Obtaining training corpus, wherein the training corpus includes functional document samples that meet preset requirements; Acquire a sample prompt based on the training corpus and the prompt template of the first prompt information; Inputting the sample prompt into the large model to obtain an output function document to be optimized; Comparing the function document to be optimized with the functional document sample to obtain a comparison result; Acquire reconfiguration information according to the comparison result; Reconfigure the prompt template according to the reconfiguration information.
10. The method according to claim 9, wherein: The functional document sample includes annotation information of at least two optimization dimensions; The comparison result includes: annotation information of the dimensions to be optimized based on the functional document to be optimized relative to the functional document sample.
11. A project code processing device based on a large model, comprising: A construction module, configured to construct first prompt information based on a reference file of the project code; The first prompt information includes information about the type of content to be generated; a processing module, configured to input the first prompt information into a large model, and obtain output project code information generated for the content type information; Among them, when the large model completes multiple tasks for the reference document, the first prompt information is layered, and the prompt words in each layer are used to process one task; When the generated content types include multiple types, the first level of the first prompt information is used to generate project code information that explains the project function, so that the large model can complete subsequent tasks in sequence based on the project code information that explains the project function and the knowledge learned in previous tasks.
12. The device according to claim 11, wherein In the case where the content type information indicates explaining the function of the project, the project code information includes project function document information; In a case where the content type information indicates a dependency relationship, the project code information includes code reference relationship information.
13. The device according to claim 12, wherein In the case where the content type information indicates the function of the explanation item, the first prompt information further includes: document template information and generated document requirement information.
14. The device according to claim 13, wherein The document template information includes an image example and a text example.
15. The device according to claim 13, wherein The document requirement information includes at least one of the following: Module function information, interface definition information, key algorithm description information, image quality requirement information, image source requirement information, language style information, and project code example information.
16. The device according to claim 12, wherein In the case where the content type information indicates the dependency relationship, the first prompt information includes type information of the dependency relationship to be extracted and key content information contained in each type of dependency relationship to be extracted; The category information includes at least one of the following: Module dependency information; Function dependency information.
17. The device according to claim 12, wherein The code reference relationship information is described based on a structured language; Also includes parsing modules for: Obtaining code reference relationship information expressed in the structured language; Based on the code reference relationship information, a visual code reference graph is generated.
18. The apparatus according to any one of claims 11 to 17, further comprising an updating module, configured to: Obtaining an incremental update file of the project code; Obtaining second prompt information based on the incremental update file; The second prompt information is input into the large model to obtain output updated project code information for the content type information.
19. The apparatus according to claim 12, further comprising an optimization module for: Obtaining training corpus, wherein the training corpus includes functional document samples that meet preset requirements; Acquire a sample prompt based on the training corpus and the prompt template of the first prompt information; Inputting the sample prompt into the large model to obtain an output function document to be optimized; Comparing the function document to be optimized with the functional document sample to obtain a comparison result; Acquire reconfiguration information according to the comparison result; Reconfigure the prompt template according to the reconfiguration information.
20. The device according to claim 19, wherein The functional document sample includes annotation information of at least two optimization dimensions; the optimization module is specifically configured to: Based on the annotation information of the dimensions to be optimized of the functional document to be optimized relative to the functional document sample.
21. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-10.
23. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Code processing method and system and electronic equipment
CN117130593A
Code review method and system
CN118349454A