Service execution method and device, storage medium and electronic equipment

By using a large language model to convert applications written in interpreted languages ​​into efficient programming languages, the problem of inefficiency in the existing technology is solved, and fast and efficient application rewriting and business execution are achieved.

CN119166122AInactive Publication Date: 2024-12-20广州三七极耀网络科技有限公司

Patent Information

Application Number
CN202411338569.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2024-12-20
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Applications written in existing interpreted languages ​​are difficult to meet efficiency requirements when users' business needs increase, and rewriting applications takes a long time and inefficient time.

Method used

By obtaining the source code files and target programming language information of the application to be adjusted, determining the program framework and original programming language information under the target programming language, and using a large language model to convert the source code files and target prompt statements into the code of the target programming language. Generates tweaked applications.

Benefits of technology

This greatly improves the efficiency of application rewriting, reduces the time required, and enables more efficient business execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166122A_ABST
    Figure CN119166122A_ABST
Patent Text Reader

Abstract

The invention discloses a service execution method and device, a storage medium and electronic equipment, a server obtains a source code file of a to-be-adjusted application program, determines a target programming language which the to-be-adjusted application program needs to be converted into, then determines a program framework adopted by the to-be-adjusted application program under the target programming language, and sends the program framework to the server; according to the target programming language information and the original programming language information corresponding to the to-be-adjusted application program, determining a target prompt statement according to the target programming language information and the original programming language information, and then inputting the target prompt statement and the source code file into a preset large language model so as to adjust the to-be-adjusted application program through the large language model. And obtaining a code of the to-be-adjusted application program in the target programming language according to the target programming language, obtaining an adjusted application program according to the obtained code and the program framework, and executing a service according to the adjusted application program. The application program is rewritten through the large language model, compared with manual writing, the needed time is shortened, and the efficiency of rewriting the application program is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present specification relates to the field of computers, and in particular to a service execution method, device, storage medium, and electronic device. Background Art

[0002] With the continuous development of computer technology, more and more network services are provided to users, for example, providing data query for users, assisting users in processing order data, or providing game services for users.

[0003] Nowadays, there are a large number of applications for providing network services, and most of them are written in interpreted languages. In the past, applications written in interpreted languages ​​such as PHP (Hypertext Preprocessor) could complete user requests well when the number of concurrent user requests was small. However, as the number of user business demands increases, applications written in PHP are gradually unable to meet user needs.

[0004] In order to improve the data processing capability of the application, currently, the technical personnel rewrite the application in a more efficient programming language to obtain an application with the same service type but higher efficiency. However, the rewriting takes too long and the efficiency of manual writing is low, which is unacceptable to the service providers. That is, the current method of rewriting the application takes a long time and is inefficient.

[0005] Therefore, how to improve the efficiency of application rewriting is an urgent problem to be solved. Summary of the invention

[0006] This specification provides a service execution method, device, storage medium and electronic device to partially solve the above-mentioned problems existing in the prior art.

[0007] This manual adopts the following technical solutions:

[0008] This specification provides a service execution method, including:

[0009] Acquire a source code file and target programming language information of the application to be adjusted, wherein the target programming language information is used to indicate the programming language into which the application to be adjusted needs to be converted;

[0010] Determine a program framework adopted by the application program to be adjusted in the target programming language corresponding to the target programming language information;

[0011] Determine programming language information corresponding to the programming language used to write the application to be adjusted as original programming language information, and determine a target prompt statement according to the target programming language information and the original programming language information;

[0012] Inputting the source code file and the target prompt statement into a preset large language model, so as to obtain the code of the application to be adjusted in the target programming language through the large language model;

[0013] An adjusted application is obtained according to the code and the program framework, and business is executed according to the adjusted application.

[0014] Optionally, before the step of determining a target prompt statement according to the target programming language information and the original programming language information, the method further includes:

[0015] Determine a file directory of the source code file, and determine each subfile included in the source code file according to the file directory;

[0016] The step of determining a target prompt statement according to the target programming language information and the original programming language information specifically includes:

[0017] For each sub-file included in the source code file, a target prompt statement for the sub-file is determined according to the target programming language information and the original programming language information.

