Rendering display method and device for human-computer interaction content, medium and product
By identifying and converting data format fragments fed back from the server on the client side, the problems of fragmented information and insufficient rendering performance in smart assistant interactions are solved, enabling efficient integration of multi-source information and rendering and display of complex business processes.
Patent Information
- Application Number
- CN202511688176.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-02-24
AI Technical Summary
Existing technologies lack unified encapsulation and structured integration of multi-source information in intelligent assistant interactions, resulting in fragmented and disordered information presentation and difficulty in supporting complex business processes and advanced interactions, especially in terms of insufficient rendering performance under multi-turn dialogues and various dialogue styles.
By identifying dialogue style identifiers in the data format fragments returned by the server on the client side, querying the mapping relationship, adding the target style class name and converting it into the appropriate data format fragment, performing real-time rendering and caching, and finally displaying it when the conditions are met.
It realizes the encapsulation and parsing of underlying front-end and back-end interactive message transmission in human-computer interaction scenarios, adapts to complex business processes, and improves rendering performance and user experience.
Smart Images

Figure CN121560433A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information interaction technology, and in particular to a method, device, medium and product for rendering and displaying human-computer interaction content. Background Technology
[0002] With the deep penetration of mobile internet and IoT technologies, AI (Artificial Intelligence) smart assistants have become the core entry point connecting users with various services. They are widely used in scenarios such as smart home control, mobile terminal interaction, and enterprise service response. Users' needs for smart assistants have been upgraded from single command execution to ease of use requirements such as multi-turn natural dialogue, multiple dialogue styles, and real-time dynamic response.
[0003] In the field of interactive information rendering for intelligent assistants, existing technologies mostly adopt discrete presentation schemes based on single-modal data. For example, when faced with complex user queries, some systems can only push multi-source information such as text answers, associated images, and operation commands to the interactive interface in an independent and unrelated manner. This lack of unified encapsulation and structured integration of various messages results in fragmented and disordered information presentation, requiring users to manually filter key content and establish logical connections, significantly increasing the cost of information acquisition. Furthermore, these technologies generally rely on preset fixed interaction templates, supporting only a one-way or simple loop interaction mode of "user command - assistant response."
[0004] Existing technologies primarily focus on the UI (User Interface) interaction layer in intelligent dialogue scenarios, emphasizing convenient dialogue interface construction and message display functions. They lack encapsulation of the underlying front-end and back-end message transmission methods, requiring business developers to incur additional encapsulation costs. These existing technologies are relatively limited in functionality, lacking support for advanced interactions and failing to meet the needs of complex business processes. For example, they do not support interaction scenarios with code blocks of different language styles, and they do not support automatic rendering of the dialogue UI based on back-end messages returned with agreed-upon formatting standards. This results in shortcomings in ease of use and high-frequency dialogue rendering performance. Summary of the Invention
[0005] This invention provides a method, device, medium, and product for rendering and displaying human-computer interaction content, in order to solve the problems of low-level front-end and back-end interaction message transmission, encapsulation, and parsing in human-computer interaction scenarios, and to meet the high-performance rendering requirements of specific complex business interaction processes.
[0006] According to one aspect of the present invention, a method for rendering and displaying human-computer interaction content is provided, executed by an intelligent dialogue client, the method comprising:
[0007] Real-time acquisition of the server's initial data format in response to user feedback, ready for display;
[0008] Whenever a complete first data format fragment is identified in the data to be displayed, the target dialogue style identifier is identified in the first data format fragment, and the pre-established mapping relationship between style identifiers and style class names is queried to obtain the target style class name that matches the target dialogue style identifier.
[0009] After adding the target style class name to the first data format fragment, the first data format fragment is converted into a second data format fragment based on the target style class that matches the target style class name.
[0010] The second data format fragment is rendered in real time to obtain a rendered display fragment;
[0011] The rendered display fragments obtained from real-time rendering are cached in a set of rendered fragments, and when the display conditions are met, each rendered display fragment in the set is displayed to the client.
[0012] According to another aspect of the present invention, a rendering and display device for human-computer interaction content is provided, configured in an intelligent dialogue client, the device comprising:
[0013] The data receiving module is used to acquire, in real time, the data to be displayed in the first data format of the server's response to user feedback.
[0014] The data parsing module is used to identify the target dialogue style identifier in the first data format fragment whenever a complete first data format fragment is identified in the data to be displayed, and to query the pre-established mapping relationship between style identifiers and style class names to obtain the target style class name that matches the target dialogue style identifier.
[0015] The data format conversion module is used to convert the first data format fragment into a second data format fragment based on the target style class that matches the target style class name after adding the target style class name to the first data format fragment.
[0016] The data rendering module is used to render the second data format fragment in real time to obtain a rendered display fragment;
[0017] The rendering data display module is used to cache the rendering display fragments obtained from real-time rendering into a rendering fragment collection, and to display each rendering display fragment in the rendering fragment collection to the client when the display conditions are met.
[0018] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0019] At least one processor; and
[0020] A memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the human-computer interaction content rendering and display method according to any embodiment of the present invention.
[0022] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a processor to execute and implement the rendering and display method of human-computer interaction content as described in any embodiment of the present invention.
[0023] According to another aspect of the present invention, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the method as described in any embodiment of the present invention.
[0024] This invention enables the client to obtain, in real-time, the first data format of data to be displayed from the server's feedback to user questions during intelligent dialogue interaction. Whenever a complete segment is identified in the data to be displayed, the client identifies the target dialogue style identifier within that segment, queries the pre-established mapping relationship between style identifiers and style class names, obtains the target style class name matching the target dialogue style identifier, and adds it to the first data format segment. Based on the target style class matching the target style class name, the client converts the first data format segment into a second data format segment and performs real-time rendering. The resulting rendered display segments are cached in a set of rendered segments, and when display conditions are met, each rendered display segment in the set is displayed to the client. In this technical solution, the client identifies the identifier in the server's feedback data, determines the corresponding custom target style class, and displays the data according to the data display style defined by the target style class. This achieves the encapsulation and parsing of underlying front-end and back-end interactive message transmission in human-computer interaction scenarios, adapts to specific complex business interaction processes, and enables high-performance rendering.
[0025] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a flowchart of a method for rendering and displaying human-computer interaction content according to Embodiment 1 of the present invention;
[0028] Figure 2 This is a flowchart of a method for rendering and displaying human-computer interaction content according to Embodiment 2 of the present invention;
[0029] Figure 3 This is a schematic diagram of the structure of a human-computer interaction content rendering and display device according to Embodiment 3 of the present invention;
[0030] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the human-computer interaction content rendering and display method of the embodiments of the present invention. Detailed Implementation
[0031] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0032] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0033] Example 1
[0034] Figure 1This is a flowchart of a method for rendering and displaying human-computer interaction content according to Embodiment 1 of the present invention. This embodiment is applicable to the encapsulation and parsing of underlying front-end and back-end interactive message transmission in human-computer interaction scenarios, and is adapted to high-performance rendering of specific complex business interaction processes. This method can be executed by a rendering and display device for human-computer interaction content, which can be implemented in hardware and / or software, and is generally configured in an intelligent dialogue client. Figure 1 As shown, the method includes:
[0035] S110: Real-time acquisition of the first data format of the data to be displayed in response to user feedback.
[0036] The first data format is Markdown, a lightweight markup language, and the second data format is HTML, a hypertext markup language.
[0037] The data to be displayed can be customer questions sent by the client to the server, data information returned by the server, and finally displayed to the user on the client in a set display format.
[0038] Understandably, in a human-computer interaction intelligent dialogue scenario, the client receives user input and sends it to the backend server for processing. The server then sends the processed data to be displayed to the client in a pre-agreed first data format. During the interaction, the client receives the data to be displayed from the server in real time for subsequent parsing and processing.
[0039] S120. Whenever a complete first data format fragment is identified in the data to be displayed, the target dialogue style identifier is identified in the first data format fragment, and the pre-established mapping relationship between style identifiers and style class names is queried to obtain the target style class name that matches the target dialogue style identifier.
[0040] The first data format fragment can be a unit of data to be displayed in the first format, with the start and end of the data unit identified by specific characters in the first format data. The style class name can be a predefined class name that includes a data display style that can be used for development. The data display style defined in the class can include data font type, size, and color, etc. The style identifier can be a string containing the style in the first format data to be displayed, corresponding to the defined style class name. The target dialogue style identifier can be the dialogue style identifier of a complete first data format fragment in the identified data to be displayed, used for matching with the predefined style class name.
[0041] Understandably, before engaging in intelligent dialogue interaction, the client and server need to define classes containing data display styles and establish a mapping relationship between style class names and style identifiers so that the client can parse the data sent by the server. When the client receives the data to be displayed from the server and recognizes a complete first data format fragment, it determines the style class name corresponding to the target dialogue style identifier in the first data format fragment based on the pre-established mapping relationship between style identifiers and style class names, and thus determines the data display style defined by the style class name. For example, the pre-defined style identifier for the ordinary message type is " <normal>< / normal> If the corresponding style class name is "normal", then "normal" will be identified in the first data format fragment. <normal>< / normal> The style class name "normal" can be matched after that.
[0042] S130. After adding the target style class name to the first data format fragment, convert the first data format fragment into a second data format fragment based on the target style class that matches the target style class name.
[0043] The target style class name can refer to the style class name corresponding to the target dialogue style identifier in the first data format fragment, determined according to a pre-established mapping relationship. The second data format fragment can refer to the data fragment corresponding to the first data format fragment after being converted into Hypertext Markup Language (HTML) format.
[0044] Specifically, after determining the style class name based on the target dialogue style identifier in the first data format fragment, the corresponding style class name can be added to the corresponding field in the first data format fragment, and the first data format fragment can be converted into a second data format fragment carrying the same style class name information, which will serve as the processing basis when the second data format fragment is displayed.
[0045] S140. Render the second data format segment in real time to obtain a rendered display segment.
[0046] Rendering can refer to processing the data to be displayed according to the display style attributes contained in the second data format fragment.
[0047] Specifically, before the data to be displayed is shown on the client, the second data format fragment is rendered as a processing unit. Based on the display style defined by the target style class corresponding to the style class name contained in the second data format fragment, the data to be displayed is rendered to meet the requirement of being displayed on the client according to the set style.
[0048] S150. Cache the rendered display fragments obtained from real-time rendering into a set of rendered fragments, and display each rendered display fragment in the set of rendered fragments to the client when the display conditions are met.
[0049] Understandably, during a round of dialogue, the client receives data to be displayed from the server and processes it to obtain multiple second data format fragments. After rendering each second data format fragment, the client obtains a rendered display fragment and caches the rendered display fragments processed in the current round of dialogue into a set of rendered fragments. When the current round of dialogue ends, the client displays all the rendered display fragments in the set of rendered fragments in a centralized manner according to the rendered display style.
[0050] This invention enables the client to obtain, in real-time, the first data format of data to be displayed from the server's feedback to user questions during intelligent dialogue interaction. Whenever a complete segment is identified in the data to be displayed, the client identifies the target dialogue style identifier within that segment, queries the pre-established mapping relationship between style identifiers and style class names, obtains the target style class name matching the target dialogue style identifier, and adds it to the first data format segment. Based on the target style class matching the target style class name, the client converts the first data format segment into a second data format segment and performs real-time rendering. The resulting rendered display segments are cached in a set of rendered segments, and when display conditions are met, each rendered display segment in the set is displayed to the client. In this technical solution, the client identifies the identifier in the server's feedback data, determines the corresponding custom target style class, and displays the data according to the data display style defined by the target style class. This achieves the encapsulation and parsing of underlying front-end and back-end interactive message transmission in human-computer interaction scenarios, adapts to specific complex business interaction processes, and enables high-performance rendering.
[0051] Example 2
[0052] Figure 2 This is a flowchart of a method for rendering and displaying human-computer interaction content according to Embodiment 2 of the present invention. This embodiment is based on the above embodiment and is further specified, providing a specific method for the client to render data fed back from the server in human-computer interaction, resulting in various specific optional implementation methods for rendering data to be displayed according to the display style. For example... Figure 2 As shown, the method includes:
[0053] S210. Establish an SSE communication connection with the server based on the SSE protocol for sending events from the server.
[0054] Specifically, in human-computer interaction scenarios, after receiving data from the client, the server processes the received data using a large model to obtain the data to be displayed, which is then transmitted to the client via SSE (Server Sent Events) to enable the server to continuously push data to the client. The client can create an SSE utility class to handle the initialization, connection opening, message processing, error handling, and protocol closure of the SSE protocol, ensuring normal data transmission logic and resource reclamation between the server and client. The initialization process establishes a connection between the client and server, specifying the server URL (Uniform Resource Locator) address and protocol data request header information. The connection opening process sets up a listener function to record the SSE connection opening flag logic. The message processing process listens for server-pushed data, collects markdown formatted data fragments pushed to the client, and submits them to a markdown parser for dialogue parsing and rendering. The markdown parser is the core module that converts the server-pushed data into data that can be directly rendered as a view. The error handling process allows you to set up listeners for server-side streaming push exceptions and collect logs of these exceptions for backtracking and troubleshooting. The protocol shutdown process can be used to release SSE connection resources and can be executed when the page is unloaded, ensuring proper resource reclamation for both the client and server sides.
[0055] S220: Real-time acquisition of data to be displayed in the first data format, pushed by the server in the form of an event stream in response to user feedback.
[0056] The first data format is Markdown, a lightweight markup language, and the second data format is HTML, a hypertext markup language.
[0057] In this context, the event stream format refers to the data that the server sends to the client being generated and transmitted in a continuous and segmented manner, rather than being generated as a complete data packet all at once. This allows for processing while the data is being transmitted, without having to wait for all the data to be ready.
[0058] Understandably, in human-computer interaction dialogues, the server sends the first data format of the user's feedback to the client in the form of an event stream. This allows the client to simultaneously receive the data to be displayed from the server in the current round of dialogue during the subsequent parsing and processing of the data to be displayed, thereby improving data processing efficiency.
[0059] S230. Whenever a complete first data format fragment is identified in the data to be displayed, the target dialogue style identifier is identified in the first data format fragment, and the pre-established mapping relationship between style identifiers and style class names is queried to obtain the target style class name that matches the target dialogue style identifier.
[0060] Optionally, iterate through the data to be displayed and add each character to the comparison string in turn;
[0061] Whenever it is determined that the matched strings can form a Markdown fragment, it is determined that a complete first data format fragment has been identified in the data to be displayed.
[0062] Specifically, after receiving the data to be displayed from the server, the client needs to perform segment recognition on the data. Each character in the data is added to a comparison string for comparison. When the comparison string matches a predefined complete Markdown segment identifier, a complete first-format data segment is identified. For example, the default is to use double newline characters "\n\n" as the end identifier for a Markdown segment, and "`` ```" as the end identifier for code blocks within Markdown data. Alternatively, when the server sends data to the client, it can directly use HTML format as needed. In this case, it can be judged based on predefined HTML format data identification identifiers, such as using closing tags "<>" to indicate the end of HTML format.
[0063] S240. After adding the target style class name to the first data format fragment, convert the first data format fragment into a second data format fragment based on the target style class that matches the target style class name.
[0064] Optionally, the target format type of the first data format fragment can be obtained according to a preset regular expression matching standard;
[0065] Based on the target format type, determine whether the first data format fragment is a first type of Markdown fragment used to generate ordinary HTML tags, or a second type of Markdown fragment used to generate HTML code blocks;
[0066] If the first data format fragment is a first-class Markdown fragment, then the first-class Markdown fragment is converted into a first-class HTML fragment according to the target format type;
[0067] The attribute identifiers contained in the first type of Markdown fragment are parsed, and according to the correspondence between the attribute identifiers and attribute information defined in the target style class, the attribute names and attribute values that match the attribute identifiers are added to the first type of HTML fragment.
[0068] If the first data format fragment is a second type of Markdown fragment, then the pre-loaded code parsing plugin is invoked to parse the code block of the second type of Markdown fragment and obtain the code block to be rendered contained in the second type of Markdown fragment;
[0069] If the code block to be rendered is within the preset toolbar whitelist, the target dialogue style of the code block theme data will be converted according to the code block to be rendered to obtain the second type of HTML fragment;
[0070] The generated first-type or second-type HTML fragment will be used as the second data format fragment.
[0071] In this context, "regular expression matching criteria" refers to using regular expression syntax rules to precisely find, match, or extract content from text that conforms to a specific pattern. "Target format type" refers to the specific type of data contained in the first data format fragment; for example, it could be text, images, or code. "HTML tags" are special codes used to mark the type and structure of different content (such as text, images, and links) in HTML data, identified by angle brackets <>. Mark paragraphs and Markup images. The first type of Markdown fragment can refer to data of other types besides code blocks contained in the first data format fragment. The second type of Markdown fragment can refer to code block type data contained in the first data format fragment. Attribute names can refer to names used to represent specific metrics of the data display style, such as font size, font type, and font color. Attribute values can refer to the specific information content corresponding to the attribute name, i.e., the specific settings of the data display style metrics, such as font size 16, font type SimSun, and font color red. Attribute identifiers can refer to identifiers defined in the style class used to represent the type of data display style metrics, such as font, image, and code. Attribute information can refer to the specific information content corresponding to the attribute identifier, i.e., the attribute name and attribute value that define the data display style; for example, the style class name contained in the first data format fragment is also attribute information. Code parsing plugins can refer to tools used to parse the second type of Markdown fragments in the first data format fragment, i.e., code type data; for example, the markdown-it plugin. Toolbar whitelists refer to predefined rules for special processing of specific data types in code blocks within the data to be displayed. For example, this could involve replacing sensitive fields or hiding specific code types. Subject data refers to data fields in the data to be displayed that conform to the predefined special processing rules in the toolbar whitelist. Target dialogue style refers to the data display style that the subject data needs to be converted to according to the predefined special processing rules in the toolbar whitelist. For example, if the predefined toolbar whitelist rules require replacing network address fields with "*", then the code block containing the network address field "192.168.1.101" would need to be replaced with "***.***.*.***" for display in the target dialogue style. Type 1 HTML fragments refer to data fragments in HTML format obtained from Type 1 Markdown fragments through tag and attribute parsing. Type 2 HTML fragments refer to data fragments in HTML format obtained from Type 2 Markdown fragments through tag and attribute parsing.
[0072] Specifically, during the conversion of a first data format fragment into a second data format fragment, the client first identifies the target format type of the currently processed first data format fragment according to a preset regular expression matching standard. This includes: a first type of Markdown fragment used to generate ordinary HTML tags, and a second type of Markdown fragment used to generate HTML code blocks. If the first data format fragment is identified as a first type of Markdown fragment, the client confirms the attribute name and attribute value corresponding to the data display style by matching the attribute identifiers and attribute information contained in the first type of Markdown fragment, and adds them to the first type of HTML fragment converted from the first type of Markdown fragment, thus completing the conversion of the first type of Markdown fragment into a first type of HTML fragment. If the first data format fragment is identified as a second type of Markdown fragment, the client calls a pre-loaded code parsing plugin to parse the code block, thereby obtaining a code block to be rendered containing data display style information. If the code block to be rendered conforms to the special processing rules defined by the preset toolbar whitelist, the client converts the theme data of the code block to the target dialogue style determined by the special processing rules defined by the toolbar whitelist, thereby obtaining a second type of HTML fragment. The first type of HTML fragment or the second type of HTML fragment generated from the first data format fragment are collectively referred to as the second data format fragment, which is used for subsequent data rendering processing.
[0073] Optionally, detect whether the first data format fragment contains custom HTML attribute configuration information;
[0074] If so, extract the configuration information from the custom HTML attribute configuration information that modifies the first attribute value of the target attribute in the target tag type to the second attribute value;
[0075] In the second data format fragment of the generated target tag type, the attribute value of the target attribute is modified from the first attribute value to the second attribute value.
[0076] The target tag type can be the tag type corresponding to the custom HTML attribute configuration information, used to identify whether the attribute information corresponding to the tag needs to be modified. The target attribute can refer to the attribute information corresponding to the target tag type. The first attribute value can refer to the unmodified attribute value of the target tag type's attribute information in the first data format fragment. The second attribute value can refer to the modified attribute value of the target tag type's attribute information according to the custom HTML attribute configuration information.
[0077] Understandably, during the parsing of the data to be displayed, the client supports modifying the attribute information corresponding to tags in the first data format fragment. This can be achieved by detecting whether the currently parsed first data format fragment contains custom HTML attribute configuration information. If it does, the client determines the configuration information for modifying the target attribute in the target tag type based on the custom HTML attribute configuration information. Then, in the second data format fragment generated from the first data format fragment containing the target tag type, the attribute value of the target attribute is modified from the first attribute value to the second attribute value according to the determined configuration information. For example, to achieve the purpose of binding business data information to an HTML fragment, the link tag can be modified according to the custom HTML attribute configuration information. The corresponding target attribute value is changed from the first attribute value href to the second attribute value data-href, thereby achieving the purpose of intercepting the default behavior of link redirection.
[0078] S250. Render the second data format segment in real time to obtain a rendered display segment.
[0079] S260. Match the target HTML tags in the second data format fragment with each filter tag in the pre-built tag filtering rules;
[0080] Here, tag filtering rules refer to the rules defined for security processing of tag attributes of fragments in the second data format. Filtered tags refer to tags that need security processing as predefined in the tag filtering rules. Target HTML tags refer to the tags in the second data format fragment converted from the data to be displayed that currently need security processing.
[0081] Understandably, the second data format fragment obtained by converting the data to be displayed, i.e., the HTML format fragment, needs to undergo security processing before display to avoid XSS (Cross-Site Scripting) attacks caused by dangerous characters. The target HTML tags in the currently processed second data format fragment are matched with the filter tags in the pre-built tag filtering rules to determine whether security processing is required.
[0082] S270. When it is determined that the target HTML tag and the target filter tag are successfully matched, the second data format fragment is filtered according to the filtering rules that match the target filter tag.
[0083] Specifically, when the target HTML tag in the currently being processed second data format fragment successfully matches the target filter tag, the second data format fragment is filtered according to the matched filter rules. For example, all tags and attributes that may cause XSS attacks can be accurately identified and removed according to the filter rules, or the tags and attributes that are allowed to be retained can be explicitly specified according to the filter rules.
[0084] S280. Cache the rendered display fragments obtained from real-time rendering into a set of rendered fragments, and display each rendered display fragment in the set of rendered fragments to the client when the display conditions are met.
[0085] This invention, through the above technical solution, enables the server to feed back the data to be displayed to the client via the SSE protocol. The client identifies the Markdown fragment type corresponding to the first data format fragment in the data to be displayed, converts it into an HTML fragment of the corresponding type according to the corresponding custom target style class, and can modify the tag attribute information of the second data format fragment according to the user's pre-defined HTML attribute configuration information. After security filtering, the rendered display fragment obtained from the second data format fragment is cached in a rendered fragment set. When the display conditions are met, each rendered display fragment in the rendered fragment set is displayed to the client. In the above technical solution, during the process of parsing and processing the data to be displayed fed back by the server, the client can identify different types of Markdown fragments, modify the data tag attribute information according to the user's predefined rules, and perform security filtering before display. This enriches the expressive capabilities of HTML data display, meets the user's need for customized dialogue styles, and makes the development and processing of human-computer interaction business more flexible.
[0086] Example 3
[0087] Figure 3 This is a schematic diagram of the structure of a human-computer interaction content rendering and display device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a data receiving module 310, a data parsing module 320, a data format conversion module 330, a data rendering module 340, and a rendered data display module 350.
[0088] The data receiving module 310 is used to acquire, in real time, the data to be displayed in the first data format of the server's response to user feedback.
[0089] The data parsing module 320 is used to identify the target dialogue style identifier in the first data format fragment whenever a complete first data format fragment is identified in the data to be displayed, and to query the pre-established mapping relationship between style identifiers and style class names to obtain the target style class name that matches the target dialogue style identifier.
[0090] The data format conversion module 330 is used to convert the first data format fragment into a second data format fragment based on the target style class that matches the target style class name after adding the target style class name to the first data format fragment.
[0091] The data rendering module 340 is used to render the second data format fragment in real time to obtain a rendered display fragment;
[0092] The rendering data display module 350 is used to cache the rendering display fragments obtained from real-time rendering into a rendering fragment collection, and to display each rendering display fragment in the rendering fragment collection to the client when the display conditions are met.
[0093] This invention enables the client to obtain, in real-time, the first data format of data to be displayed from the server's feedback to user questions during intelligent dialogue interaction. Whenever a complete segment is identified in the data to be displayed, the client identifies the target dialogue style identifier within that segment, queries the pre-established mapping relationship between style identifiers and style class names, obtains the target style class name matching the target dialogue style identifier, and adds it to the first data format segment. Based on the target style class matching the target style class name, the client converts the first data format segment into a second data format segment and performs real-time rendering. The resulting rendered display segments are cached in a set of rendered segments, and when display conditions are met, each rendered display segment in the set is displayed to the client. In this technical solution, the client identifies the identifier in the server's feedback data, determines the corresponding custom target style class, and displays the data according to the data display style defined by the target style class. This achieves the encapsulation and parsing of underlying front-end and back-end interactive message transmission in human-computer interaction scenarios, adapts to specific complex business interaction processes, and enables high-performance rendering.
[0094] Optionally, the data receiving module 310 can be specifically used to: establish an SSE communication connection with the server based on the server-sent event SSE protocol; and acquire, in real time, the first data format of the data to be displayed, pushed by the server in the form of an event stream in response to user feedback.
[0095] Optionally, the data parsing module 320 can be specifically used to: traverse and obtain each character in the data to be displayed, and add them sequentially to the comparison string. Whenever it is determined that the comparison string can form a Markdown fragment, it is determined that a complete first data format fragment has been identified in the data to be displayed.
[0096] Optionally, the data format conversion module 330 can be specifically used to: obtain the target format type of the first data format fragment according to a preset regular expression matching standard; determine whether the first data format fragment is a first-type Markdown fragment used to generate ordinary HTML tags or a second-type Markdown fragment used to generate HTML code blocks based on the target format type; if the first data format fragment is a first-type Markdown fragment, convert it into a first-type HTML fragment according to the target format type; parse the attribute identifiers contained in the first-type Markdown fragment, and add attribute names and values matching the attribute identifiers to the first-type HTML fragment according to the correspondence between attribute identifiers and attribute information defined in the target style class; if the first data format fragment is a second-type Markdown fragment, call the pre-loaded code parsing plugin to parse the code block of the second-type Markdown fragment and obtain the code block to be rendered contained in the second-type Markdown fragment; if the code block to be rendered is within a preset toolbar whitelist, convert the target dialogue style of the code block theme data according to the code block to be rendered to obtain the second-type HTML fragment; and use the generated first-type HTML fragment or second-type HTML fragment as the second data format fragment.
[0097] Optionally, the data receiving module 310 can also be specifically used to: detect whether the first data format fragment contains custom HTML attribute configuration information. If so, extract the configuration information from the custom HTML attribute configuration information that modifies the first attribute value of the target attribute in the target tag type to the second attribute value. In the generated second data format fragment of the target tag type, modify the attribute value of the target attribute from the first attribute value to the second attribute value.
[0098] Optionally, a data filtering module may also be included, used to: match target HTML tags in the second data format fragment with each filter tag in a pre-built tag filtering rule. When it is determined that a target HTML tag successfully matches a target filter tag, the second data format fragment is filtered according to the filtering rule that matches the target filter tag.
[0099] The rendering and display device for human-computer interaction content provided in the embodiments of the present invention can execute the rendering and display method for human-computer interaction content provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method.
[0100] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0101] Example 4
[0102] Figure 4 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0103] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0104] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0105] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as methods for rendering and displaying human-computer interaction content.
[0106] That is, to obtain the first data format of the data to be displayed from the server in response to user feedback in real time;
[0107] Whenever a complete first data format fragment is identified in the data to be displayed, the target dialogue style identifier is identified in the first data format fragment, and the pre-established mapping relationship between style identifiers and style class names is queried to obtain the target style class name that matches the target dialogue style identifier.
[0108] After adding the target style class name to the first data format fragment, the first data format fragment is converted into a second data format fragment based on the target style class that matches the target style class name.
[0109] The second data format fragment is rendered in real time to obtain a rendered display fragment;
[0110] The rendered display fragments obtained from real-time rendering are cached in a set of rendered fragments, and when the display conditions are met, each rendered display fragment in the set is displayed to the client.
[0111] In some embodiments, the method for rendering and displaying human-computer interaction content can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method for rendering and displaying human-computer interaction content described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the method for rendering and displaying human-computer interaction content by any other suitable means (e.g., by means of firmware).
[0112] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0113] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0114] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0115] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0116] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0117] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0118] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0119] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for rendering and displaying human-computer interaction content, characterized in that, Executed by the intelligent dialogue client, the method includes: Real-time acquisition of the server's initial data format in response to user feedback, ready for display; Whenever a complete first data format fragment is identified in the data to be displayed, the target dialogue style identifier is identified in the first data format fragment, and the pre-established mapping relationship between style identifiers and style class names is queried to obtain the target style class name that matches the target dialogue style identifier. After adding the target style class name to the first data format fragment, the first data format fragment is converted into a second data format fragment based on the target style class that matches the target style class name. The second data format fragment is rendered in real time to obtain a rendered display fragment; The rendered display fragments obtained from real-time rendering are cached in a set of rendered fragments, and when the display conditions are met, each rendered display fragment in the set is displayed to the client.
2. The method according to claim 1, characterized in that, The first data format is Markdown, a lightweight markup language, and the second data format is HTML, a hypertext markup language.
3. The method according to claim 2, characterized in that, Based on the target style class that matches the target style class name, the first data format fragment is converted into a second data format fragment, including: According to the preset regular expression matching criteria, obtain the target format type of the first data format fragment; Based on the target format type, determine whether the first data format fragment is a first type of Markdown fragment used to generate ordinary HTML tags, or a second type of Markdown fragment used to generate HTML code blocks; If the first data format fragment is a first-class Markdown fragment, then the first-class Markdown fragment is converted into a first-class HTML fragment according to the target format type; The attribute identifiers contained in the first type of Markdown fragment are parsed, and according to the correspondence between the attribute identifiers and attribute information defined in the target style class, the attribute names and attribute values that match the attribute identifiers are added to the first type of HTML fragment. If the first data format fragment is a second type of Markdown fragment, then the pre-loaded code parsing plugin is invoked to parse the code block of the second type of Markdown fragment and obtain the code block to be rendered contained in the second type of Markdown fragment; If the code block to be rendered is within the preset toolbar whitelist, the target dialogue style of the code block theme data will be converted according to the code block to be rendered to obtain the second type of HTML fragment; The generated first-type or second-type HTML fragment will be used as the second data format fragment.
4. The method according to claim 3, characterized in that, Based on the target style class that matches the target style class name, the first data format fragment is converted into a second data format fragment, which also includes: Detect whether the first data format fragment contains custom HTML attribute configuration information; If so, extract the configuration information from the custom HTML attribute configuration information that modifies the first attribute value of the target attribute in the target tag type to the second attribute value; In the second data format fragment of the generated target tag type, the attribute value of the target attribute is modified from the first attribute value to the second attribute value.
5. The method according to claim 2, characterized in that, The data to be displayed is identified as a complete fragment of the first data format, including: Iterate through the data to be displayed and add each character to the comparison string in turn. Whenever it is determined that the matched strings can form a Markdown fragment, it is determined that a complete first data format fragment has been identified in the data to be displayed.
6. The method according to any one of claims 1-5, characterized in that, After converting the first data format fragment to the second data format fragment based on the target style class that matches the target style class name, the process also includes: Match the target HTML tags in the second data format fragment with the filter tags in the pre-built tag filtering rules; When it is determined that the target HTML tag successfully matches the target filter tag, the second data format fragment is filtered according to the filtering rules that match the target filter tag.
7. The method according to any one of claims 1-5, characterized in that, Before acquiring the first data format of the user's feedback from the server in real time, the process also includes: Establish an SSE communication connection with the server based on the SSE protocol for sending events from the server. Accordingly, the system acquires the first data format of the user's feedback from the server in real time, which is then displayed. This includes: The system acquires data in real time from the server in response to user feedback, and pushes the first data format of the data to be displayed in the form of an event stream.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the rendering and display method of human-computer interaction content according to any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that are used to cause a processor to execute the rendering and display method of human-computer interaction content according to any one of claims 1-7.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method for rendering and displaying human-computer interaction content according to any one of claims 1-7.