Script code generation method and device, equipment, storage medium and program product
Generate script code generation models through large language models, combining human-computer interaction and code verification services, solve the problem of low adaptation efficiency and accuracy of instruction echo data analysis in the existing technology, and realize efficient and accurate script code generation and Analyze the adaptation effect.
Patent Information
- Application Number
- CN202411316213.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-14
AI Technical Summary
In the prior art, when facing the large number of instruction echo data analysis and adaptation work of multi-manufacturers and multi-network models, the efficiency and accuracy are low, making it difficult to effectively generate script code for parsing adaptation.
Through a script code generation model based on a large language model, the target instruction echo content is determined based on the original instruction echo content, and the prompt word template is used to convert it into a target prompt word, and the target script code is generated, combining human-computer interaction and code verification services to achieve Efficient and accurate generation of script code.
It significantly improves the efficiency and accuracy of script code generation, ensures that the generated script code can effectively parse the adaptive instruction echo content, and improves the rule analysis effect in network scenarios.
Smart Images

Figure CN119311254A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a script code generation method, apparatus, device, storage medium and program product. Background Art
[0002] The big language model is a deep learning model trained based on massive text data. It can not only generate natural language text, but also deeply understand the meaning of the text and handle various natural language tasks, such as text summarization, question answering, and translation. The parsing rule script is a script code that extracts interesting messages from the command echo messages of objects such as servers, switches, and routers.
[0003] In the existing network data collection scenarios, traditional programming methods are generally used to analyze the command echo data of network elements, and manually write regular expressions or program scripts to extract interesting texts. This method has the problem of low efficiency and accuracy when faced with the analysis and adaptation of a large amount of command echo data from multiple manufacturers and multiple network element models in the existing network. Summary of the invention
[0004] Based on this, it is necessary to provide a script code generation method, device, equipment, storage medium and program product that can automatically generate script code for parsing and adapting instruction echo data with high efficiency and high accuracy to address the above technical problems.
[0005] In a first aspect, the present application provides a script code generation method, which is applied to a terminal, comprising:
[0006] Determine the target command echo content according to the operation on the original command echo content;
[0007] Based on the prompt word template, the target command echo content is converted into the target prompt word;
[0008] The target script code is generated by the script code generation model according to the target prompt word and the original instruction echo content; wherein the script code generation model is obtained by iteratively training the large language model.
[0009] In one embodiment, determining the target instruction echo content according to the operation on the original instruction echo content includes:
[0010] Display the original command echo content;
[0011] In response to a selection operation on the original instruction echo content, a target instruction echo content corresponding to the selection operation is determined from the original instruction echo content.
[0012] In one embodiment, a target script code is generated by a script code generation model according to a target prompt word and original instruction echo content, including:
[0013] Input the target prompt word and the original command echo content into the script code generation model to obtain the initial script code;
[0014] According to the target script type, the target script code is extracted from the initial script code.
[0015] In one embodiment, the method further comprises:
[0016] Through the service interface, call the code verification service to verify the target script code and obtain the verification result;
[0017] If the verification result is that the code configuration requirements are met, the target script code is filled in the parsing rule text field.
[0018] In one embodiment, the code verification service is called through the service interface to verify the target script code and obtain the verification result, including:
[0019] Through the service interface, the code verification service is called to pass the target script code and the original instruction echo content to the target script execution engine, and the target script execution engine is run to verify the target script code and obtain the verification result.
[0020] In one embodiment, the method further comprises:
[0021] According to the target script type, a target script execution engine is determined from at least two candidate script execution engines.
[0022] In one embodiment, the method further comprises:
[0023] Display verification results;
[0024] In response to a confirmation operation on the verification result, it is determined that the verification result meets the code configuration requirement.
[0025] In one embodiment, the method further comprises:
[0026] If the verification result is that the code configuration requirement is not met, the operation returns to be executed based on the operation on the original command echo content to determine the operation of the target command echo content.
[0027] In a second aspect, the present application further provides a script code generating device, which is configured in a terminal and includes:
[0028] A content determination module, used to determine the target command echo content according to the operation on the original command echo content;
[0029] A prompt word conversion module, used for converting the target instruction echo content into a target prompt word based on the prompt word template;
[0030] The code generation module is used to generate target script code according to the target prompt word and the original instruction echo content through the script code generation model; wherein the script code generation model is obtained by iteratively training the large language model.
[0031] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method of the first aspect when executing the computer program.
[0032] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method of the first aspect when the computer program is executed by a processor.
[0033] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the method of the first aspect when executed by a processor.
[0034] The above-mentioned script code generation method, device, equipment, storage medium and program product, the terminal determines the target instruction echo content according to the operation of the original instruction echo content; based on the prompt word template, the target instruction echo content is converted into the target prompt word; through the script code generation model, the target script code is generated according to the target prompt word and the original instruction echo content; wherein, the script code generation model is obtained by iterative training of a large language model. This application is based on human-computer interaction, and selects the required target instruction echo content from a large amount of original instruction echo content, and then combines the template to generate the target prompt word as the input of the script code generation model, and uses artificial intelligence to automatically generate the corresponding target script code. Compared with the method of manually writing script code in the prior art, this application can effectively improve the efficiency of script code generation, and ensure that the generated script code can accurately parse and adapt the instruction echo content. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0036] FIG1 is an application environment diagram of a script code generation method in one embodiment;
[0037] FIG2 is a schematic diagram of a flow chart of a script code generation method in one embodiment;
[0038] FIG3 is a schematic diagram of a process for determining the target command echo content in one embodiment;
[0039] FIG4 is a schematic diagram of a process of extracting target script code in one embodiment;
[0040] FIG5 is a schematic diagram of a process of filling in a target script code in one embodiment;
[0041] FIG6 is a schematic diagram of a process for confirming a verification result in one embodiment;
[0042] FIG7 is a schematic diagram of a flow chart of a script code generation method in another embodiment;
[0043] FIG8 is a structural block diagram of a script code generating device in one embodiment;
[0044] FIG. 9 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] The script code generation method provided in the embodiment of the present application can be applied to the application environment as shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Specifically, the terminal 102 determines the target instruction echo content based on the operation of the original instruction echo content; based on the prompt word template, the target instruction echo content is converted into a target prompt word; through the script code generation model, the target script code is generated according to the target prompt word and the original instruction echo content; wherein, the script code generation model is obtained by iterative training of a large language model.
[0047] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0048] In an exemplary embodiment, as shown in FIG. 2 , a script code generation method is provided, which is described by taking the method applied to the terminal 102 in FIG. 1 as an example, including:
[0049] S201, determining target command echo content according to an operation on the original command echo content.
[0050] Among them, the original command echo content is the original command echo message displayed on the terminal, such as the command echo message for interaction between objects such as servers, switches and routers. In this embodiment, it can specifically refer to the command echo message for interaction between network element devices of the same or different manufacturers and models.
[0051] Based on human-computer interaction, the terminal identifies the operation on the original command echo content, executes the corresponding program according to the identified operation, and determines the required target command echo content from the original command echo content.
[0052] Exemplarily, the user views the original command echo content displayed on the terminal, and circles or marks the content of interest therein based on his / her own needs, so that the terminal determines the target command echo content according to the operation on the original command echo content.
[0053] Optionally, the terminal has a function of automatically filtering the command echo content, and after obtaining the original command echo content, it can execute a corresponding program to implement a filtering operation on the original command echo content, and then determine the target command echo content.
[0054] S202: based on the prompt word template, convert the target instruction echo content into a target prompt word.
[0055] The prompt word template is a pre-set normative template for the command echo content, which describes the instruction information required by the script code generation model in the form of natural language, and is used for the terminal to adaptively generate target prompt words.
[0056] Specifically, the terminal fills the target command echo content into the corresponding position based on the prompt word template, implements the conversion operation on the target command echo content, and forms the target prompt word.
[0057] For example, the prompt word template may be expressed as “You are a programming expert, please help me write code using ${language} to extract the following fields from the text wrapped in the following…:
[0058] 1. Extract the content between "\n" and "is up" and save it as the portConfig field;
[0059] 2. Extract the content between "The port is" and "\nDuplex" and save it as the port field;
[0060] 3. Extract the content between "BW" and "\nLast" and save it as the speed field;
[0061] Notice:
[0062] 1. If no content can be extracted from some fields, use null instead;
[0063] 2. Put the extracted text into the code as input;
[0064] 3. Print the extracted content in the code and then return the content;
[0065] 4. Call com.guangyan.high.config.service.common.utils.RegexUtils.extract (start, end, text) to extract fields, where start is the beginning of the field to be extracted, end is the end of the field to be extracted, and text is the original content to be extracted;
[0066] 5. Think step by step to ensure that the program I write can correctly extract the field content I want;
[0067] …
[0068] {content};
[0069] …”.
[0070] Among them, the programming language "${language}", the target command echo content "... wrapped text", and the code called to extract the field, etc. can all be adaptively filled in based on the target command echo content to form the target prompt word.
[0071] S203, generating a target script code through a script code generation model according to the target prompt word and the original instruction echo content.
[0072] Among them, the script code generation model is obtained by iterative training of the large language model, which can handle natural language tasks, that is, understand the meaning of the input text, and then automatically generate the target script code as the output text based on the input text.
[0073] The target prompt word and the original instruction echo content are input into the trained script code generation model, so that the script code generation model generates the target script code corresponding to the original instruction echo content under the instruction of the target prompt word.
[0074] Optionally, the underlying layer of the script code generation model is implemented based on the Transformer architecture. After pre-training and instruction fine-tuning, it can continuously predict the next character based on the forward text output and finally output the target script code.
[0075] In the above script code generation method, the terminal determines the target command echo content according to the operation on the original command echo content; based on the prompt word template, the target command echo content is converted into the target prompt word; through the script code generation model, the target script code is generated according to the target prompt word and the original command echo content; wherein, the script code generation model is obtained by iterative training of the large language model. This embodiment is based on human-computer interaction, selects the required target command echo content from a large amount of original command echo content, and then combines the template to generate the target prompt word as the input of the script code generation model, and uses artificial intelligence to automatically generate the corresponding target script code. Compared with the method of manually writing script code in the prior art, this application can effectively improve the efficiency of script code generation, and ensure that the generated script code can accurately parse and adapt the command echo content.
[0076] Based on the above embodiment, in an exemplary embodiment, as shown in FIG3 , S201 includes:
[0077] S301, display the original command echo content.
[0078] The terminal may be a computer, mobile phone or other device with a display interface, or an IoT device without a display interface. That is, the terminal may directly display the original command echo content on its own display interface, or on the display interface of another display device connected by wire or wirelessly, and this embodiment does not limit this.
[0079] S302: In response to a selection operation on the original instruction echo content, determine a target instruction echo content corresponding to the selection operation from the original instruction echo content.
[0080] Furthermore, after viewing the original command echo content, the user may circle or mark the content of interest therein based on his / her own needs, so that the terminal responds to the selection operation on the original command echo content and determines the target command echo content.
[0081] Specifically, the display interface associated with the terminal may be a touch layer with input function, or a touchpad, keyboard, or mouse, etc. That is, the user may circle or mark the content of interest directly on the display interface, or circle or mark the content of interest on the display interface through an external device, which is not limited in this embodiment.
[0082] Optionally, the terminal can automatically trigger a selection operation on the original command echo content, filter out the target command echo content, and display the original command echo content and the filtered target command echo content to the user in real time on the display interface, providing the user with a visual script generation process.
[0083] In this embodiment, the original instruction echo content is displayed in real time in the form of human-computer interaction, and then the target instruction echo content required to generate the target prompt word is determined based on the selection operation on the original instruction echo content. When the selection operation is manually triggered, the target instruction echo content that better meets the user's needs can be determined based on the user's operation on the original instruction echo content. When the selection operation is not manually triggered, the screening process of the target instruction echo content can be displayed intuitively in real time, thereby improving the reliability of the entire process.
[0084] Based on the above embodiment, in an exemplary embodiment, as shown in FIG4 , the above S203 includes:
[0085] S401, input the target prompt word and the original instruction echo content into the script code generation model to obtain the initial script code.
[0086] The script code generation model is used to perform semantic analysis and sequence generation on the original command echo content according to the target prompt word to obtain the corresponding initial script code.
[0087] Optionally, the script code generation model is implemented based on the following technologies: (1) NLU (Natural Language Understanding): The script code generation model needs to be able to understand the user's instructions or questions, that is, to understand the target prompt words and the original instruction echo content, which involves parsing natural language, including intent recognition and entity extraction. (2) Knowledge representation: The script code generation model needs to have a way to represent and store knowledge such as the grammatical rules, programming patterns, and algorithm logic of the programming language. (3) Deep learning: The script code generation model is implemented based on deep learning, such as RNN (Recurrent Neural Network), LSTM (Long Short-Term Memory), and Transformer. These models can capture long-distance dependencies and generate coherent sequences. (4) Reinforcement learning: In some cases, the script code generation model may use reinforcement learning to optimize the code generation process and learn to generate better code through interaction with the environment.
[0088] S402: extracting target script code from the initial script code according to the target script type.
[0089] The script type of the script code refers to the language type to which the script code belongs, which may include JavaScript, python, groovy, etc. The target script type is the currently required script type, which may be any one or more of various language types, and this embodiment does not impose any limitation on this.
[0090] Specifically, the initial script code generated by the script code generation model includes the script code content, the description at the beginning and the end, and the symbols, etc., and the target script code of the target script type is extracted from the initial script code. The initial script code generated by the script code generation model may also include script codes of different script types, and the target script code of the target script type is extracted from the initial script code.
[0091] Optionally, the generated target prompt word includes a target script type, so that the script code generation model can directly generate the target script code of the target script type under the instruction of the target prompt word.
[0092] In this embodiment, the initial script code is automatically generated through the script code generation model, and then the target script code of the required target script type is extracted from the initial script code, which can ensure the accuracy of the generated initial script code and meet the generation requirements of target script codes of different script types, thereby improving the flexibility of script code generation.
[0093] Based on the above embodiment, in an exemplary embodiment, as shown in FIG5 , the script code generation method further includes:
[0094] S501, calling a code verification service through a service interface to verify a target script code and obtain a verification result.
[0095] The terminal may be provided with a customized service interface for invoking a remote code verification service, verifying the target script code through the code verification service, and transmitting the verification result back to the terminal through the service interface.
[0096] Optionally, the service interface can be expressed as "POST http: / / ip:port / api / executeCode", and the input parameters of the code verification service include the target script code code, the original command echo content input, and the target script type languageType.
[0097] Optionally, through the service interface, the code verification service is called to pass the target script code and the original instruction echo content to the target script execution engine, and the target script execution engine is run to verify the target script code and obtain the verification result.
[0098] The target script execution engine is called through the code verification service, the target script code code and the original command echo content input are passed in, and the verification result is obtained after running. Among them, the target script execution engine can be a preset engine provided by the code verification service, which is used to verify the code quality and security of the script code, such as verifying the rules and vulnerabilities of the script code.
[0099] Optionally, based on the target script type, a target script execution engine is determined from at least two candidate script execution engines.
[0100] Different script types correspond to different script execution engines. When the terminal calls the code verification service through the service interface, the target script type can be synchronously passed in to pass through the code verification service. According to the target script type, the corresponding target script execution engine is determined from at least two candidate script execution engines, such as from PythonScriptEngine, JavaScriptEngine, GroovyScriptEngine and other script execution engines, to determine the target script execution engine of the corresponding language type.
[0101] S502: When the verification result is in compliance with the code configuration requirement, fill the target script code into the parsing rule text field.
[0102] The terminal can determine whether the target script code meets the code configuration requirements based on the verification result.
[0103] Optionally, the verification result may be a score for the target script code. When the score is not lower than a preset threshold, the code configuration requirement is met. Conversely, when the score is lower than the preset threshold, the code configuration requirement is not met.
[0104] Optionally, the verification result directly indicates whether the target script code meets the code configuration requirements, such as verification passed or verification failed.
[0105] Furthermore, if the verification result is in compliance with the code configuration requirements, the target script code is filled into the parsing rule text field, wherein the parsing rule text field may be a text field displayed on a display interface of the terminal, and the terminal prints the target script code in the text field and puts it into use.
[0106] In this embodiment, the terminal verifies the target script code in real time by calling a remote code verification service, determines whether the target script code generated by the script code generation model meets expectations, and ensures the availability of the target script code.
[0107] Based on the above embodiment, in an exemplary embodiment, as shown in FIG6 , the script code generation method further includes:
[0108] S601, display the verification result.
[0109] The verification result of the target script code is displayed on the display interface of the terminal.
[0110] The display interface of the terminal may be the display interface of the terminal itself, or may be the display interface of other display devices connected by wire or wirelessly.
[0111] S602: In response to a confirmation operation on the verification result, it is determined that the verification result meets the code configuration requirement.
[0112] After viewing the verification result, the user can confirm or cancel the verification result based on his / her own needs, so that the terminal responds to the confirmation operation or cancellation operation of the verification result.
[0113] If the terminal responds to a confirmation operation on the verification result, the verification result is determined to meet the code configuration requirements. Otherwise, if the terminal responds to a cancellation operation on the verification result, or does not receive a confirmation operation on the verification result within a preset time, the verification result is determined to not meet the code configuration requirements.
[0114] Optionally, the terminal may automatically trigger a confirmation operation on the verification result to determine whether the verification result meets the code configuration requirements.
[0115] In this embodiment, the verification result is displayed in the form of human-computer interaction, and then based on the confirmation operation of the verification result, it is determined whether the code configuration requirements are met so that the target script code can be put into use. In the case where the confirmation operation is manually triggered, the user's confirmation operation on the verification result can be used to ensure that the target script code put into use meets the user's needs. In the case where the confirmation operation is not manually triggered, the verification result can be displayed in real time and intuitively during the verification stage, thereby improving the reliability of the entire process.
[0116] Based on the above embodiment, in an exemplary embodiment, the script code generation method further includes:
[0117] If the verification result is that the code configuration requirement is not met, the operation returns to be executed based on the operation on the original command echo content to determine the operation of the target command echo content.
[0118] Specifically, the return execution determines the target instruction echo content based on the operation on the original instruction echo content, and converts the target instruction echo content into a target prompt word based on a prompt word template, and then generates the target script code operation according to the target prompt word and the original instruction echo content through the script code generation model.
[0119] Furthermore, through the service interface, the code verification service is called to verify the newly generated target script code again to obtain the verification result. When the verification result meets the code configuration requirements, the target script code is filled into the parsing rule text field.
[0120] In this embodiment, when the target script code does not meet the code configuration requirements, the target script code generation steps are executed in multiple rounds to optimize the target script code, and the script code generation model is continued to be driven to automatically generate the target script code, and finally the target script code that meets the code configuration requirements is put into use, thereby realizing the feedback optimization and improvement mechanism of the target script code, improving the effect of rule parsing in network scenarios, and ensuring the accuracy of the target script code that is finally put into use.
[0121] In an exemplary embodiment, as shown in FIG7 , a script code generation method is provided, including:
[0122] S701, display the original command echo content.
[0123] S702 , in response to a selection operation on the original instruction echo content, determining a target instruction echo content corresponding to the selection operation from the original instruction echo content.
[0124] S703: based on the prompt word template, convert the target instruction echo content into a target prompt word.
[0125] S704, input the target prompt word and the original instruction echo content into the script code generation model to obtain the initial script code.
[0126] Among them, the script code generation model is obtained by iterative training of the large language model.
[0127] S705: Extract the target script code from the initial script code according to the target script type.
[0128] S706: Determine a target script execution engine from at least two candidate script execution engines according to the target script type.
[0129] S707, through the service interface, call the code verification service to pass the target script code and the original instruction echo content to the target script execution engine, and run the target script execution engine to verify the target script code and obtain the verification result.
[0130] S708, display the verification result.
[0131] S709, in response to the confirmation operation on the verification result, it is determined that the verification result meets the code configuration requirement, and the target script code is filled into the parsing rule text field.
[0132] S710, in response to the cancel operation on the verification result, it is determined that the verification result does not meet the code configuration requirements, and the operation of S701-S708 is returned to be executed.
[0133] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0134] Based on the same inventive concept, the embodiment of the present application also provides a script code generation device for implementing the script code generation method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more script code generation device embodiments provided below can refer to the above limitations on the script code generation method, and will not be repeated here.
[0135] In an exemplary embodiment, as shown in FIG8 , a script code generating device is provided, comprising:
[0136] The content determination module 10 is used to determine the target instruction echo content according to the operation on the original instruction echo content.
[0137] The prompt word conversion module 20 is used to convert the target instruction echo content into a target prompt word based on the prompt word template.
[0138] The code generation module 30 is used to generate target script code according to the target prompt word and the original instruction echo content through the script code generation model; wherein the script code generation model is obtained by iteratively training the large language model.
[0139] Based on the above embodiment, in an exemplary embodiment, the content determination module 10 includes:
[0140] The content display unit is used to display the original command echo content.
[0141] The content determination unit is used to determine the target instruction echo content corresponding to the selection operation from the original instruction echo content in response to the selection operation on the original instruction echo content.
[0142] Based on the above embodiment, in an exemplary embodiment, the code generation module 30 includes:
[0143] The code generation unit is used to input the target prompt word and the original instruction echo content into the script code generation model to obtain the initial script code.
[0144] The code extraction unit is used to extract the target script code from the initial script code according to the target script type.
[0145] Based on the above embodiment, in an exemplary embodiment, the script code generating device further includes:
[0146] The code verification module is used to call the code verification service through the service interface to verify the target script code and obtain the verification result.
[0147] The code usage module is used to fill the target script code into the parsing rule text field when the verification result is in compliance with the code configuration requirements.
[0148] Based on the above embodiments, in an exemplary embodiment, the above code verification module is specifically used to call the code verification service through the service interface to pass the target script code and the original instruction echo content into the target script execution engine, and run the target script execution engine to verify the target script code and obtain the verification result.
[0149] Based on the above embodiment, in an exemplary embodiment, the script code generating device further includes:
[0150] The engine selection module is used to determine a target script execution engine from at least two candidate script execution engines according to the target script type.
[0151] Based on the above embodiment, in an exemplary embodiment, the script code generating device further includes:
[0152] The result display module is used to display the verification results.
[0153] The result confirmation module is used to determine that the verification result meets the code configuration requirements in response to a confirmation operation on the verification result.
[0154] Based on the above embodiment, in an exemplary embodiment, the script code generating device further includes:
[0155] The return execution module is used to return to the execution of the operation of determining the target instruction echo content based on the operation of the original instruction echo content when the verification result is that the code configuration requirement is not met.
[0156] Each module in the above script code generation device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0157] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG9. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a script code generation method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0158] Those skilled in the art will understand that the structure shown in FIG. 9 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0159] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0160] Determine the target command echo content according to the operation on the original command echo content;
[0161] Based on the prompt word template, the target command echo content is converted into the target prompt word;
[0162] The target script code is generated by the script code generation model according to the target prompt word and the original instruction echo content; wherein the script code generation model is obtained by iteratively training the large language model.
[0163] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0164] Display the original command echo content;
[0165] In response to a selection operation on the original instruction echo content, a target instruction echo content corresponding to the selection operation is determined from the original instruction echo content.
[0166] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0167] Input the target prompt word and the original command echo content into the script code generation model to obtain the initial script code;
[0168] According to the target script type, the target script code is extracted from the initial script code.
[0169] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0170] Through the service interface, call the code verification service to verify the target script code and obtain the verification result;
[0171] If the verification result is that the code configuration requirements are met, the target script code is filled in the parsing rule text field.
[0172] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0173] Through the service interface, the code verification service is called to pass the target script code and the original instruction echo content to the target script execution engine, and the target script execution engine is run to verify the target script code and obtain the verification result.
[0174] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0175] According to the target script type, a target script execution engine is determined from at least two candidate script execution engines.
[0176] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0177] Display verification results;
[0178] In response to a confirmation operation on the verification result, it is determined that the verification result meets the code configuration requirement.
[0179] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0180] If the verification result is that the code configuration requirement is not met, the operation returns to be executed based on the operation on the original command echo content to determine the operation of the target command echo content.
[0181] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0182] Determine the target command echo content according to the operation on the original command echo content;
[0183] Based on the prompt word template, the target command echo content is converted into the target prompt word;
[0184] The target script code is generated by the script code generation model according to the target prompt word and the original instruction echo content; wherein the script code generation model is obtained by iteratively training the large language model.
[0185] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0186] Display the original command echo content;
[0187] In response to a selection operation on the original instruction echo content, a target instruction echo content corresponding to the selection operation is determined from the original instruction echo content.
[0188] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0189] Input the target prompt word and the original command echo content into the script code generation model to obtain the initial script code;
[0190] According to the target script type, the target script code is extracted from the initial script code.
[0191] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0192] Through the service interface, call the code verification service to verify the target script code and obtain the verification result;
[0193] If the verification result is that the code configuration requirements are met, the target script code is filled in the parsing rule text field.
[0194] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0195] Through the service interface, the code verification service is called to pass the target script code and the original instruction echo content to the target script execution engine, and the target script execution engine is run to verify the target script code and obtain the verification result.
[0196] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0197] According to the target script type, a target script execution engine is determined from at least two candidate script execution engines.
[0198] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0199] Display verification results;
[0200] In response to a confirmation operation on the verification result, it is determined that the verification result meets the code configuration requirement.
[0201] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0202] If the verification result is that the code configuration requirement is not met, the operation returns to be executed based on the operation on the original command echo content to determine the operation of the target command echo content.
[0203] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0204] Determine the target command echo content according to the operation on the original command echo content;
[0205] Based on the prompt word template, the target command echo content is converted into the target prompt word;
[0206] The target script code is generated by the script code generation model according to the target prompt word and the original instruction echo content; wherein the script code generation model is obtained by iteratively training the large language model.
[0207] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0208] Display the original command echo content;
[0209] In response to a selection operation on the original instruction echo content, a target instruction echo content corresponding to the selection operation is determined from the original instruction echo content.
[0210] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0211] Input the target prompt word and the original command echo content into the script code generation model to obtain the initial script code;
[0212] According to the target script type, the target script code is extracted from the initial script code.
[0213] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0214] Through the service interface, call the code verification service to verify the target script code and obtain the verification result;
[0215] If the verification result is that the code configuration requirements are met, the target script code is filled in the parsing rule text field.
[0216] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0217] Through the service interface, the code verification service is called to pass the target script code and the original instruction echo content to the target script execution engine, and the target script execution engine is run to verify the target script code and obtain the verification result.
[0218] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0219] According to the target script type, a target script execution engine is determined from at least two candidate script execution engines.
[0220] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0221] Display verification results;
[0222] In response to a confirmation operation on the verification result, it is determined that the verification result meets the code configuration requirement.
[0223] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0224] If the verification result is that the code configuration requirement is not met, the operation returns to be executed based on the operation on the original command echo content to determine the operation of the target command echo content.
[0225] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0226] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0227] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0228] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A script code generation method, characterized in that: Applied to a terminal, the method comprises: Determine the target command echo content according to the operation on the original command echo content; Based on the prompt word template, converting the target instruction echo content into a target prompt word; The target script code is generated according to the target prompt word and the original instruction echo content through a script code generation model; wherein the script code generation model is obtained by iteratively training a large language model.
2. The method according to claim 1, characterized in that The step of determining the target command echo content according to the operation on the original command echo content includes: Display the original command echo content; In response to a selection operation on the original instruction echo content, a target instruction echo content corresponding to the selection operation is determined from the original instruction echo content.
3. The method according to claim 1, characterized in that The script code generation model generates the target script code according to the target prompt word and the original instruction echo content, including: Input the target prompt word and the original command echo content into the script code generation model to obtain the initial script code; According to the target script type, the target script code is extracted from the initial script code.
4. The method according to claim 1, characterized in that: The method further comprises: Through the service interface, calling the code verification service to verify the target script code and obtain the verification result; If the verification result is in compliance with the code configuration requirement, the target script code is filled into the parsing rule text field.
5. The method according to claim 4, characterized in that The code verification service is called through the service interface to verify the target script code and obtain the verification result, including: Through the service interface, the code verification service is called to pass the target script code and the original instruction echo content into the target script execution engine, and the target script execution engine is run to verify the target script code and obtain a verification result.
6. The method according to claim 5, characterized in that The method further comprises: According to the target script type, a target script execution engine is determined from at least two candidate script execution engines.
7. The method according to claim 4, characterized in that The method further comprises: displaying the verification result; In response to a confirmation operation on the verification result, it is determined that the verification result meets a code configuration requirement.
8. The method according to claim 4, characterized in that The method further comprises: If the verification result is that the code configuration requirement is not met, the operation of determining the target instruction echo content based on the operation on the original instruction echo content is returned.
9. A script code generating device, characterized in that: Configured in a terminal, the device includes: A content determination module, used to determine the target command echo content according to the operation on the original command echo content; A prompt word conversion module, used for converting the target instruction echo content into a target prompt word based on a prompt word template; The code generation module is used to generate target script code according to the target prompt word and the original instruction echo content through a script code generation model; wherein the script code generation model is obtained by iteratively training a large language model.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.