[0018] Optionally, the step of inputting the source code file and the target prompt statement into a preset large language model to obtain the code of the application to be adjusted in the target programming language through the large language model specifically includes:

[0019] For each sub-file included in the source code file, the sub-file and the target prompt statement corresponding to the sub-file are input into the large language model, so as to obtain the code of the sub-file in the target programming language through the large language model as the converted code corresponding to the sub-file;

[0020] The step of obtaining the adjusted application program according to the code and the program framework specifically includes:

[0021] According to the converted code corresponding to each sub-file and the program framework, an adjusted application program is obtained.

[0022] Optionally, for each sub-file included in the source code file, inputting the sub-file and a target prompt statement corresponding to the sub-file into the large language model, so as to obtain the code of the sub-file in the target programming language through the large language model as the converted code corresponding to the sub-file, specifically includes:

[0023] For each sub-file included in the source code file, when the sub-file is a business logic file for processing data, the sub-file and the target prompt statement corresponding to the sub-file are input into the large language model, so as to obtain the database index and data table name corresponding to the sub-file through the large language model;

[0024] The generation instruction of the program framework is called to generate the converted code corresponding to the sub-file according to the database index and the data table name corresponding to the sub-file.

[0025] Optionally, the step of determining a program framework adopted by the application program to be adjusted in the target programming language corresponding to the target programming language information specifically includes:

[0026] Determining the original program framework adopted by the application to be adjusted;

[0027] The framework code corresponding to the original program framework and the framework generation prompt statement are input into a preset framework generation model, so that the framework generation model adjusts the framework code corresponding to the original program framework according to the framework generation prompt statement to obtain the program framework adopted by the application to be adjusted under the target programming language. The framework generation prompt statement is used to prompt the framework generation model to generate a program framework applicable to the target programming language.

[0028] Optionally, the step of determining a target prompt statement according to the target programming language information and the original programming language information specifically includes:

[0029] Identifying the target programming language to determine a target keyword corresponding to the target programming language, and identifying the original programming language to determine an original keyword corresponding to the original programming language;

[0030] Determine an initial prompt sentence according to the target keyword and the original keyword;

[0031] Determining program indicator data required for the application program to be adjusted in the target programming language;

[0032] The initial prompt statement is adjusted according to the program indicator data to obtain a target prompt statement.

[0033] Optionally, the method further comprises:

[0034] Collecting actual index data when the adjusted application program executes a service, wherein the actual index data is used to characterize the actual efficiency when the service is executed by the adjusted application program;

[0035] Inputting the actual indicator data, the expected indicator data, and the source code file corresponding to the adjusted application into the large language model, so that the large language model adjusts the source code file corresponding to the adjusted application according to the deviation between the expected indicator data and the actual indicator data, so as to obtain a target application;

[0036] A service is executed according to the target application.

[0037] This specification provides a service execution device, including:

[0038] An acquisition module: used to acquire a source code file of the application to be adjusted and target programming language information, wherein the target programming language information is used to indicate the programming language into which the application to be adjusted needs to be converted;

[0039] A first determination module: used to determine the program framework adopted by the application program to be adjusted in the target programming language corresponding to the target programming language information;

[0040] A second determination module is used to determine programming language information corresponding to the programming language used to write the application to be adjusted as original programming language information, and determine a target prompt statement according to the target programming language information and the original programming language information;

[0041] Input module: used for inputting the source code file and the target prompt statement into a preset large language model, so as to obtain the code of the application to be adjusted in the target programming language through the large language model;

[0042] Execution module: used to obtain an adjusted application program according to the code and the program framework, and execute business according to the adjusted application program.

[0043] Optionally, the device further comprises:

[0044] A third determining module is used to determine a file directory of the source code file, and determine each sub-file included in the source code file according to the file directory;

[0045] The step of determining a target prompt statement according to the target programming language information and the original programming language information specifically includes:

[0046] For each sub-file included in the source code file, a target prompt statement for the sub-file is determined according to the target programming language information and the original programming language information.

[0047] Optionally, the third determining module is specifically configured to:

[0048] For each sub-file included in the source code file, the sub-file and the target prompt statement corresponding to the sub-file are input into the large language model, so as to obtain the code of the sub-file in the target programming language through the large language model as the converted code corresponding to the sub-file;

