Script language based on natural language and method and system using script language

By providing a scripting language based on natural language and combining the interaction of large language models, the existing scripting language is solved, and a more intuitive programming method and system intelligence is achieved.

CN119473250APending Publication Date: 2025-02-18SHENZHEN HANXING ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411587518.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

Existing scripting languages ​​are not intuitive and easy to use, and a natural language-based scripting language is needed to provide a more intuitive and easy to use programming method.

Method used

Provides a natural language-based scripting language that can interpret and process the execution results of external commands and generate executable instructions through interaction with large language models. The scripting language is programmed in natural language and executes internal and external commands by inserting specific prefixes.

Benefits of technology

It realizes a more intuitive and easy-to-use programming method, improves the intelligence of the system, can execute internal and external commands, and performs intelligent question answers and information extraction through large language models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473250A_ABST
    Figure CN119473250A_ABST
Patent Text Reader

Abstract

The invention relates to a script language based on a natural language and a method and system using the script language. The method comprises the steps that a preset configuration file is read and initialized, and a script execution environment is obtained; the input script content is analyzed, a unified command queue and a label mapping table are obtained, and the unified command queue comprises an internal command, an external command and a natural language command; directly executing the internal command to obtain an internal command execution result; executing the external command on the host system to obtain an external command execution result; inputting the natural language command into the large language model for processing to obtain a natural language processing result; compared with an existing script language, the script language is more visual and easy to use, and programming can be conducted through a natural language. Meanwhile, through interaction with the large language model, the execution result of the external command can be interpreted and processed, and the intelligent degree of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of scripting languages, and in particular to a natural language-based scripting language and a method and system for using the scripting language. Background Art

[0002] Currently, scripting languages ​​are widely used in computer systems for automated tasks, data processing, and system management. However, existing scripting languages ​​often require the use of specialized syntax and commands, which are not intuitive and easy to use. Therefore, a natural language-based scripting language is needed to provide a more intuitive and easy-to-use programming method. Summary of the invention

[0003] The main purpose of the present invention is to provide a scripting language based on natural language and a method and system for using the scripting language. Compared with existing scripting languages, the scripting language of the present invention is more intuitive and easy to use, and can be programmed through natural language. At the same time, through interaction with a large language model, the execution results of external commands can be interpreted and processed, thereby improving the intelligence of the system.

[0004] To achieve the above object, the present invention provides a natural language-based scripting language and a method for using the scripting language, comprising the following steps: Reading a preset configuration file to obtain external system connection information, and initializing the host system according to the external system connection information to obtain a script execution environment; Parsing the input script content to obtain a unified command queue and a label mapping table, wherein the unified command queue includes: internal commands, external commands, and natural language commands; The commands in the unified command queue are sequentially executed according to the label mapping table to obtain command execution results, and the command execution results are stored in the script execution environment; specifically including: directly executing internal commands when encountering them to obtain internal command execution results, and storing the internal command execution results in the script execution environment; executing external commands on the host system to obtain external command execution results, and storing the external command execution results in the script execution environment; inputting the natural language commands into a large language model for processing to obtain natural language processing results, and generating executable instructions based on the natural language processing results; The command execution results are summarized and analyzed to obtain an execution report.

[0005] The present invention also provides a natural language-based scripting language and a system using the scripting language, including: An initialization module is used to read a preset configuration file, obtain external system connection information, and initialize the host system according to the external system connection information to obtain a script execution environment; A parsing module, used to parse the input script content to obtain a unified command queue and a label mapping table, wherein the unified command queue includes: internal commands, external commands and natural language commands; A command execution module is used to sequentially execute the commands in the unified command queue according to the label mapping table, obtain command execution results, and store the command execution results in the script execution environment; specifically including: directly executing internal commands when encountering them, obtaining internal command execution results, and storing the internal command execution results in the script execution environment; executing external commands on the host system, obtaining external command execution results, and storing the external command execution results in the script execution environment; inputting the natural language commands into a large language model for processing, obtaining natural language processing results, and generating executable instructions based on the natural language processing results; The generation module is used to summarize and analyze the command execution results to obtain an execution report.

[0006] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.

[0007] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.

[0008] In summary, the technical solution provided by the present invention, the scripting language and system of the present invention can realize the following functions: 1. Execute various internal commands, such as calling other scripts, quoting the execution results of other scripts, issuing alarms to the host system, and sending emails. 2. Execute external commands, call the commands of the host system by inserting a single % prefix to realize the connection and operation with the host, database, middleware, etc. 3. Send the natural language paragraphs in the script to the large language model for interactive conversation, and realize intelligent question answering and information extraction. The execution results of the external commands are interpreted and processed in combination with the large language model, and whether to alarm or send emails is determined according to the extraction results. The scripting language is based on natural language, inserts %% as a prefix to execute internal commands, including %% label as a label, %% call to call other scripts, %% invoke as a reference to the execution results of other scripts, %% alert to issue an alarm to the host system, %% mail sends emails through the host system, and %% lua calls lua embedded scripts. The system realizes intelligent functions by interpreting and processing the instructions in the scripting language and the execution results of external commands. The system can execute external commands and call the commands of the currently connected system by inserting a single % prefix. The system can send natural language paragraphs in the script to the large language model for interactive conversation, and perform further operations and processing based on the conversation replies. The system can interpret and process the execution results of external commands, and decide whether to alarm or send emails based on the extraction results. The system can connect and operate with the host system's mainframe, database, middleware, etc. The system can achieve intelligent question answering and information extraction through interaction with the large language model. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 is a schematic diagram of a natural language-based scripting language and a method step for using the scripting language in one embodiment of the present invention; Figure 2 It is a block diagram of a natural language-based scripting language and a system structure using the scripting language in one embodiment of the present invention; Figure 3 It is a schematic block diagram of the structure of a computer device according to an embodiment of the present invention.

[0010] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0011] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention 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 invention and are not intended to limit the present invention.

