Script generation method and apparatus for robotic process automation framework
By constructing structured prompts and multi-dimensional compliance checks, the robot process automation scripts are adaptively generated, solving the problems of high development threshold and poor scenario adaptability, and realizing script generation with low threshold and high adaptability.
Patent Information
- Application Number
- CN202611061339.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-16
- Publication Date
- 2026-11-20
AI Technical Summary
Existing robotic process automation (RPA) script generation solutions suffer from high development barriers and poor scenario adaptability. Manually writing scripts requires professional programming skills, while general AI code generation tools lack RPA framework-specific constraints, resulting in non-compliant generated code. RPA built-in template generation tools have rigid logic that makes them difficult to adapt to complex business logic.
By constructing structured prompts, script code is generated based on the user's input description of needs and a preset API whitelist. Multi-dimensional compliance checks, environmental health pre-checks, and isolation sandbox tests are performed, and the generation mode is adaptively switched to ensure that the script code conforms to the framework specifications.
It lowers the development threshold, improves scenario adaptability, effectively avoids illegal code and runtime risks, and ensures that the generated script code complies with specifications and security.
Smart Images

Figure CN123137653A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automation, and in particular to a script generation method and apparatus for a robotic process automation framework. Background Technology
[0002] Robotic process automation (RPA) refers to an automated control method that uses executable scripts to automatically arrange sequences of business operations and automatically execute repetitive business tasks in industrial or office settings. It is typically used to replace manual execution of fixed and repetitive business operations.
[0003] Currently, common solutions for generating Robotic Process Automation (RPA) scripts in related technologies employ manual script writing, general AI (Artificial Intelligence) code generation tools, and built-in RPA template generation tools. However, manual script writing requires users to possess professional programming skills, making it difficult for business personnel to independently write and modify scripts. General AI code generation tools lack RPA framework-specific constraints, resulting in generated code that does not conform to framework specifications and suffers from issues such as illegal function calls and parameter errors, making direct integration impossible. RPA built-in template generation tools have rigid logic, making it difficult to adapt to complex business logic involving data interaction and multi-branch decision-making.
[0004] Therefore, existing script generation solutions suffer from high development barriers and poor scenario adaptability. Summary of the Invention
[0005] The main objective of this application is to propose a script generation method and apparatus for robotic process automation frameworks, aiming to reduce the development threshold and improve scenario adaptability.
[0006] To achieve the above objectives, this application proposes a script generation method for a robotic process automation framework, comprising: Structured prompts are constructed based on the user's input description of requirements and a preset API whitelist, wherein the description of requirements includes a data contract declaration; The target generation mode is invoked to generate script code based on the structured prompt words, and multi-dimensional compliance verification is performed on the script code; When the multidimensional compliance verification fails, the structured prompt word is updated, and the script code to be generated based on the structured prompt word is re-executed according to the target generation mode. When the multidimensional compliance verification is passed, the completion code generated according to the read and write operation type in the data contract declaration is embedded into the script code. The script code is then subjected to environmental health pre-check and isolation sandbox test. When both the pre-check and test are passed, the script code is written into the script directory of the robotic process automation framework.
[0007] In some embodiments, constructing structured prompts based on user-inputted demand descriptions and a preset API whitelist includes: The system receives the user's input of the requirement description, which includes a business description and a data contract declaration. The data contract declaration includes at least the contract name, data type, and read / write operation type. Read the preset API whitelist, and encapsulate the requirement description and the preset API whitelist into a context to obtain the structured prompt words.
[0008] In some embodiments, the step of invoking the target generation pattern to generate script code based on the structured prompt words includes: Check whether the AI model interface is valid and whether the user input instruction for selecting the human-machine collaboration mode has been received; If the AI model interface is valid and the human-machine collaboration mode selection instruction is not received, then the fully automatic API mode is determined as the target generation mode, and the fully automatic API mode is called to generate script code based on the structured prompt words; If the AI model interface is invalid and / or the human-machine collaboration mode selection instruction is received, the human-machine collaboration mode is determined as the target generation mode, and the human-machine collaboration mode is invoked to generate script code based on the structured prompt words.
[0009] In some embodiments, performing multidimensional compliance verification on the script code includes: Perform syntax validation on the script code to check whether there are any syntax errors in the script code; The script code is subjected to API compliance verification to check whether all function call nodes in the script code are within the preset API whitelist. The script code is subjected to security verification to check whether there are any high-risk operation functions within the script code; The script code is subjected to import validity verification, which verifies whether all import statements in the script code are within the allowed import modules of the Robotic Process Automation framework; If any of the four checks fails, the multidimensional compliance check is determined to have failed, and the corresponding error source code and error information are collected. If all four checks pass, the multidimensional compliance check is considered successful.
[0010] In some embodiments, updating the structured prompt and re-executing the target generation mode to generate script code based on the structured prompt according to the updated structured prompt includes: Check whether the number of times the script code is regenerated is greater than a preset number; If not, then update the structured prompt word according to the original error code, the error message and the requirement description, and re-execute the call target generation mode to generate script code according to the structured prompt word according to the updated structured prompt word; If so, a script is generated to produce a failure report based on the source code of the error, the error message, and the requirement description.
[0011] In some embodiments, embedding the completed code generated based on the read / write operation type in the data contract declaration into the script code includes: Detect the read / write operation type in the data contract declaration; If the read / write operation type is write, then write business code that stores the data into the context variable pool is generated; If the read / write operation type is read, then read business code that reads data from the context variable pool is generated, and verification code for data existence and type verification is generated. The write business code and / or the read business code, along with the verification code, are embedded into the script code to complete the script code.
[0012] In some embodiments, performing environmental health pre-checks and isolation sandbox tests on the script code includes: Identify the type of Skill called in the script code; According to the Skill type, match several pre-check environment items from the preset environment mapping table, and perform pre-checks on several pre-check environment items. The pre-check environment items include: browser driver file existence and version matching, business program process and window existence, network port connectivity or data source file existence and readability. If all of the pre-check environment items pass the pre-check, the script code is subjected to the isolation sandbox test. If a pre-inspection fails among several of the pre-inspection environment items, an environmental diagnostic report is generated based on the pre-inspection environment item corresponding to the pre-inspection failure and the reason for the failure.
[0013] In some embodiments, performing the isolation sandbox test on the script code includes: Create an isolated sandbox runtime environment, which is configured with an independent code namespace, a variable pool snapshot mechanism, execution timeout protection, and a simulated execution context; The script code is loaded into the isolated sandbox runtime environment and run. Capture the script code's log output, variable changes, and program stack information during execution; Determine whether there is any abnormal data in the log output, the variable changes, and the program stack information; If no abnormal data is found, the isolation sandbox test is considered passed. If abnormal data is found, the abnormal data and abnormal stack information are collected, the structured prompt words are updated based on the abnormal data and abnormal stack information, and the script code is regenerated.
[0014] In some embodiments, the process of loading the script code into the isolated sandbox runtime environment for execution further includes: According to the Skill type, a corresponding verification case is matched from a preset verification case library. The preset verification case library is created by the user for the type of business program. Each verification case contains a minimal test script that covers the core operations of the business program. The verification case is executed by calling the isolated sandbox runtime environment to verify whether the behavior of the business program in the isolated sandbox runtime environment is consistent with expectations. If they match, then the script code will be loaded into the isolated sandbox environment and run. If there is a discrepancy, the execution difference information of the verification case is collected, the parameters of the verification case are adjusted according to the execution difference information, and the verification case is re-executed by calling the isolated sandbox runtime environment.
[0015] This application further proposes a script generation device for a robotic process automation framework, comprising: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that are executed by the at least one processor to enable the at least one processor to execute the script generation method for the robotic process automation framework described above.
[0016] This application's technical solution constructs structured prompts based on user-inputted requirements and a pre-defined API whitelist. The requirements include a data contract declaration. The target generation mode is invoked to generate script code based on the structured prompts, and multi-dimensional compliance checks are performed on the script code. If multi-dimensional compliance checks fail, the structured prompts are updated, and the target generation mode is re-invoked to generate script code based on the updated prompts. If multi-dimensional compliance checks pass, the completed code generated based on the read / write operation types in the data contract declaration is embedded into the script code. Environmental health pre-checks and isolation sandbox tests are performed on the script code. If both pre-checks and tests pass, the script code is written to the script directory of the robotic process automation framework. By constraining script code generation with structured prompts and verifying the script code through multi-dimensional compliance checks, environmental health pre-checks, and isolation sandbox tests, illegal code and operational risks are effectively avoided, reducing development barriers and improving scenario adaptability. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating an embodiment of the script generation method for the robotic process automation framework of this application. Figure 2 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. Figure 3 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. Figure 4 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. Figure 5 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. Figure 6 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. Figure 7 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. Figure 8 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. Figure 9 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. Figure 10 This is a schematic diagram of an embodiment of the script generation device for the robotic process automation framework of this application. Detailed Implementation
[0018] The solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments in this application, and not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0019] It should be noted that all directional indicators (such as up, down, left, right, front, back, etc.) in the embodiments of this application are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicator will also change accordingly.
[0020] It should also be noted that when a component is described as "fixed to" or "set on" another component, it can be directly on the other component or there may be an intervening component present. When a component is described as "connected to" another component, it can be directly connected to the other component or there may be an intervening component present.
[0021] Furthermore, the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. When the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed in this application.
[0022] This application proposes a script generation method for a robotic process automation framework, referring to... Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the script generation method for a robotic process automation (RPA) framework according to this application. In some embodiments, the script generation method for the RPA framework includes: Step S110: Construct structured prompts based on the user's input requirement description and preset API whitelist. The requirement description includes a data contract statement. Step S120: Invoke the target generation mode to generate script code based on structured prompts, and perform multi-dimensional compliance verification on the script code; Step S130: When the multidimensional compliance verification fails, update the structured prompt words, and re-execute the call to the target generation mode to generate script code based on the structured prompt words according to the updated structured prompt words; Step S140: When the multi-dimensional compliance verification is passed, the completion code generated according to the read and write operation type in the data contract declaration is embedded into the script code. The script code is subjected to environmental health pre-check and isolation sandbox test. When both the pre-check and test are passed, the script code is written into the script directory of the robotic process automation framework.
[0023] In this embodiment, as Figure 1 As shown, the script generation method for the robotic process automation (RPA) framework proposed in this application can be configured as a running program, functional software, or packaged as firmware, control driver, or independent functional module; then it is deployed to the RPA-based script generation device so that the RPA-based script generation device can run the RPA-based script generation method. The RPA-based script generation device can be simply referred to as the generation device.
[0024] When running a script generation method for a robotic process automation (RoMA) framework, the generation device can construct structured prompts based on user-inputted requirements and a pre-defined API whitelist. The requirements description includes data contract declarations. For example, the pre-defined API (Application Programming Interface) whitelist can be pre-configured by the user into the generation device according to actual needs. The pre-defined API whitelist can include window operation APIs, Excel operation APIs, web page operation APIs, context interfaces, and return formats. For instance, window operation APIs can include `full_input_sequence`, `activate_window`, `click_at`, and `clear_input`. Excel operation APIs can include `COMHelper.get_application`, `COMHelper.write_cell`, and `COMHelper.get_sheet`. Web page operation APIs can include `PlaywrightHelper`, `wait_for_element`, `fill`, `click`, and `get_table_rows`. Context interfaces can include `get_variable`, `set_variable`, `wait_for_event`, and `send_tcp`. Return formats can include `success`, `need_loop`, `variables`, `message`, `error`, and `cancel`.
[0025] Users can configure a corresponding requirement description based on the script code they want to generate, and then input the requirement description into the generation device. The generation device then receives the user-input requirement description. After receiving the requirement description, the generation device can read a preset API whitelist and then construct structured prompts based on the user-input requirement description and the preset API whitelist.
[0026] After constructing the structured prompts, the target generation mode can be invoked to generate script code based on the structured prompts, and multi-dimensional compliance checks can be performed on the script code. For example, after constructing the structured prompts, the generation device can detect the connectivity and validity of the AI model interface in real time, and determine if the user has selected a generation mode preference (e.g., whether the user's input instruction to select a human-machine collaboration mode has been received). The target generation mode can be adaptively switched according to the status of the AI model interface and the user's preference. For example, when the AI model interface is valid and the user has not specified a human-machine collaboration mode, the structured prompts are automatically loaded using the fully automatic API mode to complete the intelligent generation of the script code. When the AI model interface is invalid, the network environment is restricted, or the user is in an intranet isolation scenario, or the user actively selects the human-machine collaboration mode, the system automatically switches to the human-machine collaboration mode and completes the script code construction through prompt export, manual assistance generation, and automatic content parsing, ensuring the availability of the script generation function under different network environments. In addition, the target generation mode can be determined based on the user's selection. If the user selects the human-machine collaboration mode, it will automatically switch to the human-machine collaboration mode; if the user selects the fully automatic API mode, it can first detect the AI model interface in real time, and automatically adopt the fully automatic API mode when the AI model interface is valid.
[0027] In human-machine collaboration mode, the generation device can export the preset API whitelist, structured prompts, output format requirements, and current workflow context into a structured, readable text file, which can be copied by the operator to an offline AI tool or a web-based AI model for code generation. The operator can then paste the generated results from the offline AI tool or web-based AI model back into the generation device, which will automatically parse and identify the valid code content and extract the corresponding script code.
[0028] After generating the script code, the generation device can perform multi-dimensional compliance checks on the script code. For example, it can sequentially perform syntax checks, API compliance checks, high-risk operation security checks, and imported module validity checks to comprehensively screen for syntax errors, illegal function calls outside the whitelist, high-risk operation code, and unauthorized module import issues in the script code.
[0029] When multi-dimensional compliance verification fails, the structured prompts are updated, and the target generation mode is re-executed to generate script code based on the updated prompts. For example, during multi-dimensional compliance verification, if any verification fails, the generation device can automatically collect the corresponding error source code and error information, update the structured prompts based on the original requirement description, and count the number of script regenerations. If the preset maximum number of retries is not exceeded, the target generation mode is iteratively called to regenerate the script code. If the verification still fails after multiple iterations and repairs, a script generation failure report is automatically generated, terminating the current generation process, thus realizing an automatic error correction and closed-loop retry mechanism for script generation.
[0030] Upon successful multi-dimensional compliance verification, the completed code generated based on the read / write operation types in the data contract declaration is embedded into the script code. The script code then undergoes environmental health pre-checks and isolation sandbox tests. If both pre-checks and tests pass, the script code is written to the script directory of the robotic process automation framework. For example, if all multi-dimensional compliance checks pass, the generation device can generate corresponding data read / write code and verification code based on the read / write operation types in the data contract declaration, and embed the generated code as completed code into the script code. The completed code is generated by the generation device according to a preset template, conforms to the framework specifications, and does not require the aforementioned multi-dimensional compliance verification. Then, the script code undergoes environmental health pre-checks and isolation sandbox tests. If both pre-checks and tests pass, the script code is written to the script directory of the robotic process automation framework.
[0031] This application's technical solution constructs structured prompts based on user-inputted requirements and a pre-defined API whitelist. The requirements include a data contract declaration. The target generation mode is invoked to generate script code based on the structured prompts, and multi-dimensional compliance checks are performed on the script code. If multi-dimensional compliance checks fail, the structured prompts are updated, and the target generation mode is re-invoked to generate script code based on the updated prompts. If multi-dimensional compliance checks pass, the completed code generated based on the read / write operation types in the data contract declaration is embedded into the script code. Environmental health pre-checks and isolation sandbox tests are performed on the script code. If both pre-checks and tests pass, the script code is written to the script directory of the robotic process automation framework. By constraining script code generation with structured prompts and verifying the script code through multi-dimensional compliance checks, environmental health pre-checks, and isolation sandbox tests, illegal code and operational risks are effectively avoided, reducing development barriers and improving scenario adaptability.
[0032] Reference Figure 2 , Figure 2This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. In some embodiments, the aforementioned construction of structured prompts based on user-inputted demand descriptions and a preset API whitelist includes: Step S150: Receive user input of requirement description, which includes business description and data contract declaration. The data contract declaration includes at least contract name, data type, and read / write operation type. Step S151: Read the preset API whitelist, and encapsulate the requirement description and the preset API whitelist into a context to obtain structured prompt words.
[0033] In this embodiment, as Figure 2 As shown, during step S110, the generator can first receive the user-inputted requirement description. The requirement description includes a business description and a data contract declaration. The data contract declaration at least includes the contract name, data type, and read / write operation type. For example, the data contract declaration can also include a description and example values. The contract name is a unique identifier for the data, using Upper Camel Case, such as SN, QueryResult, or ProductInfo. The data type can be String, Int, Bool, List, Dict, etc. The read / write operation type can be write (producer) or read (consumer). The description is a description of the data's meaning, such as the scanned SN code. The example value is sample data used for debugging. The user can configure the corresponding requirement description according to their needs and then input it into the generator. At this point, the generator can receive the user-input requirement description.
[0034] Example business scenario: The production line needs to process serial number (SN) codes in batches. Step 1: Scan the SN codes and write them to the shared data area. Step 5: Query product information based on the SN. In this way, users can configure the requirement description according to the needs of the production line.
[0035] Producer's data contract declaration (Step 1: Write SN): Contract name: SN, Data type: String, Read / write operation type: Write, Description: SN code obtained by scanning.
[0036] Consumer's Data Contract Declaration (Step 5 Read SN): Contract Name: SN, Data Type: String, Read / Write Operation Type: Read, Description: Product SN Code.
[0037] Upon receiving the requirement description, the system can read the preset API whitelist and encapsulate the requirement description and the preset API whitelist into a contextualized prompt. For example, after receiving the requirement description, the generation device can read the preset API whitelist to filter out a set of legitimate APIs suitable for the current business scenario. For scenarios involving batch processing of serial numbers, it can match compliant APIs for window operations, device scanning, data reading and writing, and network queries, while eliminating all high-risk functions, external modules, and illegal interfaces that are not authorized by the framework.
[0038] The generation device integrates and encapsulates the user-inputted business description and data contract declaration with the filtered preset API whitelist constraint rules, and unifies them into standardized, structured prompts with constraint fields.
[0039] Reference Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of the script generation method for a robotic process automation framework according to this application. In some embodiments, the aforementioned call target generation pattern generates script code based on structured prompts, including: Step S160: Detect whether the AI model interface is valid and whether the user input instruction for selecting the human-machine collaboration mode has been received; Step S161: If the AI model interface is valid and no human-machine collaboration mode selection instruction is received, then the fully automatic API mode is determined as the target generation mode, and the fully automatic API mode is called to generate script code based on the structured prompt words. Step S162: If the AI model interface is invalid and / or a human-machine collaboration mode selection instruction is received, the human-machine collaboration mode is determined as the target generation mode, and the human-machine collaboration mode is called to generate script code based on structured prompts.
[0040] In this embodiment, as Figure 3 As shown, when generating script code based on structured prompts in step S120, the AI model interface can be checked for validity first. The generation device checks whether the AI model interface is valid and whether it has received a user-inputted human-machine collaboration mode selection instruction. For example, after constructing the structured prompts, the generation device can first perform an AI model interface validity check operation to verify the network connectivity, interface authentication status, and service availability of the cloud AI model interface in real time, thereby determining whether the current environment supports online fully automatic script generation; it also checks whether a user-inputted human-machine collaboration mode selection instruction has been received.
[0041] If the AI model interface is valid and no human-machine collaboration mode selection instruction has been received, the fully automatic API mode is determined as the target generation mode, and the fully automatic API mode is invoked to generate script code based on structured prompts. For example, if the AI model interface is detected to be valid, the network link is normal, and the service can be called normally, and no human-machine collaboration mode selection instruction has been received, the generation device can determine the fully automatic API mode as the target generation mode and invoke the fully automatic API mode to generate script code based on structured prompts. The fully automatic API mode can directly push the encapsulated structured prompts as input parameters to the AI model interface automatically. The AI model then automatically infers, writes, and outputs script code based on the business description, data contract declaration, and preset API whitelist in the structured prompts, without any manual intervention. This achieves intelligent and rapid generation of script code, suitable for regular office and production scenarios with normal network connectivity and access to cloud services.
[0042] For example, calling the fully automatic API mode to generate script code based on structured prompts: Example business scenario: The production line needs to process serial number (SN) codes in batches. Step 1: Scan the SN codes and write them to the shared data area. Step 5: Query product information based on the SN. In this way, users can configure the requirement description according to the needs of the production line.
[0043] Producer's data contract declaration (Step 1: Write SN): Contract name: SN, Data type: String, Read / write operation type: Write, Description: SN code obtained by scanning.
[0044] Consumer's Data Contract Declaration (Step 5 Read SN): Contract Name: SN, Data Type: String, Read / Write Operation Type: Read, Description: Product SN Code.
[0045] Generated producer code (Step 1: Write SN): Python async def execute(context): variables = context.get('variables', {}) sn = scan_sn_from_scanner() variables['SN'] = sn # Use the contract name SN as the key return {'success': True, 'need_loop': True, 'variables':variables}.
[0046] Generated consumer code (Step 5: Read SN): Python async def execute(context): variables = context.get('variables', {}) sn = variables.get('SN') if sn is None: return {'success': False, 'error': 'No SN data received'} # Using sn query... return {'success': True, 'variables': variables}.
[0047] If the AI model interface is invalid and / or a human-machine collaboration mode selection instruction is received, the human-machine collaboration mode is determined as the target generation mode, and the human-machine collaboration mode is invoked to generate script code based on structured prompts. For example, if an invalid AI model interface is detected, such as when the device is in an industrial intranet isolation environment, network interruption, interface authentication failure, or cloud service anomaly, and / or a human-machine collaboration mode selection instruction is received, the generation device can use the human-machine collaboration mode as the target generation mode and invoke it to generate script code based on structured prompts. In human-machine collaboration mode, the generation device can export the preset API whitelist, structured prompts, output format requirements, and current workflow context into a structured, readable text file, which can be copied by the operator to an offline AI tool or a web-based AI model for code generation. After the operator pastes the generated results from the offline AI tool or the web-based AI model back to the generation device, the generation device will automatically parse and identify the valid code content and extract the corresponding script code.
[0048] This embodiment adopts a dual-generation mode adaptive switching mechanism, which takes into account both the need for efficient automatic generation in general scenarios and the need for offline generation in intranet isolation and offline environments. It solves the problems of weak scenario adaptability of single AI generation mode and inability to be used in intranet environment, and greatly improves the environment adaptability of script code generation solution.
[0049] Reference Figure 4 , Figure 4 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. In some embodiments, the aforementioned multi-dimensional compliance verification of the script code includes: Step S170: Perform syntax verification on the script code to check for any syntax errors. Step S171: Perform API compliance verification on the script code to verify whether all function call nodes in the script code are within the preset API whitelist; Step S172: Perform a security check on the script code to verify whether there are any high-risk operation functions in the script code; Step S173: Perform import validity verification on the script code to verify whether all import statements in the script code are within the allowed import modules of the Robotic Process Automation framework. Step S174: If any of the four checks fails, the multidimensional compliance check is determined to have failed, and the corresponding error source code and error information are collected. Step S175: If all four verifications pass, the multidimensional compliance verification is confirmed to be successful.
[0050] In this embodiment, as Figure 4 As shown, when performing multi-dimensional compliance verification on the script code in step S120, the script code can first undergo syntax verification. The generation device performs syntax verification on the script code to check for syntax errors. For example, the generation device performs syntax verification on the script code, parsing the writing format, statement structure, keyword usage, and code nesting logic line by line, checking for basic problems such as spelling errors, missing statements, disordered formatting, and syntax errors, ensuring that the script code has the basic conditions for being parsable and runnable.
[0051] After syntax validation, the script code undergoes API compliance validation to verify whether all function call nodes within the script code are within the preset API whitelist. For example, the generation device performs API compliance validation on the script code by traversing and scanning all function call nodes in the script code, comparing them one by one with the preset API whitelist, verifying whether all operation APIs and context interfaces called during script execution are legitimate interfaces authorized by the preset API whitelist, screening for custom interfaces outside the preset API whitelist, and unauthorized third-party interface calls, thus preventing script execution errors and framework compatibility issues caused by unauthorized interface calls.
[0052] After API compliance verification is passed, the script code undergoes security verification to check for the presence of high-risk operation functions. For example, the generation device performs security verification on the script code, accurately scanning its content to detect whether it contains high-risk operation code such as system command calls, high-risk file read / write operations, forced process operations, or malicious function execution. This mitigates security risks such as unauthorized operations, system tampering, data leaks, and device malfunctions during automated script execution, ensuring the security and stability of automated business operations.
[0053] After the security check passes, the script code undergoes an import validity check to verify that all import statements within the script code are allowed import modules within the Robotic Process Automation (RPA) framework. For example, the generator performs an import validity check on the script code, verifying each module import statement and library reference statement in the script code to determine whether the imported functional modules and third-party libraries are pre-opened and allowed import modules within the RPA framework. It blocks unauthorized, illegal, and unknown module imports to prevent framework conflicts, crashes, and permission overflows caused by unauthorized module imports.
[0054] If any of the four checks fails, the multi-dimensional compliance check is deemed a failure, and the corresponding error source code and error information are collected. For example, during the check process, if any of the four checks—syntax check, API compliance check, security check, and import validity check—fails, the generation device will not perform subsequent checks (e.g., if the syntax check fails, the API compliance check will not be performed), and the multi-dimensional compliance check will be immediately determined to have failed. The abnormal check location will be accurately located, the corresponding error source code fragment will be extracted, and detailed error information such as the error type and cause of the abnormality will be recorded simultaneously. This provides accurate error correction basis for subsequent structured prompt word updates and script code iteration and regeneration.
[0055] If all four checks pass, the multi-dimensional compliance check is considered passed. For example, if all four checks pass without any violations or anomalies, the generation device can determine that the multi-dimensional compliance check has passed, indicating that the script code syntax is compliant, the interface is compliant, the operation is secure, and the module import is legal.
[0056] This embodiment uses multi-dimensional compliance verification to intercept unqualified, insecure, and incompatible script code at the source, preventing defective script code from entering the subsequent testing and deployment stages, significantly reducing subsequent debugging costs, and improving the standardization and reliability of generated script code.
[0057] Reference Figure 5 , Figure 5 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. In some embodiments, the aforementioned updating of structured prompts and re-executing the target generation mode to generate script code based on the structured prompts according to the updated structured prompts includes: Step S180: Check if the number of times the script code is regenerated is greater than the preset number; Step S181: If not, update the structured prompt words according to the original error code, error message and requirement description, and re-execute the call target generation mode to generate script code according to the structured prompt words according to the updated structured prompt words; Step S182: If yes, then generate a failure report based on the error source code, error message and requirement description.
[0058] In this embodiment, as Figure 5 As shown, during step S130, it can first be checked whether the number of times the script code is regenerated is greater than a preset number. The generation device checks whether the number of times the script code is regenerated is greater than the preset number. For example, the generation device first checks whether the number of times the script code is regenerated is greater than the preset number. The preset number can be customized by the user according to business debugging needs and script complexity to avoid the problem of infinite script retrying generation and consuming system resources. For example, the preset number can be configured to 3 times.
[0059] If not, the structured prompts are updated based on the error source code, error message, and requirement description. The target generation mode is then re-executed to generate script code based on the updated prompts. For example, if the number of regeneration attempts does not exceed a preset number, the generation device integrates and analyzes the error source code, error message, and user-input requirement description collected during previous multi-dimensional compliance verification to accurately pinpoint the root causes of issues such as script syntax errors, illegal API calls, high-risk operations, and invalid imported modules. Based on these root causes, the structured prompts are iteratively updated, supplementing the original prompts with error correction rules, enhanced compliance requirements, and business specification limitations, resulting in updated prompts. The target generation mode is then invoked again, and the script code is regenerated based on the updated structured prompts, achieving automatic error correction and iterative optimization of the script code.
[0060] If so, a script generation failure report is generated based on the source code of the error, the error message, and the requirement description. For example, if the number of regeneration attempts exceeds the preset number, it indicates that after multiple iterations and repairs, the script code still cannot meet the multi-dimensional compliance verification standards and has defects that are difficult to automatically fix. In this case, the generation device terminates the iterative retry process of the script code, integrates all data such as the source code of the error, the error message, the requirement description, and all retry records, and automatically generates a standardized script generation failure report. The script generation failure report clearly presents the reason for the script code generation failure, the location of the code defect, the type of violation, and the difference in matching with business requirements. This facilitates technical personnel to accurately locate the problem, manually intervene to optimize and debug, and achieves visualized fallback handling of script code generation failures, ensuring the integrity and controllability of the entire script code generation process.
[0061] Reference Figure 6 , Figure 6 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. In some embodiments, the aforementioned embedding of the completed code generated based on the read / write operation type in the data contract declaration into the script code includes: Step S190: Detect the read / write operation type in the data contract declaration; Step S191: If the read / write operation type is write, then generate write business code to store the data in the context variable pool. Step S192: If the read / write operation type is read, then generate read business code that reads data from the context variable pool, and generate verification code for data existence verification and type verification. Step S193: Embed the write business code and / or read business code and the verification code into the script code to complete the script code.
[0062] In this embodiment, as Figure 6 As shown, during step S140, the read / write operation types in the data contract declaration can be detected first. The generation device detects the read / write operation types in the data contract declaration. For example, after the script code passes the multi-dimensional compliance verification and before entering the environmental health pre-inspection and isolation sandbox testing process, the generation device can also detect the read / write operation types in the data contract declaration.
[0063] Example business scenario: The production line needs to process serial number (SN) codes in batches. Step 1: Scan the SN codes and write them to the shared data area. Step 5: Query product information based on the SN. In this way, users can configure the requirement description according to the needs of the production line.
[0064] Producer's data contract declaration (Step 1: Write SN): Contract name: SN, Data type: String, Read / write operation type: Write, Description: SN code obtained by scanning.
[0065] Consumer's Data Contract Declaration (Step 5 Read SN): Contract Name: SN, Data Type: String, Read / Write Operation Type: Read, Description: Product SN Code.
[0066] If the read / write operation type is write, then write business code is generated to store the data in the context variable pool. For example, in the sample business scenario, when the read / write operation type is write, corresponding to the business step of scanning SN codes on the production line, the generation device automatically generates write business code adapted to the robotic process automation framework. This write business code can automatically store the real-time collected SN code data into the framework context variable pool according to the contract name and specified data type, realizing temporary caching and cross-step sharing of business data, and providing a standard data source for subsequent business processes.
[0067] If the read / write operation type is "read," then read business code is generated to read data from the context variable pool, along with data existence and type verification code. For example, in the sample business scenario, when the read / write operation type is "read," corresponding to the business step of querying product information based on the SN code, the generation device automatically generates read business code to read the corresponding contract name data from the context variable pool. Simultaneously, it generates data existence and data type verification code to verify whether the read data exists and whether the data type matches the contract declaration before executing the business logic, preventing script errors due to missing data or abnormal data types.
[0068] The write and / or read business code, along with verification code, are embedded into the script code to complete it. For example, the generation device precisely embeds the generated write and / or read business code, along with verification code, into the corresponding business nodes of the original script code. This performs logical completion and functional optimization on the initial script code, enabling the completed script code to have standardized data access and data verification capabilities. This achieves decoupled transmission of business data and avoids the problems of high coupling, poor adaptability, and easy error reporting caused by hard-coded parameter passing in traditional script code.
[0069] The write business code, read business code, and supporting verification code automatically generated by the generation device based on the data contract declaration are all generated according to a preset template. Their syntax structure and API calls all conform to the framework specifications, so there is no need to go through the multi-dimensional compliance verification.
[0070] Reference Figure 7 , Figure 7 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. In some embodiments, the aforementioned environmental health pre-check and isolation sandbox test of the script code includes: Step S200: Identify the Skill type called in the script code; Step S201: Match several pre-check environment items from the preset environment mapping table according to the Skill type, and perform pre-check on several pre-check environment items. The pre-check environment items include: browser driver file existence and version matching, business program process and window existence, network port connectivity or data source file existence and readability. Step S202: When several pre-check environment items pass the pre-check, the script code is subjected to isolation sandbox testing; Step S203: When there is a pre-inspection failure among several pre-inspection environment items, generate an environment diagnosis report based on the pre-inspection environment item corresponding to the pre-inspection failure and the reason for the failure.
[0071] In this embodiment, as Figure 7As shown, during step S140, when performing environmental health pre-checks and isolation sandbox tests on the script code, the skill types called in the script code can be identified first. The generation device identifies the skill types called in the script code. For example, the generation device performs semantic analysis on the script code to accurately identify the skill types called in the script code. Skill types can include one or more of the following: browser operation skills, local program operation skills, network resource skills, and directory / file skills. Different skill types correspond to different runtime environment dependencies.
[0072] The generator matches several pre-check environment items from a preset environment mapping table based on the Skill type, and performs pre-checks on these items. These pre-check environment items include: the existence and version matching of browser driver files, the existence of business program processes and windows, and network port connectivity or the existence and readability of data source files. For example, the generator maintains a preset environment mapping table that records the correspondence between Skill types and pre-check environment items; for instance, a browser operation Skill corresponds to the existence and version matching of browser driver files; a local program operation Skill corresponds to the existence of business program processes and windows; a network resource Skill corresponds to network port connectivity; and a directory / file Skill corresponds to the existence and readability of data source files. The generator can determine several pre-check environment items based on the Skill type and perform pre-checks on these items. Assuming that the Skill types include browser operation Skills and local program operation Skills, the generation device can determine the existence and version matching of the browser driver file based on the browser operation Skill, and determine the existence of the business program process and window based on the local program operation Skill; then, a pre-check is performed on the existence and version matching of the browser driver file, and the existence of the business program process and window.
[0073] When several pre-check environment items pass the pre-check, the script code undergoes isolation sandbox testing. For example, the generation device sequentially completes the detection of all matching pre-check environment items and makes a unified judgment on all pre-check results. When all pre-check environment items pass the pre-check, it indicates that the current runtime environment fully adapts to the runtime requirements of the script code, and there are no issues such as missing environment dependencies, version mismatches, or unavailable resources. At this point, the generation device can perform isolation sandbox testing on the script code.
[0074] When a pre-check fails among several pre-check environment items, an environment diagnostic report is generated based on the corresponding pre-check environment item and the reason for the failure. For example, if any pre-check environment item fails, the generation device will automatically capture the corresponding pre-check environment item, simultaneously collect specific failure reasons such as version mismatch, process not started, port not working, missing or unreadable files, and integrate the corresponding pre-check environment item and failure reason to generate an environment diagnostic report. The environment diagnostic report can intuitively display the abnormal points and causes of the failure, making it convenient for users to quickly locate and repair runtime environment problems, avoid subsequent abnormal script code execution due to environmental defects, and significantly reduce the difficulty of script code debugging and the cost of troubleshooting.
[0075] Reference Figure 8 , Figure 8 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. In some embodiments, the aforementioned isolation sandbox testing of the script code includes: Step S210: Create an isolated sandbox runtime environment. Configure the isolated sandbox runtime environment with an independent code namespace, variable pool snapshot mechanism, execution timeout protection, and simulated execution context. Step S211: Load the script code into the isolated sandbox runtime environment and run it; Step S212: Capture the log output, variable changes, and program stack information of the script code during execution; Step S213: Determine whether there is any abnormal data in the log output, variable changes, and program stack information; Step S214: If no abnormal data is found, the isolation sandbox test is confirmed to have passed. Step S215: If abnormal data exists, collect the abnormal data and abnormal stack information, update the structured prompt words based on the abnormal data and abnormal stack information, and regenerate the script code.
[0076] In this embodiment, as Figure 8As shown, when executing step S202, an isolated sandbox runtime environment can be created first. The isolated sandbox runtime environment is configured with an independent code namespace, a variable pool snapshot mechanism, execution timeout protection, and a simulated execution context. The isolated sandbox runtime environment has independent debugging capabilities; it can run single script segments independently without loading the complete process. It supports injecting test data via `set_variable` and allows real-time viewing of the context variable pool status through log output. For example, after the generation device passes all environmental health pre-checks, it automatically creates the isolated sandbox runtime environment, isolating the script code test execution from the local real runtime environment, preventing script code from tampering with local business data, polluting global variables, or triggering unknown system risks. The independent code namespace enables independent parsing and execution of test script code, eliminating conflicts between code, functions, and variables between different scripts. The variable pool snapshot mechanism can back up the context variable pool state before the script code runs and quickly restore the environment state after the script code test, ensuring that multiple tests do not interfere with each other. Execution timeout protection limits the runtime of script code, effectively avoiding program freezes caused by exceptions such as infinite loops and interface blocking. Simulated execution context replicates the real operating rules, interface call permissions, and data interaction specifications of the robotic process automation framework, ensuring a high degree of consistency between the sandbox testing environment and the production deployment environment, and guaranteeing the authenticity and validity of test results.
[0077] The script code is loaded into an isolated sandbox environment for execution. For example, the generation device loads the entire script code into the isolated sandbox environment for simulation, completely detached from the real business process and the official data source.
[0078] It captures the script's log output, variable changes, and program stack information during execution. For example, during the script's simulated execution, the generation device captures and records all log output, variable change data at each node, and program stack information in real time, completely preserving the data from the entire script execution process.
[0079] The system determines whether there is abnormal data in the log output, variable changes, and program stack information. For example, the generation device comprehensively analyzes the collected log output, variable changes, and program stack information to determine whether there are abnormal data such as errors, abnormal parameters, data read / write errors, or logic freezes during script execution.
[0080] If no abnormal data is found, the isolation sandbox test is considered passed. For example, if no abnormal data is detected, it indicates that the script logic is correct, data interaction is normal, and the operation is stable and reliable. In this case, the generation device can determine that the isolation sandbox test has passed.
[0081] If abnormal data is detected, the abnormal data and exception stack information are collected. Based on the abnormal data and exception stack information, the structured prompt words are updated, and the script code is regenerated. For example, if abnormal data is detected, the generation device can collect the corresponding abnormal data and exception stack information to locate script code logic defects, data validation vulnerabilities, or process control errors. It then integrates the cause of the exception, the error scenario, and the defect location into the original requirement description, updates the structured prompt words, and jumps to the script code regeneration process. This achieves automatic iterative repair of script code errors, effectively improving the script code generation pass rate.
[0082] Reference Figure 9 , Figure 9 This is a flowchart illustrating another embodiment of the script generation method for the robotic process automation framework of this application. In some embodiments, the process of loading the script code into the isolated sandbox runtime environment for execution further includes: Step S220: Match the corresponding verification case from the preset verification case library according to the Skill type. The preset verification case library is created by the user for the type of business program. Each verification case contains a minimal test script that covers the core operations of the business program. Step S221: Call the isolated sandbox runtime environment to execute the verification case and verify whether the behavior of the business program in the isolated sandbox runtime environment is consistent with the expectation; Step S222: If they match, then execute the script code by loading it into the isolated sandbox runtime environment. In step S223, if there is a discrepancy, collect the execution difference information of the verification case, adjust the parameters of the verification case according to the execution difference information, and re-execute the verification case by calling the isolated sandbox runtime environment.
[0083] In this embodiment, as Figure 9 As shown, before executing step S211, a corresponding verification case can be matched from the preset verification case library based on the Skill type. The preset verification case library is created by the user for the type of business program, and each verification case contains a minimal test script covering the core operations of the business program. For example, the preset verification case library is a pre-packaged and stored standardized test resource library, pre-configured with corresponding minimal test scripts for different Skill types such as browser operation Skills, local program operation Skills, network resource Skills, and directory / file Skills. The generation device can match the corresponding verification case from the preset verification case library based on the skill type.
[0084] The test case is executed in the isolated sandbox environment to verify whether the behavior of the business program in the isolated sandbox environment is consistent with expectations. For example, the generation device independently executes the test case in the isolated sandbox environment to test the startup status, operation response behavior, and data output results of the corresponding business program in an isolated and secure simulation environment. This determines whether the business program's performance in the sandbox environment is consistent with the preset standard expectations, and helps to identify hidden problems such as incompatibility between Skill type calls and business program adaptation, abnormal operation responses, and environment adaptation deviations in advance.
[0085] If the behavior matches, the script code will be loaded into the isolated sandbox environment and run. For example, if the business application behaves as expected in the isolated sandbox environment, the generation device will load the script code into the isolated sandbox environment and run it.
[0086] If there is a discrepancy, the execution difference information of the verification cases is collected. Based on the execution difference information, the parameters of the verification cases are adjusted, and the verification cases are re-executed in the isolated sandbox environment. For example, if the behavior of the business program in the isolated sandbox environment is inconsistent with expectations, the generation device automatically collects all the difference information of the verification case execution, accurately locates the root cause of problems such as parameter adaptation deviation and operation matching anomalies, adaptively adjusts the running parameters, operation parameters, and matching parameters of the verification cases based on the difference information, and re-invokes the isolated sandbox environment to iteratively execute the verification cases until the execution result of the verification cases meets expectations. This completes the pre-compatibility adaptation correction without triggering global script code regeneration, minimizing the probability of errors during complete script execution.
[0087] This application's technical solution constructs structured prompts based on user-inputted requirements and a pre-defined API whitelist. The requirements include a data contract declaration. The target generation mode is invoked to generate script code based on the structured prompts, and multi-dimensional compliance checks are performed on the script code. If multi-dimensional compliance checks fail, the structured prompts are updated, and the target generation mode is re-invoked to generate script code based on the updated prompts. If multi-dimensional compliance checks pass, the completed code generated based on the read / write operation types in the data contract declaration is embedded into the script code. Environmental health pre-checks and isolation sandbox tests are performed on the script code. If both pre-checks and tests pass, the script code is written to the script directory of the robotic process automation framework. By constraining script code generation with structured prompts and verifying the script code through multi-dimensional compliance checks, environmental health pre-checks, and isolation sandbox tests, illegal code and operational risks are effectively avoided, reducing development barriers and improving scenario adaptability.
[0088] This application further proposes a script generation device for a robotic process automation framework, referring to... Figure 10 , Figure 10This is a schematic diagram of the structure of an embodiment of the script generation device for the robotic process automation framework of this application. In some embodiments, the script generation device for the robotic process automation framework includes: At least one processor; and, A memory that is communicatively connected to at least one processor; wherein, The memory stores instructions that are executed by the at least one processor to enable the at least one processor to perform the script generation method for the robotic process automation framework described in any one of the preceding descriptions.
[0089] In this embodiment, as Figure 10 As shown, the script generation apparatus for a robotic process automation (RPA) framework in this embodiment can be a processor capable of running a script generation method for an RPA framework; there is at least one processor. Figure 10 As shown, the script generation device for the robotic process automation framework may include: a processor 1001 (e.g., a CPU), a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to establish communication between these components. The user interface 1003 may include a display screen or an input unit, such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0090] Those skilled in the art will understand that Figure 10 The script generation device structure shown in the diagram does not constitute a limitation on the script generation device for the robotic process automation framework. It may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0091] like Figure 10 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and computer-executable instructions.
[0092] exist Figure 10In the script generation device for the robotic process automation framework shown, the network interface 1004 is mainly used to connect to the backend server and communicate with the backend server; the user interface 1003 is mainly used to connect to the client (user end) and communicate with the client; and the processor 1001 can be used to call computer-executable instructions stored in the memory 1005. When the instructions are called and executed by the processor 1001, they implement the steps of the script generation method for the robotic process automation framework described above.
[0093] The above description is only a part or preferred embodiment of this application. Neither the text nor the drawings should limit the scope of protection of this application. All equivalent structural transformations made using the content of this application's specification and drawings under the overall concept of this application, or direct / indirect applications in other related technical fields, are included within the scope of protection of this application.
Claims
1. A script generation method for a robotic process automation framework, characterized in that, include: Structured prompts are constructed based on the user's input description of requirements and a preset API whitelist, wherein the description of requirements includes a data contract statement; The target generation mode is invoked to generate script code based on the structured prompt words, and multi-dimensional compliance verification is performed on the script code; When the multidimensional compliance verification fails, the structured prompt word is updated, and the script code to be generated based on the structured prompt word is re-executed according to the target generation mode. When the multidimensional compliance verification is passed, the completion code generated according to the read and write operation type in the data contract declaration is embedded into the script code. The script code is then subjected to environmental health pre-check and isolation sandbox test. When both the pre-check and test are passed, the script code is written into the script directory of the robotic process automation framework.
2. The script generation method for a robotic process automation framework according to claim 1, characterized in that, The process of constructing structured prompts based on user-inputted requirements and a preset API whitelist includes: The system receives the user's input of the requirement description, which includes a business description and a data contract declaration. The data contract declaration includes at least the contract name, data type, and read / write operation type. Read the preset API whitelist, and encapsulate the requirement description and the preset API whitelist into a context to obtain the structured prompt words.
3. The script generation method for a robotic process automation framework according to claim 2, characterized in that, The script code generated based on the structured prompts in the target generation mode includes: Check whether the AI model interface is valid and whether the user input instruction for selecting the human-machine collaboration mode has been received; If the AI model interface is valid and the human-machine collaboration mode selection instruction is not received, then the fully automatic API mode is determined as the target generation mode, and the fully automatic API mode is called to generate script code based on the structured prompt words; If the AI model interface is invalid and / or the human-machine collaboration mode selection instruction is received, the human-machine collaboration mode is determined as the target generation mode, and the human-machine collaboration mode is invoked to generate script code based on the structured prompt words.
4. The script generation method for a robotic process automation framework according to claim 3, characterized in that, The multi-dimensional compliance verification of the script code includes: Perform syntax validation on the script code to check whether there are any syntax errors in the script code; The script code is subjected to API compliance verification to check whether all function call nodes in the script code are within the preset API whitelist. The script code is subjected to security verification to check whether there are any high-risk operation functions within the script code; The script code is subjected to import validity verification, which verifies whether all import statements in the script code are within the allowed import modules of the Robotic Process Automation framework. If any of the four checks fails, the multidimensional compliance check is determined to have failed, and the corresponding error source code and error information are collected. If all four checks pass, the multidimensional compliance check is considered successful.
5. The script generation method for a robotic process automation framework according to claim 4, characterized in that, The step of updating the structured prompt words and re-executing the target generation mode to generate script code based on the structured prompt words according to the updated structured prompt words includes: Check whether the number of times the script code is regenerated is greater than a preset number; If not, then update the structured prompt word according to the original error code, the error message and the requirement description, and re-execute the call target generation mode to generate script code according to the structured prompt word according to the updated structured prompt word; If so, a script is generated to produce a failure report based on the source code of the error, the error message, and the requirement description.
6. The script generation method for a robotic process automation framework according to claim 5, characterized in that, The step of embedding the autocomplete code generated based on the read / write operation type in the data contract declaration into the script code includes: Detect the read / write operation type in the data contract declaration; If the read / write operation type is write, then write business code that stores the data into the context variable pool is generated; If the read / write operation type is read, then read business code that reads data from the context variable pool is generated, and verification code for data existence and type verification is generated. The write business code and / or the read business code, along with the verification code, are embedded into the script code to complete the script code.
7. The script generation method for a robotic process automation framework according to claim 6, characterized in that, The environmental health pre-check and isolation sandbox test of the script code includes: Identify the type of Skill called in the script code; According to the Skill type, match several pre-check environment items from the preset environment mapping table, and perform pre-checks on several pre-check environment items. The pre-check environment items include: browser driver file existence and version matching, business program process and window existence, network port connectivity or data source file existence and readability. If all of the pre-check environment items pass the pre-check, the script code is subjected to the isolation sandbox test. If a pre-inspection fails among several of the pre-inspection environment items, an environmental diagnostic report is generated based on the pre-inspection environment item corresponding to the pre-inspection failure and the reason for the failure.
8. The script generation method for a robotic process automation framework according to claim 7, characterized in that, The isolation sandbox test performed on the script code includes: Create an isolated sandbox runtime environment, which is configured with an independent code namespace, a variable pool snapshot mechanism, execution timeout protection, and a simulated execution context; The script code is loaded into the isolated sandbox runtime environment and run. Capture the script code's log output, variable changes, and program stack information during execution; Determine whether there is any abnormal data in the log output, the variable changes, and the program stack information; If no abnormal data is found, the isolation sandbox test is considered passed. If abnormal data is found, the abnormal data and abnormal stack information are collected, the structured prompt words are updated based on the abnormal data and abnormal stack information, and the script code is regenerated.
9. The script generation method for a robotic process automation framework according to claim 8, characterized in that, The process of loading the script code into the isolated sandbox environment for execution also includes: According to the Skill type, a corresponding verification case is matched from a preset verification case library. The preset verification case library is created by the user for the type of business program. Each verification case contains a minimal test script that covers the core operations of the business program. The verification case is executed by calling the isolated sandbox runtime environment to verify whether the behavior of the business program in the isolated sandbox runtime environment is consistent with expectations. If they match, then the script code will be loaded into the isolated sandbox environment and run. If there is a discrepancy, the execution difference information of the verification case is collected, the parameters of the verification case are adjusted according to the execution difference information, and the verification case is re-executed by calling the isolated sandbox runtime environment.
10. A script generation device for a robotic process automation framework, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that are executed by the at least one processor to enable the at least one processor to perform the script generation method for the robotic process automation framework according to any one of claims 1 to 9.