[0049] The step of obtaining the adjusted application program according to the code and the program framework specifically includes:

[0050] According to the converted code corresponding to each sub-file and the program framework, an adjusted application program is obtained.

[0051] Optionally, the third determining module is specifically configured to:

[0052] For each sub-file contained in the source code file, when the sub-file is a business logic file for processing data, the sub-file and the target prompt statement corresponding to the sub-file are input into the large language model to obtain the database index and data table name corresponding to the sub-file through the large language model; the generation instruction of the program framework is called to generate the converted code corresponding to the sub-file according to the database index and data table name corresponding to the sub-file.

[0053] Optionally, the first determining module is specifically configured to:

[0054] Determine the original program framework adopted by the application to be adjusted; input the framework code corresponding to the original program framework and the framework generation prompt statement into a preset framework generation model, so that the framework generation model adjusts the framework code corresponding to the original program framework according to the framework generation prompt statement to obtain the program framework adopted by the application to be adjusted in the target programming language, and the framework generation prompt statement is used to prompt the framework generation model to generate a program framework applicable to the target programming language.

[0055] Optionally, the second determining module is specifically configured to:

[0056] The target programming language is identified to determine the target keyword corresponding to the target programming language, and the original programming language is identified to determine the original keyword corresponding to the original programming language; an initial prompt statement is determined according to the target keyword and the original keyword; program indicator data required for the application to be adjusted under the target programming language is determined; and the initial prompt statement is adjusted according to the program indicator data to obtain a target prompt statement.

[0057] Optionally, the device further comprises:

[0058] The adjustment module is used to collect actual indicator data when the adjusted application executes business, and the actual indicator data is used to characterize the actual efficiency when the business is executed by the adjusted application; input the actual indicator data, expected indicator data and the source code file corresponding to the adjusted application into the large language model, so that the large language model adjusts the source code file corresponding to the adjusted application according to the deviation between the expected indicator data and the actual indicator data to obtain a target application; and execute business according to the target application.

[0059] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned service execution method is implemented.

[0060] This specification provides an electronic device, including a processor and a computer program stored in a memory and executable on the processor, wherein the processor implements the above-mentioned service execution method when executing the program.

[0061] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:

[0062] In the business execution method provided in this specification, the server obtains the source code file of the application to be adjusted, and determines the target programming language that the application to be adjusted needs to be converted into, and then determines the program framework used by the application to be adjusted in the target programming language, and the original programming language information corresponding to the application to be adjusted, and determines the target prompt statement according to the target programming language information and the original programming language information, and then inputs the target prompt statement and the source code file into the preset large language model, so as to obtain the code of the application to be adjusted in the target programming language through the large language model, so as to obtain the adjusted application according to the obtained code and program framework, and execute the business according to the adjusted application. Rewriting the application through the large language model reduces the time required compared to manual writing, and greatly improves the efficiency of rewriting the application. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0064] Figure 1 A flowchart of a business execution method provided in this manual;

[0065] Figure 2 A schematic diagram of a file directory of different codes provided for this manual;

[0066] Figure 3 A schematic diagram of the structure of a service execution device provided in this specification;

[0067] Figure 4 A method provided in this specification corresponding to Figure 1 Schematic diagram of the structure of an electronic device. DETAILED DESCRIPTION

[0068] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0069] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0070] Figure 1 A flowchart of a business execution method provided in this specification includes:

[0071] S101: Acquire a source code file and target programming language information of an application to be adjusted, where the target programming language information is used to indicate a programming language into which the application to be adjusted needs to be converted.

[0072] The execution subject of a service execution method provided in this specification can be a terminal device such as a laptop computer, a desktop computer, or a client installed in the terminal device, or a server. For the sake of ease of description, the following only takes the execution subject as an example to illustrate a service execution method provided in this specification.

[0073] At present, as the demand for user services increases, service providers that provide network services to users have the need to tune applications. However, manual tuning of applications, especially those with more complex functions, is an extremely time-consuming and labor-intensive process.

[0074] As the computer field continues to develop, a variety of programming languages ​​have emerged, including some concise and efficient programming languages ​​such as Go (Golang). Therefore, when there is a need for application tuning, service providers need to use more efficient programming languages ​​to rewrite applications to obtain a more efficient application, thereby improving the user's business execution efficiency based on the rewritten application. However, currently, applications can only be rewritten manually by technicians, and their writing efficiency is often low.