[0012] Reference Figure 1This embodiment provides a scripting language based on natural language and a method for using the scripting language, including the following steps: S1, read the preset configuration file, obtain the external system connection information, and initialize the host system according to the external system connection information to obtain the script execution environment; The present invention provides a natural language-based scripting language and a system using the scripting language, the core concept of which is to execute internal commands and external commands by inserting specific prefixes based on natural language.

[0013] Specifically, the scripting language includes the following built-in commands: %%label: Used as a label to mark a specific location in the script.

[0014] %%call: used to call other scripts.

[0015] %%invoke: Used to reference the execution results of other scripts.

[0016] %%alert: used to send an alert to the host system.

[0017] %%mail: Used to send mail through the host system.

[0018] %%lua: used to call embedded Lua scripts.

[0019] In addition, the script can also call external commands by inserting a single % prefix. The host system connects to the host, database, and middleware according to the configuration file. The % prefix can execute commands of the currently connected system. The main body of the script is natural language, and each paragraph of text will be sent to the large language model for interactive conversation. At the same time, the result of executing an external command with the % prefix can be referenced by the conversation. By sending the execution result of the external command to the large language model, the large language model can interpret and extract the interpretation content, and decide whether to alarm or send an email based on the extraction result.

[0020] Here is an example of using the scripting language: %show list %%label old %%lua.begin str = getAnswer() str = string.sub(str, 20, 100) replaceAnswer (str) %%lua.end %%label mylist %%invoke mylist Find the version number of the switch in this data %%label ver %%lua.begin Generate report str = getAnswer('ver') putReport('Checked version\\n') putReport('**' + str + '**\\n') %%lua.end In the above example, the %show list command is first used to display the list. The code between %%lua.begin and %%lua.end is used to truncate the list to a specific range and replace the result with the session's reply. The %%invoke command is used to call a script named mylist. In this script, the session finds the version number of the switch in the data based on the natural language instructions and saves the result. The code between %%lua.begin and %%lua.end is used to generate a report and put the version number of the switch into the report.

[0021] Among them, the preset configuration file is parsed and processed, and the external system connection information including host connection information, database connection information and middleware connection information is obtained from it, and the connection requirements of different external systems are fully identified and processed. According to the host connection information contained in the external system connection information, the host connection module is initialized to obtain the host connection object. The host connection object is an important part of the entire system script execution environment, which is responsible for establishing a communication connection with the external host resources so that the subsequent script execution process can normally obtain and use the host resources. At the same time, based on the database connection information in the external system connection information, the database connection module is initialized to generate a database connection object. The database connection object enables the script execution environment to establish an efficient interaction channel with the external database, so that during the script execution process, the database can be directly read, written, etc., to realize the instant processing and utilization of data, and effectively ensure the integrity and consistency of the data. The middleware connection information in the external system connection information is input into the middleware connection module, and it is initialized to generate a middleware connection object. The role of the middleware connection object is to establish a connection with the external middleware component to ensure that it can support the execution of complex business logic and data interaction between cross-systems. In this way, the script execution environment achieves integration and coordination of multiple systems. First, the internal command parser is initialized and command parsing rules are set, including command prefix recognition rules, parameter parsing rules, etc. At the same time, based on the three established connection objects (host connection object, database connection object and middleware connection object), the system initializes the external command executor and generates unified command execution rules. The rule defines how to select the corresponding connection object according to the command type and how to convert and execute the command. The preset large language model connection parameters are input into the large language model interface for connection to obtain the large language model connection object. The large language model connection object enables the script execution environment to efficiently parse and execute natural language, convert the natural language input by the user into corresponding executable instructions, and improve the flexibility and ease of use of the script language. The host connection object, database connection object, middleware connection object, unified command execution rules and large language model connection object are integrated to generate a script execution environment. The execution environment is a highly integrated and modular execution platform that can efficiently execute corresponding internal commands, external commands and natural language commands according to the script content input by the user.

[0022] S2, parse the input script content to obtain a unified command queue and a label mapping table. The unified command queue includes: internal commands, external commands, and natural language commands; Specifically, the system performs line segmentation processing on the input script content. The system uses the line feed character (\n) as a separator to segment the entire script text into independent lines to form a script line sequence. During the segmentation process, the system filters out blank lines and lines with pure whitespace characters, while retaining the original line number information of each line, which will be used for subsequent position mapping. The system performs prefix recognition processing on each line in the script line sequence. The system uses regular expressions for matching to identify the characters at the beginning of each line. For lines starting with "%%", mark their prefix type as an internal command prefix; for lines starting with a single "%", mark their prefix type as an external command prefix; for lines that do not start with "%", mark their prefix type as no prefix. The system stores each line of text and its corresponding prefix type identifier in a data structure. Based on the identified prefix type identifier, the system performs command marking processing on the script line sequence. The system traverses the prefix type identifier and adds a corresponding command type tag to each line according to the different prefix types: the line starting with "%%" is marked as an internal command and its complete command content is retained; the line starting with a single "%" is marked as an external command and its command content after removing the prefix is ​​retained; the line not starting with "%" is marked as a natural language command and its original text content is retained. All lines with command type tags are organized in the original order to form a unified command queue. The system further performs type identification processing on the lines marked as internal commands in the unified command queue. The system identifies different types of internal commands by matching the command header keywords: the command starting with "%%label" is marked as a label definition command, the command starting with "%%call" is marked as a script call command, the command starting with "%%invoke" is marked as a result reference command, the command starting with "%%alert" is marked as an alarm command, the command starting with "%%mail" is marked as an email command, and the command starting with "%%lua" is marked as a Lua script command. Each internal command will be added with a specific type tag. The system performs position mapping processing on the label definition commands (%%label) in the unified command queue. The system extracts the label names defined by all %%label commands, uses these label names as keys, and uses their position indexes in the unified command queue as values ​​to build a label set. The system processes the label set, establishes a mapping relationship between each label and its specific position in the script (including line number and command queue index), and forms a label mapping table.

