Front-end prompt word configuration method and system
By encoding and dynamically changing the front-end prompts, the problem of difficulty in dynamic update of prompts is solved, configuration management is realized, team collaboration and testing processes are simplified, and user experience and development efficiency are improved.
Patent Information
- Application Number
- CN202411760758.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-04-25
AI Technical Summary
Front-end prompts are difficult to change dynamically according to different situations or user needs, and require manual code modification or redeployment of the system, increasing maintenance costs and affecting the user experience.
By encoding each prompt, a unique encoding prompt is obtained, and the encoding is used to dynamically change the front-end prompt to realize configuration management.
It simplifies communication between team members and promotes efficient collaboration among cross-functional teams. The automated testing framework simplifies the writing of test scripts, improves the degree of automation and efficiency of tests, and improves the user experience.
Smart Images

Figure CN119883883A_ABST
Abstract
Description
Background Art
[0002] Common front-end prompts are divided into two categories: one is the prompts returned by the back-end to the front-end, and the other is the prompts written by the front-end itself according to the actual scenario. However, the prompts for the scenarios handled by the front-end itself are difficult to dynamically change according to different situations or user needs. Manual code modification or system redeployment is required to update the prompts, which not only increases the maintenance cost and workload, but also greatly affects the user experience. Summary of the invention
[0003] The present application provides a front-end prompt configuration method and system for realizing configuration management and improving maintenance efficiency.
[0004] In a first aspect, a front-end prompt configuration method is provided, comprising the following steps:
[0005] Encode each prompt to obtain a unique coded prompt;
[0006] The uniquely coded prompt is used to dynamically change the front-end prompt to complete the configuration of the front-end prompt.
[0007] In the above technical scheme, each prompt is encoded to obtain a unique coded prompt; the front-end prompt is dynamically changed using the unique coded prompt to complete the front-end prompt configuration; coding simplifies communication between team members and promotes efficient collaboration across functional teams; the automated testing framework uses unique coding to simplify the writing of test scripts and improve the automation and efficiency of testing.
[0008] In a specific implementation scheme, the step of encoding each prompt to obtain a uniquely encoded prompt specifically includes:
[0009] Find placeholder patterns in strings;
[0010] Pass the formatted string as the first argument to the function;
[0011] Get the specific parameters for replacement;
[0012] Pass the replacement specific parameters to the toType() function;
[0013] Replace the placeholders with the appropriate parameter values.
[0014] In one specific implementation, a regular expression is used to search for placeholder patterns in a string.
[0015] In a specific implementation scheme, the placeholder format includes the {n} format or the {n:m} format, wherein,
[0016] n represents the parameter index to replace, and m represents the formatting options to apply.
[0017] In one specific implementation, the regular expression is stored in the re variable.
[0018] In a specific implementation, the specific parameter of the replacement is obtained using index n in the arguments object.
[0019] In a specific implementation manner, the toType() function is used to perform type conversion on the replaced specific parameters, and / or format the replaced specific parameters using format options.
[0020] In a specific implementation scheme, the placeholders are replaced with corresponding parameter values using the replace method of the string.
[0021] In a specific embodiment, it also includes:
[0022] A centralized management file is created to uniformly control and update the unique coding prompt.
[0023] In a second aspect, a front-end prompt configuration system is provided, including:
[0024] An encoding module, used for encoding each prompt to obtain a unique coded prompt;
[0025] A configuration module, used to dynamically change the front-end prompt using the unique coded prompt to complete the configuration of the front-end prompt;
[0026] The management module is used to create a centralized management file to uniformly control and update the unique coding prompt.
[0027] In the above technical scheme, each prompt is encoded to obtain a unique coded prompt; the front-end prompt is dynamically changed using the unique coded prompt to complete the front-end prompt configuration; coding simplifies communication between team members and promotes efficient collaboration across functional teams; the automated testing framework uses unique coding to simplify the writing of test scripts and improve the automation and efficiency of testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A flowchart of a front-end prompt configuration method provided in an embodiment of the present application;
[0029] Figure 2 A structural block diagram of the front-end prompt configuration system provided in an embodiment of the present application;
[0030] Figure 3A specific flow chart of the front-end prompt configuration method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The present application is further described in detail below through the accompanying drawings and embodiments. Through these descriptions, the characteristics and advantages of the present application will become clearer and more specific.
[0032] The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise noted.
[0033] In addition, the technical features involved in different embodiments of the present application described below can be combined with each other as long as they do not conflict with each other.
[0034] To facilitate understanding of the front-end prompt configuration method and system provided in the embodiment of the present application, its application scenario is first explained. The front-end prompt configuration method and system provided in the embodiment of the present application are used to realize configuration management and improve maintenance efficiency. Common front-end prompts are divided into two major categories, one is that the back end returns to the front end of the speech for prompting, and the other is the prompt written by the front end itself according to the actual scenario. However, the prompts of the scene processed by the front end itself are difficult to dynamically change according to different situations or user needs. It is necessary to manually modify the code or redeploy the system to update the prompts, which not only increases the cost and workload of maintenance, but also greatly affects the user experience. For this reason, the embodiment of the present application provides a front-end prompt configuration method and system to realize configuration management and improve maintenance efficiency. The following is a detailed description of the embodiments in conjunction with specific drawings.
[0035] refer to Figures 1 to 3 , Figure 1 A flowchart of a front-end prompt configuration method provided in an embodiment of the present application; Figure 2 A structural block diagram of the front-end prompt configuration system provided in an embodiment of the present application; Figure 3 A specific flow chart of the front-end prompt configuration method provided in an embodiment of the present application.
[0036] exist Figure 1 In the embodiment of the present application, a front-end prompt configuration method is provided, comprising the following steps:
[0037] Encode each prompt to obtain a unique coded prompt;
[0038] The uniquely coded prompt is used to dynamically change the front-end prompt to complete the configuration of the front-end prompt.
[0039] In the above technical scheme, each prompt is encoded to obtain a unique coded prompt; the front-end prompt is dynamically changed using the unique coded prompt to complete the front-end prompt configuration; coding simplifies communication between team members and promotes efficient collaboration across functional teams; the automated testing framework uses unique coding to simplify the writing of test scripts and improve the automation and efficiency of testing.
[0040] In a specific implementation scheme, the step of encoding each prompt to obtain a uniquely encoded prompt specifically includes:
[0041] Find placeholder patterns in strings;
[0042] Pass the formatted string as the first argument to the function;
[0043] Get the specific parameters for replacement;
[0044] Pass the replacement specific parameters to the toType() function;
[0045] Replace the placeholders with the appropriate parameter values.
[0046] In the above technical solution, the following are achieved: 1. Unique coding system: a unique code is assigned to each prompt, which is the basis for realizing configuration management and improving maintenance efficiency. 2. Centralized management file: a centralized management file containing all prompts and their corresponding codes is created to facilitate unified control and update. 3. Team collaboration mechanism: coding simplifies communication between team members and promotes efficient collaboration of cross-functional teams. 4. Automated testing framework: using unique coding to simplify the writing of test scripts and improve the automation and efficiency of testing.
[0047] In one specific implementation, a regular expression is used to search for placeholder patterns in a string.
[0048] In a specific implementation scheme, the placeholder format includes the {n} format or the {n:m} format, wherein,
[0049] n represents the parameter index to replace, and m represents the formatting options to apply.
[0050] In one specific implementation, the regular expression is stored in the re variable.
[0051] In a specific implementation, the specific parameter of the replacement is obtained using index n in the arguments object.
[0052] In a specific implementation manner, the toType() function is used to perform type conversion on the replaced specific parameters, and / or format the replaced specific parameters using format options.
[0053] In a specific implementation scheme, the placeholders are replaced with corresponding parameter values using the replace method of the string.
[0054] In a specific embodiment, it also includes:
[0055] A centralized management file is created to uniformly control and update the unique coding prompt.
[0056] refer to Figure 3 The front-end prompt configuration method generates a JSON file according to the key (unique code) value (corresponding prompt) pair and stores it in the OSS object storage server to achieve dynamic changes of the front-end prompt. Specifically including:
[0057] 1. Use regular expressions to find placeholder formats in a string. Placeholders can be in the form of {n} or {n:m}, where n represents the parameter index to be replaced and m represents the formatting option to be applied. Here, the regular expression is saved in the re variable.
[0058] 2. Pass the string to be formatted as the first argument to the function. After this, any number of additional arguments can be passed in the function parameter list. These arguments will replace the placeholders in the order they are passed.
[0059] 3. Next, use index n in the arguments object to get the specific argument to replace.
[0060] 4. The specific argument is then passed to the toType() function, which will perform any required type conversion on the argument while formatting the argument using the format options (if any).
[0061] 5. Finally, use the string's replace method to replace the placeholders with the corresponding parameter values.
[0062] In the above technical solution, the management of front-end project prompts is more convenient and flexible. First, the maintainability and clarity of the code are improved. By assigning a unique code to each prompt, the prompt information in the project becomes highly traceable. This approach greatly simplifies the maintenance of the code, because modifying any prompt only needs to be done in a centrally managed file without having to search around in the project. This not only reduces code redundancy, but also improves the readability and clarity of the code, allowing developers to focus more on the development of business logic instead of being bothered by trivial text updates.
[0063] Secondly, it promotes the internationalization of the project. Uniquely coded prompt files pave the way for multi-language support for the project. The development team can manage prompts in different languages in a central file without embedding multi-language texts in the code. This means that when the project needs to expand to a new market, only the corresponding translation needs to be added to the configuration file without changing the business logic code. This flexibility and scalability are extremely valuable for projects targeting global users.
[0064] In addition, team collaboration and version control are enhanced. Unified coded prompts promote the efficiency of collaboration among teams. Developers, designers, and translators can quickly identify and locate specific prompts through coding without going into code details, which helps reduce communication costs and misunderstandings. At the same time, the version control system can more effectively track the change history of prompts, ensuring that team members can easily understand and manage text changes, and enhancing the team's ability to work together.
[0065] Finally, simplify the testing process and improve the user experience. During the testing and debugging phase, uniquely coded prompts simplify the writing and maintenance of automated test scripts. Testers can quickly locate and verify specific prompt information based on the code to ensure that the user interface is displayed correctly in different scenarios. In addition, by centrally managing prompts, it can ensure that all users receive consistent and accurate information in different language environments, thereby improving the overall user experience and reducing user confusion caused by incorrect or inconsistent interface text.
[0066] In summary, the configuration management of front-end prompts not only optimizes the code structure and improves development efficiency, but also brings significant improvements to the project's internationalization, team collaboration, and testing processes, ultimately improving the overall product quality and user experience.
[0067] exist Figure 2 In the embodiment of the present application, a front-end prompt configuration system is provided, including:
[0068] An encoding module, used for encoding each prompt to obtain a unique coded prompt;
[0069] A configuration module, used to dynamically change the front-end prompt using the unique coded prompt to complete the configuration of the front-end prompt;
[0070] The management module is used to create a centralized management file to uniformly control and update the unique coding prompt.
[0071] In the above technical scheme, each prompt is encoded to obtain a unique coded prompt; the front-end prompt is dynamically changed using the unique coded prompt to complete the front-end prompt configuration; coding simplifies communication between team members and promotes efficient collaboration across functional teams; the automated testing framework uses unique coding to simplify the writing of test scripts and improve the automation and efficiency of testing.
[0072] Those skilled in the art will appreciate that the present application may be implemented as a system, method or computer program product.
[0073] Therefore, the present disclosure may be specifically implemented in the following forms, namely: it may be completely hardware, it may be completely software (including firmware, resident software, microcode, etc.), or it may be a combination of hardware and software, generally referred to herein as a "circuit", "module" or "system". In addition, in some embodiments, the present application may also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium may contain computer-readable program code.
[0074] Any combination of one or more computer-readable media can be used. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0075] Although the embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art can change, modify, replace and modify the above embodiments within the scope of the present application. On this basis, a variety of replacements and improvements can be made to the present application, all of which fall within the scope of protection of the present application.
Claims
1. A front-end prompt configuration method, characterized in that: The following steps are involved: Encode each prompt to obtain a unique coded prompt; The uniquely coded prompt is used to dynamically change the front-end prompt to complete the configuration of the front-end prompt.
2. The front-end prompt configuration method according to claim 1, characterized in that: The steps of encoding each prompt to obtain a unique coded prompt include: Find placeholder patterns in strings; Pass the formatted string as the first argument to the function; Get specific parameters for replacement; Pass the replacement specific parameters to the toType() function; Replace the placeholders with the appropriate parameter values.
3. The front-end prompt configuration method according to claim 2, characterized in that: Use regular expressions to find placeholder patterns in a string.
4. The front-end prompt configuration method according to claim 3, characterized in that: The placeholder format includes the {n} format or the {n:m} format, where: n represents the parameter index to replace, and m represents the formatting options to apply.
5. The front-end prompt configuration method according to claim 4, characterized in that: The regular expression is stored in the re variable.
6. The front-end prompt configuration method according to claim 5, characterized in that: Get a specific argument for the replacement using index n in the arguments object.
7. The front-end prompt configuration method according to claim 6, characterized in that: The toType() function is used to perform type conversion on the replaced specific parameters and / or format the replaced specific parameters using format options.
8. The front-end prompt configuration method according to claim 7, characterized in that: Use the string's replace method to replace the placeholders with the corresponding parameter values.
9. The front-end prompt configuration method according to claim 8, characterized in that: Also includes: A centralized management file is created to uniformly control and update the unique coding prompt.
10. A front-end prompt configuration system, characterized in that: include: An encoding module, used for encoding each prompt to obtain a unique coded prompt; A configuration module, used to dynamically change the front-end prompt using the unique coded prompt to complete the configuration of the front-end prompt; The management module is used to create a centralized management file to uniformly control and update the unique coding prompt.
Citation Information
Patent Citations
Method for outputting and operating data at server in formatting way according to demands of user
CN102023856A
A Method and System for Implementing Multilingual Web Pages Based on Embedded Systems
CN102289376A
General management method for software system cues, computer equipment and storage medium
CN113986444A
International prompt processing method and device, electronic equipment and storage medium
CN118862833A
Software solution for localization of software applications using automatically generated placeholders
US20090037830A1