[0075] Based on this, this specification provides a business execution method. After the server obtains the source code file of the application to be adjusted and the target programming language information used to represent the programming language that the application to be adjusted needs to be converted into, the server can convert the application to be adjusted to obtain an adjusted application whose programming language is different from that of the application to be adjusted and has higher efficiency, and the server can execute business based on the adjusted application.

[0076] The application to be adjusted is the original application that needs to be rewritten. The following takes the original programming language corresponding to the application to be adjusted as PHP (Hypertext Preprocessor), the source code file directory as demo.com, and the programming language corresponding to the application to be adjusted to be converted into Go as an example to illustrate the adjustment process of the application to be adjusted.

[0077] S102: Determine a program framework adopted by the application program to be adjusted in the target programming language corresponding to the target programming language information.

[0078] S103: Determine programming language information corresponding to the programming language used to write the application to be adjusted as original programming language information, and determine a target prompt statement according to the target programming language information and the original programming language information.

[0079] After determining the source code file and target programming language information of the application to be adjusted, the server needs to determine the program framework adopted by the application to be adjusted after the adjustment, that is, the program framework adopted by the application to be adjusted under the target programming language corresponding to the target programming language information. The program framework provides a set of predefined code storage structures, libraries and tools for improving software development efficiency. This manual uses the Go language as the target programming language, and the program framework adopted by the application to be adjusted after the adjustment is GF (Goframe framework) to illustrate the application adjustment method provided in this manual.

[0080] It should be noted that the program framework adopted by the application to be adjusted after adjustment can not only be pre-set by the technician, but also obtained through the model. For example, the program framework adopted by the application to be adjusted can be first determined as the original program framework, and then the framework generation prompt statement used to prompt the framework generation model to generate the applicable program framework under the target programming language, and the framework code corresponding to the original program framework are input into the preset framework generation model, so that the framework generation model adjusts the framework code corresponding to the original program framework according to the framework generation prompt statement to obtain the program framework adopted by the application to be adjusted under the target programming language. Based on the original program framework, the framework generation model can output a more suitable program framework for use. In addition, for the framework generation prompt statement, the expected indicators of the program framework can also be set in the prompt statement, for example, the framework generation prompt statement can be set as: according to the input program code, a program framework available for use in the go programming language is output, and the response time, concurrent processing volume, and multiple functions of A, B, and C of this program framework are provided. For the expected indicators of the program framework, it can be set according to the needs. Among them, the framework generation model can be a large language model or a pre-trained model, and this specification does not make specific restrictions.

[0081] After determining the program framework, the server also needs to determine the original programming language corresponding to the application to be adjusted, that is, determine the programming language information corresponding to the programming language used to write the application to be adjusted as the original programming language information. Then, the server can determine the target prompt statement based on the target programming language information and the original programming language information, so as to transform the code in each code file in the source code file through the preset large language model to obtain the adjusted application.

[0082] Among them, the server can identify the target programming language, obtain the target keyword corresponding to the target programming language, and identify the original programming language to determine the original keyword corresponding to the original programming language. Continuing with the above example, the target keyword corresponding to the target programming language Golang is Go, and the original keyword corresponding to the original programming language PHP is PHP. This is to avoid the problem that the programming language information obtained by the server is inaccurate or the programming language information is its alias, resulting in errors in code conversion. Therefore, the target prompt statement can be determined based on the target keyword and the original keyword.

[0083] Moreover, during the code conversion process, the user may have requirements for the program indicator data of the adjusted application. Therefore, the prompt statement obtained according to the target keyword and the original keyword can be used as the initial prompt statement. At the same time, the server can determine the program indicator data required for the application to be adjusted under the target programming language, such as throughput, response time, code complexity, etc. Then, the server can adjust the initial prompt statement according to the determined program indicator data to obtain the target prompt statement. For example: "Convert the code in the input programming language PHP into the Go language code, and the functions provided by the converted code are the same as the original code, and the code complexity corresponding to the converted code is not higher than M. Note: only output code".