[0023] S3, sequentially execute the commands in the unified command queue according to the label mapping table, obtain the command execution results, and store the command execution results in the script execution environment; specifically includes: directly executing internal commands when encountering them, obtaining the internal command execution results, and storing the internal command execution results in the script execution environment; executing external commands on the host system, obtaining the external command execution results, and storing the external command execution results in the script execution environment; inputting natural language commands into the large language model for processing, obtaining natural language processing results, and generating executable instructions based on the natural language processing results; It should be noted that the unified command queue is sequentially traversed, and when an internal command is encountered, it is directly executed to obtain the current execution command. When each command is traversed, it is identified based on the type of the command to obtain the specific internal command type, determine how to process the command and which specific execution modules need to be called. According to the specific internal command type, the parameters of the current execution command are parsed to obtain a command parameter set. The command parameter set contains all the necessary information required to execute the command, such as the value of the variable, the parameter of the function, the target label, etc. The command parameter set is input into the corresponding internal command execution module, and the internal command execution module processes the command according to the command type and parameter set to generate the execution result of the internal command. The internal command execution result is formatted to obtain a standardized execution result, so that different types of commands have a consistent format and structure when returning results. Based on the standardized execution result, the variables in the script execution environment are updated accordingly to ensure that the execution environment can reflect the current execution status. For example, if the execution result of an internal command is an assignment operation to a variable, the variable in the script execution environment will be updated when the standardized result is generated to obtain an updated script execution environment. During the execution of internal commands, some commands such as "%%call" and "%%invoke" involve jumping to other parts of the script. The label mapping table is used to locate the position of the "%%label" command to obtain the corresponding label position information. The label position information is used to indicate the location of different code blocks in the script, so that the system can accurately jump to these locations to execute the corresponding code blocks. Based on the label position information, the "%%call" and "%%invoke" commands are jumped to find the location of the next command to be executed. Through the jump mechanism, the script language implements complex control flows, such as function calls and event processing. After the jump processing is completed, the system returns to the traversal process of the internal command and continues to execute the next command. The traversal and execution process is repeated until all commands in the internal command are executed. After each command is executed, the execution result of the command is stored in the script execution environment, so that the execution environment can fully record all execution status and results.

[0024] In this embodiment, when the unified command queue is traversed for external commands, the current external command is encountered. Each time an external command is traversed, the current external command is parsed based on the external command execution rules predefined in the script execution environment to determine the target external system and the specific command content. Through the parsing mechanism, each external command is matched with the corresponding target external system so that the system can correctly interact with the corresponding external system. Based on the information of the target external system, a connection object is searched in the script execution environment to find a specific connection instance corresponding to the target external system, such as a host connection object, a database connection object or a middleware connection object. The connection object is a bridge for communicating with the external system in the script execution environment, so that the system can reliably connect and interact with external resources to ensure that the external command can be executed smoothly. By searching for the connection object, a specific connection instance suitable for executing the current external command is located. The command content of the external command is input into the corresponding connection object for command execution. By using the previously found connection object, interact with the external system, execute the corresponding command operation, and obtain the original execution result. The original execution result contains the response information of the external system, the result data of the operation, etc. The original execution result is formatted to obtain a standardized external command execution result. Update the variables in the script execution environment based on the external command execution results to ensure that the script execution environment can reflect the latest execution status and data changes. After updating the variables, perform a status check on the updated script execution environment to obtain the current execution status information to determine whether the script execution is normal, whether there are any abnormalities, etc. Determine whether to continue to execute the next external command based on the execution status information. If the status information shows that the script execution is normal and no abnormalities occur, then continue to traverse and execute the next command in the external command; if the status information shows that the execution encountered a problem, or the external command has been executed, the system will stop traversing and end the execution process of the external command. Store all external command execution results in the script execution environment to ensure the traceability of the execution process and the integrity of the data.

[0025] In this embodiment, the system performs context association processing for natural language commands. The system extracts the text content before and after the current natural language command from the unified command queue, and obtains the execution results of the executed internal commands and external commands at the same time. For example, for the execution results of the internal commands %%call and %%invoke, the system extracts its return value and execution status; for the results of the external command execution, the system obtains information such as the host command output, database query results, or middleware call response. The system uses these execution results as context information and combines them with the original content of the natural language command to form the first context information. The system supplements the first context information based on the information in the script execution environment. The system obtains information such as the current variable value, system status, and historical command execution records from the script execution environment. This information includes the current value of the script variable, statistical information of the executed command (such as the number of executions, average response time), system resource usage, etc. The system adds these environmental information to the first context information in a predefined template format to form a more complete second context information. The system sends the complete second context information to the large language model for processing. The system sends context information to the large language model through a pre-established API interface, and the model understands and processes the input content based on its trained knowledge. The processing process includes: understanding the semantic content of natural language, performing reasoning analysis based on context information, and generating corresponding processing results. The system receives the natural language processing results returned by the model, which include the understanding and response to the input content. The system parses and structures the natural language processing results. The system uses predefined parsing rules to convert the natural language processing results into a structured data format, such as JSON or XML format. The system identifies instructions based on these structured data and converts the operation intentions contained therein into specific executable instructions. These instructions contain information such as operation type, parameter values, and execution conditions. The system classifies the identified executable instructions. According to the operation type of the instruction, the system divides it into two categories: internal instructions that need to be executed directly by the system (such as creating tags, calling scripts, etc.) and external instructions that need to be executed on external systems (such as executing host commands, database operations, etc.). The classification process is based on a predefined instruction type mapping table. For the internal instruction subset, the system converts it into a new command that conforms to the internal command format. The conversion process includes: adding the %% prefix, setting the command type, assembling parameters, etc. At the same time, the system uses the original natural language processing results as the execution context information of these newly added internal commands, which is used for parameter supplementation and result interpretation during subsequent execution. The system adds these newly added internal commands to the unified command queue. For the external command subset, the system converts it into a new command that conforms to the external command format. The conversion process includes: adding the % prefix, determining the target system, formatting the command content, etc.Similarly, the system uses the natural language processing results as the execution context information of these newly added external commands for environment adaptation and result processing during execution. The system also adds these newly added external commands to the unified command queue.

[0026] S4, summarize and analyze the command execution results to obtain an execution report.

