Project code processing method and device based on large model, and related equipment
Through the project code processing method based on the big model, prompt information is constructed and input the big model to generate project code information, which solves the problems of project code complexity and analysis difficulty, and improves the efficiency and accuracy of code analysis.
Patent Information
- Application Number
- CN202411815006.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-10
AI Technical Summary
In the field of software development, the complexity of project code and the increase in code volume make code analysis extremely complex and time-consuming, especially for code without relevant instructions.
Using a large-model-based project code processing method, the first prompt information, including the content type information to be generated, is input to the large model to generate project code information for the content type information.
Improves the accuracy of project code information and the efficiency of code analysis, helps developers quickly understand project code, and significantly improves the speed of new developers to get started.
Smart Images

Figure CN119781823A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to technical fields such as deep learning and large models. Background Art
[0002] In the field of software development, due to the complexity of projects and the extension of development cycles, the amount of project code is increasing and the complexity is getting higher and higher. Especially for the code without relevant instructions in the long-term development process, analyzing the project code is an extremely complex and time-consuming task. Summary of the invention
[0003] The present invention provides a project code processing method, apparatus, and related equipment based on a large model.
[0004] According to one aspect of the present disclosure, a project code processing method based on a large model is provided, comprising:
[0005] Constructing first prompt information based on the reference file of the project code; the first prompt information includes the type information of the content to be generated;
[0006] The first prompt information is input into the large model to obtain output project code information generated for the content type information.
[0007] According to another aspect of the present disclosure, there is provided a project code processing device based on a large model, comprising:
[0008] A construction module, configured to construct first prompt information based on a reference file of the project code; the first prompt information includes information on the type of content to be generated;
[0009] The processing module is used to input the first prompt information into the large model to obtain output project code information generated for the content type information.
[0010] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[0011] at least one processor; and
[0012] a memory communicatively connected to the at least one processor; wherein,
[0013] 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 execute any method in 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 enable the computer to execute any method according to the embodiments of the present disclosure.
[0015] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements any method according to the embodiments of the present disclosure when executed by a processor.
[0016] In the disclosed embodiment, by utilizing the strong reasoning and understanding capabilities of the large model for documents, the project code can be deeply analyzed by reference, and the project code information can be automatically generated, which can improve the accuracy of the project code information and the efficiency of code analysis.
[0017] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0019] Figure 1 is a flowchart of a project code processing method based on a large model according to an embodiment of the present disclosure;
[0020] Figure 2 is a schematic diagram of a visualization interface diagram according to an embodiment of the present disclosure;
[0021] Figure 3 is another flowchart of a method for processing project codes based on a large model according to an embodiment of the present disclosure;
[0022] Figure 4 is another flowchart of a project code processing method based on a large model according to an embodiment of the present disclosure;
[0023] Figure 5 is a structural schematic diagram of a project code processing device based on a large model according to an embodiment of the present disclosure;
[0024] Figure 6 It is a block diagram of an electronic device used to implement the large model-based project code processing method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0026] The terms "first", "second", etc. in this disclosure are used to distinguish similar objects, and are not necessarily used to describe a specific order or precedence. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, including a series of steps or units. The method, system, product or device is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[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 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 content type information 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] Among them, the configuration file is used to parse the key configuration in the project code. Exemplarily, the configuration file can be readme (read my document), info (information document), etc. Among them, Readme is used to describe the information of the project code to help the big model quickly understand the project content. Info is used to obtain an overview of the relevant information of the project code. Exemplarily, Info includes but is not limited to the number of rows, the number of columns, the column index, the number of non-null values in the column, the column type, the memory usage, etc.
[0031] The index file includes the libraries that the project code depends on and their versions.
[0032] S102, inputting the first prompt information into the large model, and obtaining output project code information generated for the content type information.
[0033] The project code information is used to describe the functions of the project code and / or the dependencies in the code.
[0034] Among them, the large model can be a large language model (LLMs). Large language models refer to a specific type of large model that is specifically used to process text data. This type of model is a natural language processing model based on a neural network, which 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, dialogue systems, etc.
[0035] The large language model has good reasoning ability and small sample learning ability. The large language model can understand the model on a large scale 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 may also be a multimodal large language model (MLLM), so as to process the multimodal information provided by the first prompt information to generate multimodal project code information.
[0037] In the disclosed embodiment, the first prompt information is constructed based on the reference file of the project code, so that the big model can perform the code analysis task based on the first prompt information and conduct a comprehensive analysis of the reference file of the project code. In the disclosed embodiment, the big model's strong reasoning and understanding ability of documents can be used to conduct an in-depth analysis of 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] Among them, project code information can help developers quickly understand the project code and significantly improve the speed at which new developers can get started. The large model can automatically maintain relevant explanations of the project code.
[0039] In some embodiments, before the project code is input into the large model, the project code may be preprocessed, including but not limited to clearing extra blank lines and redundant information in the project code.
[0040] Exemplary methods may include indentation normalization, deletion of redundant comments, etc. Based on this approach, the code style can be unified, making the large model reasoning process more accurate.
[0041] In addition, when the scale of the project code is too large, it can be divided into multiple sub-project codes according to the internal modules. Multiple sub-project codes are sequentially input into the large model for processing to obtain sub-project code information corresponding to each sub-project code, and the multiple sub-project code information is re-input into the large model, so that the large model can infer the logical relationship between the multiple sub-project code information, and then obtain the final project code information.
[0042] In some embodiments, in order to obtain the internal logic in the project code, the big model can call relevant tools to perform syntax analysis or semantic understanding on the project code. The combination of the two lays the foundation for the reasoning process of the big model. Among them, syntax analysis is used to parse the syntax tree of the project code and extract basic structural information. Among them, semantic understanding is used to deeply understand the function, logic flow, and data flow in the project code.
[0043] Among them, the syntax analysis of the project code can be realized by using the compiler tool chain. An exemplary compiler tool chain may be ANTLR (ANother Tool for Language Recognition, a cross-language syntax parser). Other tools that can perform semantic understanding may be applicable to the embodiments of the present disclosure, and the embodiments of the present disclosure are not limited to this.
[0044] The semantic understanding of project code is achieved through CodeBERT (A Pre-Trained Model for Programming and Natural Languages).
[0045] In addition, in the embodiments of the present disclosure, since the big model is compatible with multiple languages and frameworks (such as Java, Python, JavaScript, etc.), the key structure of the project code can be extracted through parsers corresponding to multiple languages, and then input into the big model, so that the big model can subsequently deeply understand the code reference relationship.
[0046] In some embodiments, the big model can generate project code information with different focuses based on different content types. Where 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. Project function document information directly affects the success rate of the project and the long-term maintainability of the software product. As a medium of communication, it can help team members, stakeholders, and future maintainers understand the goals, requirements, design, and implementation details of the project.
[0047] In the case where the content type information indicates a dependency relationship, the project code information includes code reference relationship information. The code reference relationship information is used to describe the reference graph of modules, classes, functions, etc. in the project code.
[0048] In the disclosed embodiment, the project function document information can help developers quickly understand the functions of the code, and the code reference relationship information provides a clear code dependency relationship, which can help developers sort out the code architecture, facilitate developers to divide the modules and collaborate, reduce the operational complexity of code development and maintenance, and improve development efficiency.
[0049] In some embodiments, when the content type information indicates explaining the function of the item, the first prompt information also 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 core modules included.
[0051] Document requirement information is used to standardize the content that the project code information needs to focus on generating.
[0052] In the disclosed embodiment, document template information and document requirement information are used to limit the output project code information within the template to avoid the large model outputting irrelevant content or hallucinations. At the same time, standardized document requirements are used to further improve the accuracy of the content output by the large model.
[0053] In some embodiments, the document template information includes image examples and text examples.
[0054] Among them, the text examples in the document are used to explain the project code functions. Even for key functions, text can be used to explain the code logic of key functions. Using image examples together with text examples for understanding can intuitively understand the function description or key logic.
[0055] In the disclosed embodiment, the combination of text and graphics can improve the detailed and rich content of the generated project function document information, and improve the accuracy and readability of the generated project function document information.
[0056] In some embodiments, the document requirements include 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] Among them, module function information is used to describe the main functions and uses of each module in the project code.
[0058] Interface definition information is used to describe the input and output parameter descriptions, calling conditions, and return value types in the project code.
[0059] Key algorithm description information is used to provide detailed text descriptions and code implementation examples for the core algorithms in the project code.
[0060] Image quality requirement information can be flexibly defined according to actual conditions, for example, image quality, image size, image format, etc. can be required.
[0061] Image source requirement information is used to require that the image source be included in the reference file. It can be understood as the need to restrict the image to the reference file rather than generating the image arbitrarily, so as to limit the output range of the image and avoid hallucinations or inaccurate expressions in large models.
[0062] Language style information is used to restrict the language of the generated project code information. For example, the project function document information is an objective and realistic document, so the language style can be required to be a narrative method that emphasizes science thinking rather than liberal arts thinking. In specific implementation, the project function document can be required to avoid using metaphors, parallelism, and exaggeration as much as possible. Generate project function document information in the spirit of pursuing objective facts.
[0063] Project code example information, used to describe the circumstances under which the project code is used and to provide key code source code.
[0064] During implementation, when the content type is to explain the project function and focuses on module function information and key algorithm description information, the document requirements included in the first prompt information may be, for example:
[0065] "Please generate project code information for this project code that explains the project's functionality:
[0066] 1. Briefly describe the overall goals 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 text descriptions of the core algorithms in the project code. Provide detailed text descriptions of the core algorithms in the project code.
[0069] It is understandable that the specific items required by the above document can be defined and explained in the first prompt information respectively, so that the large model can accurately understand the requirements of the task.
[0070] Of course, the aforementioned document requirements are only for illustrative purposes. If the generated project code information requires other requirements, the first prompt information can be optimized according to the needs.
[0071] The disclosed embodiments improve the accuracy of a large model in understanding task requirements by accurately describing document requirements, thereby improving the accuracy of sorting out the content required for project functional document information in a large reference file, and further improving the accuracy of generated project functional document information.
[0072] In some embodiments, when the content type information indicates a 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;
[0073] The type information includes at least one of the following:
[0074] Module dependency information;
[0075] Function dependency information.
[0076] Among them, module dependency information can be used to generate an architecture diagram based on the project code.
[0077] 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 category information may also include class dependencies, which are used to generate a reference relationship graph of classes in the same module based on the class structure in the project code.
[0079] Based on the above dependencies, a process-based dependency graph can be formed.
[0080] During implementation, each project code can be divided into at least one module, and the module dependency relationship indicates the dependency between each module in the project code. For example, module A needs to be dependent on module B to run. 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 first prompt information requires that the types of dependencies to be extracted include module dependency information, class dependency information, and function dependency information, the visualization interface diagram is exemplarily as follows Figure 2 As shown, the module dependency 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. Click module C to view the class dependency information under the module. Class A depends on class B and class C, and class C depends on class D. Click class D to view the function dependency information under the class. Function B and function D depend on function A.
[0082] In addition, the first prompt information may also include a constraint description of key content, so that the large model can capture the key content, for example:
[0083] "Generate class dependencies for project code:
[0084] Make sure the class dependencies include:
[0085] 1. The name of each class, all its properties and methods.
[0086] 2. The inheritance relationship and association relationship between classes (such as combination, aggregation, etc.). At the same time, generate the function dependency path, requiring:
[0087] (1) Specify the entry function and all downstream functions it calls.
[0088] (2) Includes the parameter and return value types of each function.
[0089] 3. Ensure that the output content format is clear and complete, without missing any key points. "
[0090] In the disclosed embodiment, the type of dependency relationship to be extracted is clarified based on the first prompt information, and the accuracy of the large model understanding task requirement can be improved to improve 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 follows: 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 may be JSON, and the large model may analyze the code reference relationship based on the first prompt information output, and then use JSON to describe the reference relationship. Then, the code reference relationship may be parsed with the help of a JSON language converter, and then converted into a visual code reference graph.
[0093] In the disclosed embodiment, the strong reasoning ability of the large model is used to perform in-depth analysis on the project code, so that the code reference relationship of the project code can be understood and a visual code reference graph can be obtained to help developers quickly understand the code architecture and improve the user experience.
[0094] The large model needs to complete multiple tasks for the reference files of the project code. In this case, the first prompt information can be layered, and the prompt words in each layer are used to process a task. Exemplary, when the types of content to be generated include information explaining project functions, module dependency information, class dependency information, and function dependency information. The first level of the first prompt information is used to generate project code information that explains project functions. Based on the aforementioned generation of project code information with explanation of project functions, the large model uses the knowledge learned in previous tasks to better complete subsequent tasks in sequence.
[0095] In some embodiments, dynamic updating of project code information can also be supported. For example, since the production cycle of project code is long, there may be updates to the project code during this period. In this case, the embodiment of the present disclosure can update the generated project code information based on the large model. Figure 3 As shown, it can be implemented as:
[0096] S301, obtaining an incremental update file of the project code.
[0097] Among them, the incremental update file is the part of the project code that has been adjusted.
[0098] S302: Obtain second prompt information based on the incremental update file.
[0099] In addition to the code part that needs to be incrementally updated, the second prompt information also needs to clarify that the task type is to update the project code information based on the incrementally updated code part, so that the large model can use the knowledge learned from the previously generated project code information to dynamically update it.
[0100] S303, input the second prompt information into the large model, and obtain output updated project code information for the content type information.
[0101] During implementation, historical project code information also needs to be input into the big model, and the big model updates the entire project code information in combination with the historical project code information.
[0102] In the disclosed embodiment, the project code information can be dynamically and automatically updated according to the latest status of the project code, and the project code information can be synchronously updated with the iterative update of the project to improve the match between the project code information and the actual situation, thereby further improving the user experience.
[0103] In some embodiments, in order to further improve the accuracy of the project code information output by the large model, such as Figure 4 As shown, the prompt template of the first prompt information may also be optimized based on the following method;
[0104] S401, obtaining training corpus, where the training corpus includes functional document samples that meet preset requirements.
[0105] Among them, excellent project documents (such as functional descriptions, technical architectures, model dependency diagrams, class dependency diagrams, function dependency diagrams, etc.) can be collected and analyzed as targeted training corpora to provide high-quality reference standards for large models.
[0106] By annotating the document structure, language style, and content details in the training corpus, the project code information generated by the large model can be matched with expectations.
[0107] The annotation of the detailed content can be exemplified by the following aspects:
[0108] (a) Information coverage refers to the description of all major modules and functions required by the project code.
[0109] Examples include, but are not limited to, system goals and functions, inputs, outputs, core algorithms or logic of each module, interactions between key modules, and not omitting important dependency information, such as the role of configuration files, dependent libraries and versions, etc.
[0110] (b) Hierarchical Description
[0111] The content is layered and gradually unfolds from macro to micro.
[0112] Overall description: system architecture, design goals, and division of main functional modules.
[0113] Module-level description: module functionality, interface definition, dependencies.
[0114] Detailed description: class dependencies, function dependencies, and specific implementation logic.
[0115] (c) Use case coverage
[0116] Provide specific usage scenarios or cases to help developers understand how the document content is applied in actual operations.
[0117] (d) Additional details
[0118] How to handle project code information in 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 annotation of the training corpus can be determined based on the actual situation, and the embodiments of the present disclosure will not be described in detail here.
[0120] S402, acquiring a sample prompt based on the prompt template of the training corpus and the first prompt information.
[0121] The method of constructing the sample prompt is similar to the method of constructing the first prompt information, and the embodiment of the present disclosure will not be repeated here.
[0122] S403, input the sample prompt into the large model to obtain the output function document to be optimized.
[0123] S404: Compare the function document to be optimized with the functional document sample to obtain a comparison result.
[0124] The functional document sample includes annotation information of multiple optimization dimensions. The specific annotation information has been described above.
[0125] The functional document to be optimized is compared with the functional document sample to obtain a comparison result, which is specifically implemented as follows: the comparison result includes: annotation information of the dimension to be optimized based on the functional document to be optimized relative to the functional document sample.
[0126] During implementation, it is necessary to locate the content that needs to be optimized in the prompt information based on the dimensions that need to be optimized of the function document to be optimized relative to the functional document, and then optimize the prompt information. The dimensions that need to be optimized are the dimensions that need to be optimized among multiple known optimization dimensions.
[0127] For example, when a class dependency graph needs to be generated but is not generated, you can check whether the sample prompt contains constraints and instructions for generating the class dependency graph. If not, add them to the corresponding position. If so, you can modify the description method to make the generated dependency graph more standardized and accurate.
[0128] In the disclosed embodiments, by comparing the functional document to be optimized and the functional document sample generated by the large model, the dimension to be optimized of the functional document to be optimized can be accurately and quickly determined, and through the annotation information corresponding to the dimension to be optimized, the deficiency of the prompt information can be clearly pointed out, thereby improving the accuracy of determining the optimization direction, so as to facilitate the iterative update of the prompt template, and further improve the accuracy of the project code information generated by the large model.
[0129] S405: Obtain reconfiguration information according to the comparison result.
[0130] The reconfiguration information is the information in the prompt information that needs to be optimized.
[0131] S406: Reconfigure the prompt template according to the reconfiguration information.
[0132] In the disclosed embodiment, the large model is trained using excellent training corpus, which can provide the large model with a high-quality reference standard so that the large model can learn better sample data. At the same time, the generated functional document to be optimized is compared with the functional document sample to obtain clear reconfiguration information, thereby improving the accuracy of the large model generation process.
[0133] In summary, based on the large model and corresponding prompt information, the project code analysis method provided by the embodiment of the present disclosure has the following advantages:
[0134] 1. Comprehensive document generation, including:
[0135] Project functional documentation: For the functional modules of the project, the focus includes input, output, interaction process, etc., and the functional introduction of the functional modules. Among them, the functional introduction of the functional modules can help users and developers understand the functions and responsibilities of each module. Combined with the interaction process, they can better understand the workflow and architecture of the entire system. The input and output of the functional modules can facilitate the maintenance and expansion of functions. When problems arise, it can also help developers quickly locate the problem, thereby speeding up the diagnosis and resolution process of the problem. In large projects, different teams may be responsible for different functional modules. The description of the functional modules can help teams communicate and collaborate better. Therefore, the project functional documentation can improve the user experience.
[0136] Code reference diagram: It can be based on the output system architecture description, covering component division, dependencies, deployment plans, etc., to help developers quickly understand the project.
[0137] Code reference graphs may include:
[0138] (1) Engineering sub-component architecture diagram: Generate a clear architecture diagram based on code dependencies, such as dependencies between modules;
[0139] (2) Class diagram: Analyze the class structure of the project through the large model and automatically generate the class relationship diagram, including inheritance, implementation and other information;
[0140] (3) Function dependency flow: Extract function call relationships, form a process-based dependency graph, and intuitively display the code execution logic.
[0141] 2.Graphical relationship output in JSON format, its advantages include:
[0142] Scalability support: The generated diagram relationships are expressed in JSON format, containing detailed information about each node and connection, making it easy to connect with other tools (such as front-end display tools);
[0143] Standardized definition: Adopt the industry-wide JSON Schema to ensure the universality and compatibility of the output content.
[0144] 3. Refined output control:
[0145] Content completeness: Ensure that the content of each module in the document is complete to avoid missing important information.
[0146] Dynamic update mechanism: When the code or configuration changes, it supports regenerating the latest document to keep the content synchronized with the project.
[0147] 4. Engineering platform:
[0148] Graphical tool puzzle: carries architecture diagrams, class diagrams, and function diagrams, and supports users to view project structures according to dependencies and processes.
[0149] Based on the same technical concept, the present disclosure also proposes a project code processing device 500 based on a large model, such as Figure 5 As shown, including:
[0150] A construction module 501 is used to construct first prompt information based on a reference file of the project code; the first prompt information includes content type information to be generated;
[0151] The processing module 502 is used 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, in the case where the content type information indicates explaining the function of the project, the project code information includes project function document information;
[0153] In the case where the content type information indicates a dependency relationship, the project code information includes code reference relationship information.
[0154] In some embodiments, when the content type information indicates the function of the interpretation item, the first prompt information also includes: document template information, and generated document requirement information.
[0155] In some embodiments, the document template information includes image examples and text examples.
[0156] In some embodiments, the document requirement information includes at least one of the following:
[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 includes type information of the dependency relationship to be extracted and key content information contained in each type of dependency relationship to be extracted;
[0159] The type information includes at least one of the following:
[0160] Module dependency information;
[0161] Function dependency information.
[0162] In some embodiments, the code reference relationship information is described based on a structured language;
[0163] Also includes parsing modules for:
[0164] Obtaining code reference relationship information expressed by the structured language;
[0165] Based on the code reference relationship information, a visual code reference graph is generated.
[0166] In some embodiments, an update module is further included, which is used to:
[0167] Obtaining an incremental update file of the project code;
[0168] Acquire second prompt information based on the incremental update file;
[0169] The second prompt information is input into the large model to obtain output updated project code information for the content type information.
[0170] In some embodiments, an optimization module is further included for:
[0171] Acquire training corpus, wherein the training corpus includes functional document samples that meet preset requirements;
[0172] Acquire a sample prompt based on the training corpus and the prompt template of the first prompt information;
[0173] Inputting the sample prompt into the large model to obtain an output function document to be optimized;
[0174] Comparing the function document to be optimized with the functional document sample to obtain a comparison result;
[0175] Acquire reconfiguration information according to the comparison result;
[0176] Reconfigure the prompt template according to the reconfiguration information.
[0177] In some embodiments, the functional document sample includes annotation information of at least two optimization dimensions; the optimization module is specifically used to:
[0178] Based on the annotation information of the dimension to be optimized of the functional document to be optimized relative to the functional document sample.
[0179] For the description of specific functions and examples of each module and submodule of the device in the embodiment of the present disclosure, reference can be made to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0180] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0181] According to an embodiment of the present disclosure, the present disclosure also 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 an embodiment 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, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required 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. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. 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] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0185] The computing unit 601 may be a variety of general and / or special 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 dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as a project code processing method based on a large model. For example, in some embodiments, the project code processing method based on a large model may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the project code processing method based on the large model described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the large model-based project code processing method in any other appropriate manner (eg, by means of firmware).
[0186] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0187] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0188] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0189] To provide interaction with a user, the systems and techniques described herein 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 pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 input, voice input, or tactile input).
[0190] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may 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] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may 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 processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0193] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A project code processing method based on a large model, comprising: A first prompt message is constructed based on a reference file of the project code; The first prompt information includes the type information of the content to be generated; The first prompt information is input into the large model to obtain output project code information generated for the content type information.
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 the 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 various types of dependency relationships to be extracted; The type 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 by 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; Acquire 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: Acquire 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 dimension 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, used for constructing first prompt information based on a reference file of the project code; The first prompt information includes the type information of the content to be generated; The processing module is used to input the first prompt information into the large model to obtain output project code information generated for the content type information.
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 the 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 various types of dependency relationships to be extracted; The type 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 by 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; Acquire 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: Acquire 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 used to: Based on the annotation information of the dimension 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
Code auditing method, system and equipment based on GitLab and medium
CN118585451A
Transaction process processing method and system based on large model
CN118672735A
Code generation method and device, electronic equipment and storage medium
CN118963739A
Cited By
Target embedded code generation method and device, electronic equipment and storage medium
CN120704694A