[0084] If the target prompt statement is directly determined only through the target programming language information and the original programming language information, the determined target prompt statement may be: "Convert the input programming language PHP code into Go language code, and the converted code can provide the same function as the original code. Note: only output code." However, for the source code file, there are sub-files of different categories in the file directory of the source code file.

[0085] Next, the code conversion process will be described in conjunction with the schematic diagram of the code file directory of the source code file and the code file directory of the adjusted application program.

[0086] Figure 2 A schematic diagram of a file directory of different codes provided for this manual.

[0087] Among them, the total directory of the code file directory of the application to be adjusted is demo.com, which contains the controller layer directory, the model layer directory and the Template view layer directory. Since most of the existing applications are MVC (Model-View-Controller) architecture, the view layer is often separated from the business. Therefore, if the application using the MVC architecture is reconstructed, there is no need to make major adjustments to the files in the view layer directory. For the example provided in this specification, the architecture used by the application to be adjusted is the MVC architecture, so its view layer directory does not involve large-scale code conversion. However, if the application to be adjusted does not adopt the MVC architecture, and the business and view layers are not separated, it can be determined based on actual needs whether the view layer files need to be converted.

[0088] As for the controller layer code files and model layer code files that need to be converted, based on the schematic diagram, it can be seen that the Test1.controller.php file should be converted into four files after code conversion, which are stored in the api directory, controller directory, service directory and logic directory of the program framework respectively. The Test1.model.php file should be converted into two files after code conversion, which are stored in the model directory and dao directory respectively. The reason for the different conversion processes of the two files is that the files in the controller directory are responsible for managing the interaction between users and applications, while the files in the model directory are responsible for the data and business logic of the application. The functions of the two are not the same. Therefore, if the code is directly converted through the large language model with the same target prompt statement, and the functional logic of the application before adjustment is relatively complex, the resulting code may not be compatible or the code cannot be enabled normally.

[0089] On this basis, before determining the target prompt statement, the server can first determine the file directory of the source code file and the sub-files contained in the source code file, and then for each sub-file contained in the source code file, determine the target prompt statement for the sub-file based on the target programming language information and the original programming language information.

[0090] For example, for the Test1.controller.php file, the target prompt statement of the file may be: "Convert the controller layer code whose input programming language is PHP into Go language code, and the converted code can provide the same functions as the original code. Note: only output the code."

[0091] After determining the target prompt statement corresponding to each sub-file in the file directory of the source code file, the server can convert the code file according to the preset large language model to obtain the adjusted application program.

[0092] S104: Inputting the source code file and the target prompt statement into a preset large language model, so as to obtain the code of the application to be adjusted in the target programming language through the large language model.

[0093] The server inputs each sub-file in the file directory of the source code file and the target prompt statement corresponding to the sub-file into the preset large language model, and the code corresponding to the sub-file in the target programming language is obtained as the converted code. The obtained code is placed in the corresponding file in the program framework, which is the code file of the application to be adjusted in the target programming language. Among them, the large language model used can be a pre-trained large language model, or it can be a large language model such as ChatGPT, Copilot or other large language models, which is not specifically limited in this specification.

[0094] When the server converts the code file through the large language model, it will take a long time if the code is converted only through the workflow of a large language model. Therefore, you can choose to enable multiple workflows, and multiple workflows can process different sub-files at the same time to improve the efficiency of code conversion. The workflow can call the large language model through the preset interface. If multiple workflows are enabled, it can be regarded as multiple identical or different large language models working at the same time to complete the instructions issued by the server.

[0095] It should be noted that when converting the source code file of the MVC architecture, you need to convert the model layer code first, and then convert the controller layer code. The reason is that some of the controller layer code is implemented based on the model layer code. If there is a problem with the generation order, the program framework may have running errors.

[0096] Moreover, for the model layer file, the converted code corresponding to the model layer file is the model code and the dao code. Both codes are related to the database and are business logic files used to process data. The data importance level is relatively high. Therefore, in order to ensure the conversion of the model layer code, the database index and data table name contained in the original model layer file can be extracted through the large language model, and then the server inputs the obtained database index and data table name into the preset program framework tool. The program framework provides a mature tool for generating database-related codes. After obtaining the database index and data table name, the model code and dao code can be generated and stored in the corresponding files in the program framework. Of course, the code can also be generated directly from the large language model, and this manual does not limit it.