[0027] Specifically, the system uses the result collector to capture various outputs generated during the script execution process in real time. For internal commands, the execution results and return values ​​of commands such as %%label, %%call, %%invoke, %%alert, %%mail, and %%lua are collected; for external commands, actual execution data such as host command output, database query results, and middleware call responses are collected; for natural language commands, specific business outputs generated after processing by the large language model are collected. These execution results are organized according to the format requirements defined by the script to form the script execution output results. The system records the command execution process through the logger. The logger is responsible for collecting the execution time, execution status (success / failure) of each command, and warning or error information that occurs during the execution process. This information is used as a process log for debugging. The system uses a preset report template to format the script execution output results and generate a structured execution report. The system adds the process log as debugging information to the report, forms the final execution report, and stores it in the script execution environment for subsequent query use.

[0028] In the embodiment of the present application, the scripting language and system of the present invention can realize the following functions: 1. Execute various internal commands, such as calling other scripts, quoting the execution results of other scripts, issuing alarms to the host system, and sending emails. 2. Execute external commands, and call the host system's commands by inserting a single % prefix to realize the connection and operation with the host, database, middleware, etc. 3. Send the natural language paragraphs in the script to the large language model for interactive conversation to realize intelligent problem solving and information extraction. The execution results of the external commands are interpreted and processed in combination with the large language model, and whether to alarm or send emails is determined according to the extraction results. The scripting language is based on natural language, and inserts %% as a prefix to execute internal commands, including %% label as a label, %% call to call other scripts, %% invoke as a reference to the execution results of other scripts, %% alert to send an alarm to the host system, %% mail to send emails through the host system, and %% lua to call lua embedded scripts. The system realizes intelligent functions by interpreting and processing the instructions in the scripting language and the execution results of external commands. The system can execute external commands and call the commands of the currently connected system by inserting a single % prefix. The system can send natural language paragraphs in the script to the large language model for interactive conversation, and perform further operations and processing based on the conversation replies. The system can interpret and process the execution results of external commands, and decide whether to alarm or send emails based on the extraction results. The system can connect and operate with the host system's mainframe, database, middleware, etc. The system can achieve intelligent question answering and information extraction through interaction with the large language model.

[0029] In one example, a preset configuration file is read to obtain external system connection information, and a host system is initialized according to the external system connection information to obtain a script execution environment, including: Parse the preset configuration file to obtain external system connection information including host connection information, database connection information and middleware connection information; Initialize the host connection module according to the host connection information in the external system connection information to obtain a host connection object; initialize the database connection module based on the database connection information in the external system connection information to obtain a database connection object; input the middleware connection information in the external system connection information into the middleware connection module for initialization to obtain a middleware connection object; Initialize the internal command parser, and initialize the external command executor based on the host connection object, database connection object and middleware connection object to obtain a unified command execution rule; Input the preset large language model connection parameters into the large language model interface for connection, and obtain the large language model connection object; The host connection object, database connection object, middleware connection object, unified command execution rule and large language model connection object are integrated to obtain a script execution environment.

[0030] In this example, various connection information is read from the preset configuration file. The configuration file uses a structured data format, such as JSON, YAML or XML or a database file, to store the connection parameters of the external system involved in the script execution process. These parameters include the host's IP address, port number, user name and password, as well as the database connection string, middleware configuration and other information. The database connection information is the connection string of the MySQL database, which describes the database type, user, password and database name; the middleware information contains the middleware type and the corresponding network address. These connection information are parsed to generate an overall data structure of the external system connection information. The external system connection information is used to initialize multiple modules to achieve interaction with different system components. The host connection module is initialized according to the host connection information. The host connection module is responsible for establishing a remote connection with the target host, such as communicating with the host through the SSH protocol, so that the host can be remotely controlled and operated during the script execution process. The initialized host connection object contains all the information required to implement remote command execution, such as the host's IP address, user authentication information, etc., to ensure that the host is successfully accessed and operated. The database connection module is initialized based on the database connection information to generate a database connection object. The database connection object is used to interact with the database and contains the connection parameters required to perform database query, insert and update operations. Through these connection parameters, the database connection object can establish a connection channel with the database and ensure that the required data operations can be performed during the script execution. For example, if the database is of MySQL type, the database connection object will save the MySQL-specific connection information to achieve reliable access to data. For middleware connection information, this information is input into the middleware connection module for initialization to generate a middleware connection object. The middleware connection object is used to interact with external middleware services. Typical middleware such as Apache Kafka or RabbitMQ are used to achieve data exchange and message delivery between systems. Through the middleware connection object, the script execution environment can send data or subscribe to messages to the external message system, thereby achieving integration and collaboration between different systems. The middleware connection mechanism is suitable for processing complex business logic and allows data to flow and share between multiple systems. The system initializes the command processing component. First, initialize the internal command parser and set the command parsing rules, including prefix recognition rules (%% and %), parameter parsing rules, etc. Based on the three connection objects (host connection object, database connection object, and middleware connection object) that have been created, the system initializes the external command executor. During the executor initialization process, the system establishes a mapping relationship between command types and connection objects and generates unified command execution rules. These rules define how to select the corresponding connection object according to the command type, how to parse and convert command parameters, and how to process the execution results.The system establishes a connection with the large language model. The system reads the preset large language model connection parameters, including API address, authorization key, model parameters (temperature, maximum length, etc.) and request configuration (timeout, retry strategy, etc.). The system uses these parameters to establish a connection with the large language model through the API interface, performs interface testing and verification to ensure the availability of the connection, and finally encapsulates the connection into a large language model connection object. The system integrates all initialized generated components. The system creates a unified script execution environment object, encapsulating the host connection object, database connection object, middleware connection object, unified command execution rules and large language model connection object as its attributes. At the same time, the system also initializes components such as runtime variable storage space, command execution history recorder and state manager in the execution environment. This execution environment object will serve as a unified runtime environment for script execution, providing complete support for subsequent command parsing, execution and result processing.

[0031] In one example, the input script content is parsed to obtain a unified command queue and a label mapping table. The unified command queue includes: internal commands, external commands, and natural language commands, including: Perform line segmentation on the input script content to obtain a script line sequence; Perform prefix recognition processing on each line in the script line sequence to obtain a prefix type identifier with a %% prefix, a single % prefix, or no prefix; Based on the prefix type identifier, the script line sequence is processed with command marking, and the line starting with %% is marked as an internal command, the line starting with a single % is marked as an external command, and the line not starting with % is marked as a natural language command, thereby obtaining a unified command queue with command type markings; Perform type recognition processing on the lines marked as internal commands in the unified command queue, and recognize and mark the %%label command, %%call command, %%invoke command, %%alert command, %%mail command, and %%lua command; Based on the %%label command in the unified command queue, position mapping processing is performed to obtain a label set, and the label set and the corresponding script position are associated to obtain a label mapping table.

[0032] In this example, the system performs line segmentation on the input script content. The system uses the line feed character (\n) as a separator to segment the entire script text into independent text lines. During the segmentation process, the system also performs preprocessing: removes the blank characters at the beginning and end of each line, filters out blank lines and lines containing only blank characters, and unifies the line feed character format (converts \r\n to \n). The system assigns a unique line number to each valid text line, and constructs a line object with the line number and line content, which contains attributes such as line number, original content, and processed content. These line objects are organized into a script line sequence in the original order for subsequent processing. The system performs prefix recognition processing on each line in the script line sequence. The system uses the regular expression pattern "^(%%|%|[^%])" to match each line content and identify the first character of the line. For the matching results, the system creates corresponding prefix type identifiers according to different prefix patterns: when the line starts with "%%", an internal command prefix identifier is created; when the line starts with a single "%", an external command prefix identifier is created; when the line does not start with "%", a no prefix identifier is created. The system adds the prefix type identifier to the line object to form a line object sequence with prefix type information. The system performs command tagging on the script line sequence based on the prefix type identifier. The system traverses the line object sequence with prefix type information and adds command type tags to each line according to different prefix types: for internal command prefixes (%%), the system removes the prefix and marks it as an internal command type; for external command prefixes (%), the system removes the prefix and marks it as an external command type; for lines without prefixes, the system directly marks them as natural language command types. At the same time, the system generates a unique command ID for each command and creates a command object containing information such as command ID, command type tag, command content, and original line number. All command objects are organized in the original order to form a unified command queue with command type tags. The system performs further type identification processing on internal commands in the unified command queue. The system uses a command pattern matcher to analyze each command object marked as an internal command, extract command keywords, and perform type identification. The system contains a predefined internal command type mapping table that defines the following mapping relationships: Commands starting with "%%label" are mapped to label definition commands Commands starting with "%%call" are mapped to script call commands Commands starting with "%%invoke" are mapped to result reference commands Commands starting with "%%alert" are mapped to alarm commands Commands starting with "%%mail" are mapped to mail commands Commands starting with "%%lua" are mapped to Lua script commands The system adds the identified specific command type to the command object to form a complete internal command description. The system performs position mapping processing on the label definition commands in the unified command queue. The system first extracts all command objects of type "%%label" from the command queue, and parses the parameters of each label command to obtain the label name. The system creates a label object, which contains information such as the label name, the line number, and the position index in the unified command queue. These label objects constitute a label set. The system creates a label mapping table, using the label name as the key and the label object as the value to establish a mapping relationship from label to position. This mapping table will be used for subsequent command jumps and position positioning operations.

[0033] In one example, an internal command is directly executed when encountered, the internal command execution result is obtained, and the internal command execution result is stored in the script execution environment, including: D1: Traverse the unified command queue in order, execute the internal command directly when encountering it, obtain the currently executed command, and perform command recognition based on the type of the currently executed command to obtain the specific internal command type; D2: parse the parameters of the currently executed command according to the specific internal command type to obtain a command parameter set, and input the command parameter set into the corresponding internal command execution module for processing to obtain the internal command execution result; D3: Formatting the internal command execution result to obtain a standardized execution result, and updating the variables in the script execution environment based on the standardized execution result to obtain an updated script execution environment; D4: Locate the %%label command according to the label mapping table to obtain label location information; D5: Jump processing is performed on the %%call and %%invoke commands based on the label position information to obtain the position of the next command to be executed, and return to step D1 to continue execution until all internal commands are executed, and the internal command execution results are stored in the script execution environment.

[0034] In this example, the unified command queue is traversed sequentially, and internal commands are executed directly when encountered to obtain the current command to be executed. Command identification is performed based on the type of the currently executed command to obtain the specific internal command type. Assuming that a command in the current command queue is "%%call update_variable X 100", the type of the command is identified to determine which internal command type it belongs to. For example, the command starts with "%%call", which means it is a function call type command. The current command is parameter parsed according to the identified specific internal command type to obtain a command parameter set. The parameter set includes all the information required to execute the command, such as variable names, values, operators, etc. For example, the command "%%callupdate_variable X 100" is parsed as a parameter set. , where the variable The value is 100. Convert the command into a form that the system can understand and operate, so that these parameters can be passed to the corresponding internal command execution module for processing. Input the command parameter set to the corresponding internal command execution module for processing to obtain the execution result of the internal command. The execution result is the update of a variable, the return value of a function, or a specific operation status. After the execution is completed, the execution result of the internal command is formatted to obtain a standardized execution result. Based on the formatted execution result, the variables in the script execution environment are updated to ensure that the current execution status can be accurately recorded and reflected. In the updated execution environment, the "%%label" command is located according to the label mapping table so that subsequent function calls or event triggering commands (such as "%%call" or "%%invoke") can be correctly jumped. The label mapping table is a data structure used to store each label and its location information in the script. Assuming that the current command involves calling the label "%%label process_data", the label mapping table is used to locate the position of the label in the script. Based on the position of the label, the "%%call" or "%%invoke" command is jumped to find the position of the next command to be executed. After the jump processing is completed, the system will return to the sequential traversal process of the internal command and continue to execute the next command. The traversal and jump process continues until the entire internal command is executed. After each command is executed, the execution result is stored in the script execution environment to ensure that all execution information and state changes are recorded by the system for subsequent analysis and decision-making.