[0097] S105: Obtain an adjusted application program according to the code and the program framework, and execute a service according to the adjusted application program.

[0098] After the server obtains the converted code corresponding to each sub-file to be converted in the source code file and stores each converted code in the program framework, the adjusted application program can be obtained.

[0099] Specifically, the Goframe program framework provides the gf command. After the server calls the gf command to generate the logic.go file, the program framework automatically executes the init() function to perform the initialization operation of the program framework. The initialized code file can be used as the adjusted application. It should be noted that sometimes the technician may need to fine-tune or test the code. The technician can test and modify the adjusted application to ensure that the adjusted application has the expected functions.

[0100] Of course, the process of making secondary modifications to the adjusted application can also be completed based on the large language model. The server can first determine the expected indicator data corresponding to the adjusted application, that is, the expected efficiency of the adjusted application when executing the business, and then collect the actual efficiency of the adjusted application when executing the business as the actual indicator data, and then input the actual indicator data, the expected indicator data and the source code file corresponding to the adjusted application into the large language model, so that the large language model adjusts the source code file corresponding to the adjusted application according to the deviation between the expected indicator data and the actual indicator data, and obtains the second adjusted application as the target application, and then uses the target application as the adjusted application to execute the business.

[0101] Among them, the large language model used for code conversion can be used for secondary adjustment, and different large language models can also be used for secondary adjustment to avoid the problem of low adjustment efficiency caused by code conversion and code adjustment using the same large language model.

[0102] After obtaining the adjusted application with the expected functions, the server can mount the adjusted application to the routing file of the Goframe framework to provide the corresponding network services for the user. And based on the user's needs, the server executes the corresponding services. For example, it provides users with online game services, online search services, video playback services, etc.

[0103] It can be seen from the above method that the application to be adjusted is rewritten through a large language model to obtain an adjusted application under the target programming language, and business is executed according to the adjusted application. Compared with manual writing, the time required for rewriting is reduced and the efficiency of rewriting the application is greatly improved, thereby improving the efficiency of business execution.

[0104] Furthermore, in the process of converting the code through the large language model, by limiting the target prompt statement corresponding to each subfile in the source code file, the code output by the large language model can meet the expected needs of the user as much as possible. When the adjusted application fails to meet the expected needs of the user, the server can determine the actual indicator data corresponding to the adjusted application and the expected indicator data corresponding to the adjusted application, and then input the determined two data into the large language model, so that the large language model adjusts the source code file corresponding to the adjusted application. And by executing the business with a higher efficiency through the secondary adjustment, the efficiency of executing the business based on the adjusted application is improved.

[0105] It should be pointed out that in the examples in this specification, an example of converting an application program corresponding to PHP as a programming language into Go as a programming language is described, but in actual application, it is not limited to the corresponding conversion between these two programming languages. For example, for an application program written in a less efficient dynamic type language, it can also be converted into an application program written in C language with higher efficiency through the method provided in this specification. In addition, when the user has other needs besides efficiency, for example, if the user needs to convert an application program whose original operating platform is a mobile phone into a web application program, the target programming language corresponding to the original application program can be determined according to the needs, and then the programming language of the original application program can be converted into the target programming language by the method provided in this specification, thereby meeting the needs. In short, for the original programming language and the target programming language corresponding to the application program described in this specification, both can be determined according to user needs, and the efficiency of rewriting the application program can be improved through the method provided in this specification.

[0106] The above are one or more service execution methods of this specification. Based on the same idea, this specification also provides corresponding devices, storage media and electronic devices.

[0107] Figure 3 A schematic diagram of a service execution device provided in an embodiment of this specification, wherein the device includes:

[0108] Acquisition module 301: used to acquire a source code file and target programming language information of an application to be adjusted, wherein the target programming language information is used to indicate a programming language into which the application to be adjusted needs to be converted;

[0109] The first determination module 302 is used to determine the program framework adopted by the application program to be adjusted in the target programming language corresponding to the target programming language information;

[0110] The second determination module 303 is used to determine the programming language information corresponding to the programming language used to write the application to be adjusted as the original programming language information, and determine the target prompt statement according to the target programming language information and the original programming language information;