[0035] In one example, executing an external command on a host system, obtaining an external command execution result, and storing the external command execution result in a script execution environment include: E1: For external commands, when traversing the unified command queue, the current external command is encountered, and the current external command is parsed according to the external command execution rules in the script execution environment to obtain the target external system and command content; E2: searching for a connection object in the script execution environment based on the target external system to obtain a corresponding host connection object, database connection object or middleware connection object; E3: Input the command content into the corresponding connection object to execute the command, obtain the original execution result, and format the original execution result to obtain the external command execution result; E4: updating the variables in the script execution environment based on the external command execution result to obtain an updated script execution environment, and performing a status check on the updated script execution environment to obtain execution status information; E5: Determine whether to continue to execute the next external command according to the execution status information. If yes, return to step E1 to continue execution. If no, end the execution of the external command and store the execution result of the external command in the script execution environment.

[0036] In this example, for external commands, the unified command queue is traversed to obtain the external commands that need to be executed currently. During the traversal process, each time an external command to be executed is extracted from the external command, the external command is parsed according to the external command execution rules predefined in the script execution environment to determine the target external system corresponding to the external command and the command content that actually needs to be executed. The corresponding connection object is searched in the script execution environment based on the information of the target external system. There are multiple connection objects stored in the script execution environment, such as host connection objects, database connection objects, and middleware connection objects, each of which encapsulates the details required to establish communication with the external system. Select a suitable connection object according to the target system type of the external command. Assuming that the target external system type is a database system, the system will search for a database connection object in the script execution environment, and find the connection object corresponding to the target external system through the connection object search function, so that the connection object can be used to execute the external command next. The command content of the external command is input into the corresponding connection object to actually execute the command. The connection object encapsulates the specific protocol and logic required to execute the command, such as interacting with the database, sending messages to the middleware, etc. The result of the execution will be returned as the original execution result, which includes data query results, command execution status, external system response, etc. In order to ensure the uniformity of all execution results, the original execution result is formatted to generate a standardized external command execution result. Based on the external command execution result, the variables in the script execution environment are updated so that the script execution environment can reflect the execution status and results of the current external command, such as storing the queried data as variables, or updating the command execution status to success or failure. The updated script execution environment variable set is represented as: ; in, Represents the updated script execution environment variable set, is the variable set before updating, The result of the external command execution. By merging the execution result with the original variable set, the script execution environment is dynamically updated to ensure that the status after each step of execution can be accurately recorded. While updating the script execution environment, the updated execution environment is checked to obtain the execution status information. The goal of the status check is to determine whether the current execution environment is in a normal state and whether it is necessary to continue to execute the next external command. For example, the status check includes judging whether the command execution is successful or not, evaluating the response time of the external system, or verifying the content of the execution result. If the result of the status check shows that the execution is normal and there are no exceptions, continue to execute the next external command; otherwise, if an exception is detected or a specific stop condition is met, stop further traversal of the external command. The result of the status check is represented as a Boolean variable: ; in, It is the execution status information. The Boolean value is True, which means to continue to execute the next command. False means to stop the execution. is the status check function, The updated script execution environment variable set. According to the value of the status information, decide whether to return to the traversal step of the external command and continue to execute the next external command. Store the external command execution result in the script execution environment.

[0037] In one example, a natural language command is input into a large language model for processing to obtain a natural language processing result, and an executable instruction is generated based on the natural language processing result, including: For the natural language command, context association processing is performed on the unified command queue to obtain first context information; wherein the internal command execution result and the external command execution result are used as the context information of the natural language command; Supplementing the first context information based on variables in the script execution environment and the executed command results to obtain second context information; Inputting the second context information into the large language model for natural language understanding and generation to obtain a natural language processing result; Parse the natural language processing results to obtain structured data, and perform instruction recognition based on the structured data to obtain executable instructions; Classify the executable instructions to obtain an internal instruction subset and an external instruction subset; Convert the internal instruction subset into an internal command format to obtain a newly added internal command, and add the newly added internal command to a unified command queue, while using the natural language processing result as the execution context information of the internal command; The external instruction subset is converted into an external command format to obtain a newly added external command, and the newly added external command is added to the unified command queue, and the natural language processing result is used as the execution context information of the external command.

[0038] In this example, the system performs context association processing for natural language commands. The system maintains a context processor, which first obtains the context window of the current natural language command from the unified command queue (by default, 5 commands before and after). For the internal command execution results in the window, the system extracts: execution status (success / failure), return value, execution time and other information; for the external command execution results, the system obtains: command output content, execution status code, error information and other data. The system organizes these execution results into structured context data according to the predefined context template. At the same time, the system also maintains a command dependency graph to record the call relationship and data flow between commands for understanding the context association of command execution. All this information is integrated into the first context information. The system performs supplementary processing on the first context information based on the script execution environment. The system extracts the current runtime status information from the script execution environment, including: key-value pairs of environment variables, temporary variables in memory, statistical information of command execution (such as the number of executions of various commands, average response time, success rate, etc.), and system resource usage (CPU usage, memory usage, etc.). At the same time, the system also obtains the complete history of executed commands, including the execution time, parameter values, and return results of each command. The system organizes this supplementary information in a structured way and merges it with the first context information to form a more complete second context information. The system sends the complete second context information to the large language model for processing. The system encapsulates the context information in the format required by the model (usually JSON format) through the pre-configured API interface, sets appropriate model parameters (such as temperature, max_tokens, etc.), and then sends the API request. Based on its training knowledge and the provided context information, the large language model semantically understands and processes the natural language commands and generates a response result. The system receives the processing results returned by the model and performs request status verification and error handling. The system parses and structures the natural language processing results. The system uses a JSON parser to parse the results returned by the model and extract key information, including: understood intent, recognized entities, recommended operations, etc. The system converts this information into a standard structured data format and constructs an instruction object. Each instruction object contains attributes such as operation type, target object, parameter list, and execution conditions. The system maps structured data to specific executable instructions through predefined instruction pattern matching rules. The system classifies the executable instructions obtained. The system maintains an instruction classifier, which divides instructions into two categories according to the operation type and target object of the instruction: internal instruction subsets (such as creating tags, calling scripts, sending alarms, etc.) and external instruction subsets (such as executing Shell commands, database operations, middleware calls, etc.). The classification process refers to the predefined instruction type mapping table to ensure that the instructions are correctly classified.For the subset of internal commands, the system performs standardized conversion processing. The system converts each internal command into a new command object that conforms to the internal command format, including: adding the %% prefix, setting the command type identifier, formatting the parameter list, etc. At the same time, the system attaches the original natural language processing results (including intent understanding, parameter interpretation, etc.) as metadata to the context information of the new command object. These newly added internal commands are added to the appropriate position of the unified command queue to maintain the correctness of the execution order. For the subset of external commands, the system also performs standardized conversion processing. The system converts each external command into a new command object that conforms to the external command format, including: adding the % prefix, specifying the target system, constructing the command string, etc. Similarly, the system attaches the natural language processing results as metadata to the context information of the new command object. These newly added external commands are also added to the appropriate position of the unified command queue.

[0039] In one example, the command execution results are summarized and analyzed to obtain an execution report, and a decision result is generated based on the execution report, including: Collecting the internal command execution result, the external command execution result and the natural language processing result to obtain a script execution output result, wherein the script execution output result includes a calculation result, a logic analysis result or abnormal alarm information defined by the script; Recording the execution process of the internal command, the external command and the natural language command in a log to obtain process log information, wherein the process log information includes command execution time, execution status and error information; Formatting the script execution output result based on a preset report template to obtain a structured execution report; The process log information is added to the execution report as debugging information to obtain a final execution report, and the final execution report is stored in the script execution environment.

[0040] In this example, the system collects and processes the script execution results. The system maintains a result collector, which captures various outputs generated during the script execution process in real time: for internal command execution results, the collector obtains the command return value, such as the location information defined by the %%label command, the call return value of the %%call command, the execution result referenced by the %%invoke command, the alarm information triggered by the %%alert command, the sending status of the %%mail command, and the script calculation result of the %%lua command; for external command execution results, the collector obtains the execution output of the command on the host, database, or middleware, such as the standard output of the Shell command, the result set of the database query, and the response data of the middleware call; for the processing results of natural language commands, the collector obtains the calculation results, analysis conclusions, or business decisions generated after processing by the large language model. These execution results are organized according to the output format defined by the script to form the script execution output results. The system logs the command execution process. The system implements a logger to record detailed information during the script execution process: record the execution timestamp and execution time of each command; record the execution status of the command (success / failure); record the warning or error information that occurs during the execution process; record the input parameters and intermediate status of the command execution. This information is used as a process log and is mainly used for script debugging and troubleshooting. The system uses a preset report template to format the output results of the script execution. The system defines a standard output format template and selects the corresponding template for formatting according to different types of output results: for numerical calculation results, the data table format is used; for logical analysis results, the structured text format is used; for alarm information, the alarm message format is used. Through template processing, the system converts the original execution output into a structured execution report. The system adds the process log information as debugging information to the execution report. The system adds a detailed log of command execution in the appendix of the execution report, including a complete execution timeline, state change records, and error tracking information. These debugging information help users understand the script execution process and facilitate the discovery and resolution of problems. The system stores the final execution report containing the execution results and debugging information in the script execution environment for subsequent query and analysis. In this embodiment, the system completes the collection and organization of script execution results and generates a complete execution report including output results and debugging information.

[0041] Reference Figure 2 This embodiment provides a natural language-based scripting language and a system using the scripting language, including: Initialization module 1 is used to read the preset configuration file, obtain the external system connection information, and initialize the host system according to the external system connection information to obtain the script execution environment; Parsing module 2 is used to parse the input script content to obtain a unified command queue and a label mapping table. The unified command queue includes: internal commands, external commands and natural language commands; The command execution module 3 is used to sequentially execute the commands in the unified command queue according to the label mapping table, obtain the command execution results, and store the command execution results in the script execution environment; specifically includes: directly executing the internal command when encountering it, obtaining the internal command execution result, and storing the internal command execution result in the script execution environment; executing the external command on the host system, obtaining the external command execution result, and storing the external command execution result in the script execution environment; inputting the natural language command into the large language model for processing, obtaining the natural language processing result, and generating executable instructions based on the natural language processing result; The generation module 4 is used to summarize and analyze the command execution results, obtain an execution report, and generate a decision result based on the execution report.

[0042] In this embodiment, for the specific implementation of each unit in the above system embodiment, please refer to the above method embodiment, which will not be repeated here.

[0043] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface and a database connected through a system bus. Among them, the processor designed by the computer 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, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.

[0044] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied.

[0045] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.

[0046] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods 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 memory, storage, database or other media provided by the present invention and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.

[0047] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, system, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, system, article or method. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, system, article or method including the element.

[0048] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A scripting language based on natural language and a method for using the scripting language, characterized in that: The following steps are involved: Reading a preset configuration file to obtain external system connection information, and initializing the host system according to the external system connection information to obtain a script execution environment; Parsing the input script content to obtain a unified command queue and a label mapping table, wherein the unified command queue includes: internal commands, external commands, and natural language commands; The commands in the unified command queue are sequentially executed according to the label mapping table to obtain command execution results, and the command execution results are stored in the script execution environment; specifically including: directly executing internal commands when encountering them to obtain internal command execution results, and storing the internal command execution results in the script execution environment; executing external commands on the host system to obtain external command execution results, and storing the external command execution results in the script execution environment; inputting the natural language commands into a large language model for processing to obtain natural language processing results, and generating executable instructions based on the natural language processing results; The command execution results are summarized and analyzed to obtain an execution report.

2. The natural language-based scripting language and the method for using the scripting language according to claim 1, characterized in that: The step of reading the preset configuration file to obtain external system connection information, initializing the host system according to the external system connection information, and obtaining the script execution environment includes: Parse the preset configuration file to obtain external system connection information including host connection information, database connection information and middleware connection information; Initialize the host connection module according to the host connection information in the external system connection information to obtain a host connection object; initialize the database connection module based on the database connection information in the external system connection information to obtain a database connection object; input the middleware connection information in the external system connection information into the middleware connection module for initialization to obtain a middleware connection object; Initializing an internal command parser, and initializing an external command executor based on the host connection object, the database connection object, and the middleware connection object to obtain a unified command execution rule; Input the preset large language model connection parameters into the large language model interface for connection, and obtain the large language model connection object; The host connection object, the database connection object, the middleware connection object, the unified command execution rule and the large language model connection object are integrated to obtain the script execution environment.