[0111] Input module 304: used to input the source code file and the target prompt statement into a preset large language model, so as to obtain the code of the application to be adjusted in the target programming language through the large language model;

[0112] Execution module 305: used to obtain an adjusted application program according to the code and the program framework, and execute services according to the adjusted application program.

[0113] Optionally, the device further comprises:

[0114] A third determining module 306 is used to determine a file directory of the source code file, and determine each sub-file included in the source code file according to the file directory;

[0115] The step of determining a target prompt statement according to the target programming language information and the original programming language information specifically includes:

[0116] For each sub-file included in the source code file, a target prompt statement for the sub-file is determined according to the target programming language information and the original programming language information.

[0117] Optionally, the third determining module 306 is specifically configured to:

[0118] For each sub-file included in the source code file, the sub-file and the target prompt statement corresponding to the sub-file are input into the large language model, so as to obtain the code of the sub-file in the target programming language through the large language model as the converted code corresponding to the sub-file;

[0119] The step of obtaining the adjusted application program according to the code and the program framework specifically includes:

[0120] According to the converted code corresponding to each sub-file and the program framework, an adjusted application program is obtained.

[0121] Optionally, the third determining module 306 is specifically configured to:

[0122] For each sub-file contained in the source code file, when the sub-file is a business logic file for processing data, the sub-file and the target prompt statement corresponding to the sub-file are input into the large language model to obtain the database index and data table name corresponding to the sub-file through the large language model; the generation instruction of the program framework is called to generate the converted code corresponding to the sub-file according to the database index and data table name corresponding to the sub-file.

[0123] Optionally, the first determining module 302 is specifically configured to:

[0124] Determine the original program framework adopted by the application to be adjusted; input the framework code corresponding to the original program framework and the framework generation prompt statement into a preset framework generation model, so that the framework generation model adjusts the framework code corresponding to the original program framework according to the framework generation prompt statement to obtain the program framework adopted by the application to be adjusted in the target programming language, and the framework generation prompt statement is used to prompt the framework generation model to generate a program framework applicable to the target programming language.

[0125] Optionally, the second determining module 303 is specifically configured to:

[0126] The target programming language is identified to determine the target keyword corresponding to the target programming language, and the original programming language is identified to determine the original keyword corresponding to the original programming language; an initial prompt statement is determined according to the target keyword and the original keyword; program indicator data required for the application to be adjusted under the target programming language is determined; and the initial prompt statement is adjusted according to the program indicator data to obtain a target prompt statement.

[0127] Optionally, the device further comprises:

[0128] The adjustment module 307 is used to collect actual indicator data when the adjusted application executes the business, and the actual indicator data is used to characterize the actual efficiency when the business is executed by the adjusted application; input the actual indicator data, the expected indicator data and the source code file corresponding to the adjusted application into the large language model, so that the large language model adjusts the source code file corresponding to the adjusted application according to the deviation between the expected indicator data and the actual indicator data to obtain the target application; and execute the business according to the target application.

[0129] This specification also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, it can be used to perform the above Figure 1 Provides business execution methods.

[0130] based on Figure 1 The service execution method shown in the specification also provides Figure 4 The structural diagram of the electronic device shown in FIG. Figure 4 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 A business execution method.

[0131] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0132] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0133] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0134] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0135] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0136] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0137] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0138] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0139] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0140] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0141] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0142] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0143] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0144] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0145] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0146] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0147] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.

Claims

1. A business execution method, It is characterized in that include: Acquire a source code file and target programming language information of the application to be adjusted, wherein the target programming language information is used to indicate the programming language into which the application to be adjusted needs to be converted; Determine a program framework adopted by the application program to be adjusted in the target programming language corresponding to the target programming language information; Determine programming language information corresponding to the programming language used to write the application to be adjusted as original programming language information, and determine a target prompt statement according to the target programming language information and the original programming language information; Inputting the source code file and the target prompt statement into a preset large language model, so as to obtain the code of the application to be adjusted in the target programming language through the large language model; An adjusted application is obtained according to the code and the program framework, and business is executed according to the adjusted application.