3. The natural language-based scripting language and the method for using the scripting language according to claim 1, characterized in that: The input script content is parsed to obtain a unified command queue and a label mapping table, wherein the unified command queue includes: internal commands, external commands and natural language commands, including: Performing line segmentation processing on the input script content to obtain a script line sequence; Perform prefix recognition processing on each line in the script line sequence to obtain a prefix type identifier having a %% prefix, a single % prefix, or no prefix; Performing command marking processing on the script line sequence based on the prefix type identifier, marking the line starting with %% as an internal command, marking the line starting with a single % as an external command, and marking the line not starting with % as a natural language command, to obtain a unified command queue with command type markings; Performing type recognition processing on the lines marked as internal commands in the unified command queue, identifying and marking %%label commands, %%call commands, %%invoke commands, %%alert commands, %%mail commands, and %%lua commands; Position mapping processing is performed based on the %%label command in the unified command queue to obtain a label set, and the label set and the corresponding script position are associated to obtain a label mapping table.

4. The natural language-based scripting language and the method for using the scripting language according to claim 1, characterized in that: The directly executing the internal command encountered, obtaining the internal command execution result, and storing the internal command execution result in the script execution environment includes: D1: sequentially traverse the unified command queue, directly execute an internal command when encountering it, obtain the currently executed command, and perform command recognition based on the type of the currently executed command to obtain a specific internal command type; D2: parsing the parameters of the currently executed command according to the specific internal command type to obtain a command parameter set, and inputting the command parameter set into a corresponding internal command execution module for processing to obtain an internal command execution result; D3: Formatting the internal command execution result to obtain a standardized execution result, and updating the variables in the script execution environment based on the standardized execution result to obtain an updated script execution environment; D4: Position the %%label command according to the label mapping table to obtain label position information; D5: Based on the label position information, the %%call and %%invoke commands are redirected to obtain the position of the next command to be executed, and the process returns to step D1 to continue execution until all the internal commands are executed, and the execution results of the internal commands are stored in the script execution environment.

5. The natural language-based scripting language and the method for using the scripting language according to claim 1, characterized in that: The executing the external command on the host system to obtain the external command execution result, and storing the external command execution result in the script execution environment includes: E1: When traversing the unified command queue for the external command, a current external command is encountered, and the current external command is parsed according to the external command execution rule in the script execution environment to obtain a target external system and command content; E2: searching for a connection object in the script execution environment based on the target external system to obtain a corresponding host connection object, database connection object or middleware connection object; E3: input the command content into the corresponding connection object to execute the command, obtain an original execution result, and format the original execution result to obtain an external command execution result; E4: updating the variables in the script execution environment based on the external command execution result to obtain an updated script execution environment, and performing a status check on the updated script execution environment to obtain execution status information; E5: Determine whether to continue to execute the next external command according to the execution status information. If yes, return to step E1 to continue execution. If no, end the execution of the external command and store the execution result of the external command in the script execution environment.

6. The natural language-based scripting language and the method for using the scripting language according to claim 1, characterized in that: The inputting the natural language command into the large language model for processing to obtain a natural language processing result, and generating an executable instruction based on the natural language processing result, includes: For the natural language command, context association processing is performed on the unified command queue to obtain first context information; wherein the internal command execution result and the external command execution result are used as the context information of the natural language command; Supplementing the first context information based on the variables in the script execution environment and the executed command results to obtain second context information; Inputting the second context information into the large language model to perform natural language understanding and generation to obtain a natural language processing result; Parsing the natural language processing result to obtain structured data, and performing instruction recognition based on the structured data to obtain executable instructions; Classifying the executable instructions to obtain an internal instruction subset and an external instruction subset; Converting the internal instruction subset into an internal command format to obtain a newly added internal command, and adding the newly added internal command to a unified command queue, while using the natural language processing result as execution context information of the internal command; The external instruction subset is converted into an external command format to obtain a newly added external command, and the newly added external command is added to a unified command queue, and the natural language processing result is used as execution context information of the external command.

7. The natural language-based scripting language and the method for using the scripting language according to claim 6, characterized in that: The command execution results are summarized and analyzed to obtain an execution report, including: Collecting the internal command execution result, the external command execution result and the natural language processing result to obtain a script execution output result, wherein the script execution output result includes a calculation result, a logic analysis result or abnormal alarm information defined by the script; Recording the execution process of the internal command, the external command and the natural language command in a log to obtain process log information, wherein the process log information includes command execution time, execution status and error information; Formatting the script execution output result based on a preset report template to obtain a structured execution report; The process log information is added to the execution report as debugging information to obtain a final execution report, and the final execution report is stored in the script execution environment.

8. A scripting language based on natural language and a system using the scripting language, characterized in that: For implementing the steps of the method according to any one of claims 1 to 7, the system comprises: An initialization module is used to read a preset configuration file, obtain external system connection information, and initialize the host system according to the external system connection information to obtain a script execution environment; A parsing module, used to parse the input script content to obtain a unified command queue and a label mapping table, wherein the unified command queue includes: internal commands, external commands and natural language commands; A command execution module is used to sequentially execute the commands in the unified command queue according to the label mapping table, obtain command execution results, and store the command execution results in the script execution environment; specifically including: directly executing internal commands when encountering them, obtaining internal command execution results, and storing the internal command execution results in the script execution environment; executing external commands on the host system, obtaining external command execution results, and storing the external command execution results in the script execution environment; inputting the natural language commands into a large language model for processing, obtaining natural language processing results, and generating executable instructions based on the natural language processing results; The generation module is used to summarize and analyze the command execution results to obtain an execution report.

9. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. 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 7 are implemented.

Citation Information

Cited By

  • Method and device for determining type input by user

    CN122112238A

  • Method and apparatus for determining type of user input

    CN122112238B