2. The method according to claim 1, It is characterized in that Before the step of determining a target prompt statement according to the target programming language information and the original programming language information, the method further includes: Determine a file directory of the source code file, and determine each subfile included in the source code file according to the file directory; The step of determining a target prompt statement according to the target programming language information and the original programming language information specifically includes: For each sub-file included in the source code file, a target prompt statement for the sub-file is determined according to the target programming language information and the original programming language information.

3. The method according to claim 2, It is characterized in that The step of inputting the source code file and the target prompt statement into a preset large language model to obtain the code of the application to be adjusted in the target programming language through the large language model specifically includes: For each sub-file included in the source code file, the sub-file and the target prompt statement corresponding to the sub-file are input into the large language model, so as to obtain the code of the sub-file in the target programming language through the large language model as the converted code corresponding to the sub-file; The step of obtaining the adjusted application program according to the code and the program framework specifically includes: According to the converted code corresponding to each sub-file and the program framework, an adjusted application program is obtained.

4. The method according to claim 3, It is characterized in that For each sub-file included in the source code file, the sub-file and the target prompt statement corresponding to the sub-file are input into the large language model to obtain the code of the sub-file in the target programming language through the large language model as the converted code corresponding to the sub-file, specifically including: For each sub-file included in the source code file, when the sub-file is a business logic file for processing data, the sub-file and the target prompt statement corresponding to the sub-file are input into the large language model, so as to obtain the database index and data table name corresponding to the sub-file through the large language model; The generation instruction of the program framework is called to generate the converted code corresponding to the sub-file according to the database index and the data table name corresponding to the sub-file.

5. The method according to claim 1, It is characterized in that The step of determining the program framework adopted by the application program to be adjusted in the target programming language corresponding to the target programming language information specifically includes: Determining the original program framework adopted by the application to be adjusted; The framework code corresponding to the original program framework and the framework generation prompt statement are input into a preset framework generation model, so that the framework generation model adjusts the framework code corresponding to the original program framework according to the framework generation prompt statement to obtain the program framework adopted by the application to be adjusted under the target programming language. The framework generation prompt statement is used to prompt the framework generation model to generate a program framework applicable to the target programming language.

6. The method according to claim 1, It is characterized in that The step of determining a target prompt statement according to the target programming language information and the original programming language information specifically includes: Identifying the target programming language to determine a target keyword corresponding to the target programming language, and identifying the original programming language to determine an original keyword corresponding to the original programming language; Determine an initial prompt sentence according to the target keyword and the original keyword; Determining program indicator data required for the application program to be adjusted in the target programming language; The initial prompt statement is adjusted according to the program indicator data to obtain a target prompt statement.

7. The method according to claim 1, It is characterized in that The method further comprises: Collecting actual index data when the adjusted application program executes a service, wherein the actual index data is used to characterize the actual efficiency when the service is executed by the adjusted application program; Inputting the actual indicator data, the expected indicator data, and the source code file corresponding to the adjusted application into the large language model, so that the large language model adjusts the source code file corresponding to the adjusted application according to the deviation between the expected indicator data and the actual indicator data, so as to obtain a target application; A service is executed according to the target application.

8. A service execution device, It is characterized in that include: An acquisition module: used to acquire a source code file of the application to be adjusted and target programming language information, wherein the target programming language information is used to indicate the programming language into which the application to be adjusted needs to be converted; A first determination module: used to determine the program framework adopted by the application program to be adjusted in the target programming language corresponding to the target programming language information; A second determination module is used to determine programming language information corresponding to the programming language used to write the application to be adjusted as original programming language information, and determine a target prompt statement according to the target programming language information and the original programming language information; Input module: used for inputting the source code file and the target prompt statement into a preset large language model, so as to obtain the code of the application to be adjusted in the target programming language through the large language model; Execution module: used to obtain an adjusted application program according to the code and the program framework, and execute business according to the adjusted application program.

9. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. An electronic device comprising a processor and a computer program stored in a memory and executable on the processor, It is characterized in that When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • MVC (model view controller) mode-based language transformation method and equipment for program

    CN104572072A

Cited By

  • Automatic file arrangement framework and method based on large language model and computer program product

    CN119961226A

  • Data generation method and device, computer equipment, readable storage medium and program product

    CN120144116A