Large model interaction page rendering method and system, electronic equipment and storage medium

By obtaining and registering front-end page processing rules for specific languages ​​in the field, processing large-model response messages and generating object codes, the problem of fixed rendering methods of large-model interactive pages in the existing technology is solved, and custom rendering and flexible display are realized.

CN119396950APending Publication Date: 2025-02-07CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411296226.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

The existing front-end large-model interactive page cannot meet the business party's custom interactive display needs, and the rendering method is fixed and cannot be flexibly adjusted.

Method used

By obtaining front-end page processing rules based on domain-specific languages, registering in domain-specific language parser, receiving large-model response messages and processing them through parser, generating object code to render the response messages.

Benefits of technology

It realizes custom rendering of large-model interactive pages, meets the front-end interactive display needs of business parties, and provides flexible rendering methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396950A_ABST
    Figure CN119396950A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a large model interaction page rendering method and system, electronic equipment and a storage medium, and belongs to the technical field of front-end development. The method comprises the following steps: acquiring a front-end page processing rule based on a domain-specific language input by a user, and registering the front-end page processing rule into a domain-specific language analyzer; and processing the response message through a front-end page processing rule in the domain-specific language parser to obtain a target code, and executing the target code to render the response message on the front-end interaction page. According to the application, a front-end page processing rule custom function is provided for a user based on a domain-specific language, a custom rule of the user is registered in a domain-specific language parser, and when a response message of a large model is received, a target code for rendering the response message is determined through the domain-specific language parser; custom rendering of the response message is achieved, and the large-model front-end interactive display requirement of a business party is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of front-end development technology, and in particular to a large-model interactive page rendering method, system, electronic device and storage medium. Background Art

[0002] The multimodal display of the large model interactive chat window mainly displays various types of information, such as video, audio, markdown, etc. Among them, the response rendering and event response of markdown are widely used in various scenarios of front-end development. At present, the front-end large model interactive page can only render large model messages in a fixed way, which cannot meet the front-end interactive display needs of the business side. Summary of the invention

[0003] The main purpose of the embodiments of the present application is to propose a large model interactive page rendering method, system, electronic device and storage medium, aiming to meet the business party's large model front-end interactive display needs.

[0004] To achieve the above purpose, one aspect of an embodiment of the present application proposes a large model interactive page rendering method, including:

[0005] Get the front-end page processing rules based on domain-specific languages;

[0006] Registering the front-end page processing rules into a domain specific language parser;

[0007] Receiving a response message from the big model through the big model response processing module;

[0008] Processing the response message through the front-end page processing rules in the domain-specific language parser to obtain a target code;

[0009] Execute the target code to render the response message on the front-end interactive page.

[0010] In some embodiments, the large model interactive page rendering method further includes the following steps:

[0011] Obtaining a message rendering configuration, and determining a corresponding text rendering mode according to the message rendering configuration, wherein the text rendering mode is a streaming rendering mode or a one-time rendering mode;

[0012] The text rendering mode is registered in the large model response processing module, so that the large model response processing module submits the response message to the domain specific language parser according to the text rendering mode.

[0013] In some embodiments, the obtaining of the front-end page processing rules based on the domain-specific language comprises the following steps:

[0014] Determine a custom renderer based on the input domain-specific language-based message rendering logic;

[0015] Configure an execution event of a renderer according to an input event processing logic based on a domain specific language, wherein the renderer is at least one of a custom renderer and a system renderer;

[0016] A front-end page processing rule is determined according to the custom renderer and the execution event of the renderer.

[0017] In some embodiments, the large model interactive page rendering method further includes the following steps:

[0018] Initializing a front-end interactive page according to an initialization rendering rule in the front-end page processing rule, wherein the front-end interactive page includes a question input component;

[0019] In response to the question event of the question input component, the renderer corresponding to the question event is determined according to the front-end page processing rules to render the question text in the question input component on the front-end interactive page, and send the question text through the large model sending device.

[0020] In some embodiments, the processing of the response message by the front-end page processing rule in the domain-specific language parser to obtain the target code comprises the following steps:

[0021] Determine the dialog component rendering logic corresponding to the response message according to the front-end page processing rule, wherein the dialog component rendering logic includes rendering event logic and message rendering logic;

[0022] Parsing the response message to obtain data to be rendered;

[0023] A domain specific language code is determined according to the data to be rendered and the dialog component rendering logic, and the domain specific language code is converted into a target code.

[0024] In some embodiments, the large model interactive page rendering method further includes the following steps:

[0025] In response to a log query event of the dialog component, determining a renderer corresponding to the log query event according to the front-end page processing rule;

[0026] The renderer corresponding to the log query event is executed to render the rendering log of the dialog component on the front-end interactive page.

[0027] In some embodiments, the execution events include message body interaction events and message body element interaction events.

[0028] To achieve the above purpose, another aspect of the embodiment of the present application proposes a large model interactive page rendering system, including:

[0029] The first module is used to obtain the front-end page processing rules based on the domain-specific language;

[0030] The second module is used to register the front-end page processing rules into the domain specific language parser;

[0031] The third module is used to receive a response message from the large model through the large model response processing module;

[0032] The fourth module is used to process the response message through the front-end page processing rules in the domain specific language parser to obtain the target code;

[0033] The fifth module is used to execute the target code to render the response message on the front-end interactive page.

[0034] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application proposes an electronic device, which includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory, and the program implements the method described in the above embodiment when executed by the processor.

[0035] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium used for computer-readable storage, and the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method described in the above embodiment.

[0036] The large model interactive page rendering method, system, electronic device and storage medium proposed in the present application obtain the front-end page processing rules based on the domain-specific language input by the user, and then register the front-end page processing rules in the domain-specific language parser. When the large model response processing module receives a response message from the large model, the response message is processed by the front-end page processing rules in the domain-specific language parser to obtain the target code, and the target code is executed to render the response message on the front-end interactive page. The present application provides the user with a customized function for front-end page processing rules based on the domain-specific language, registers the user's customized rules in the domain-specific language parser, and when the system receives the response message of the large model, the domain-specific language parser determines the target code for rendering the response message, realizes customized rendering of the response message, and meets the business party's large model front-end interactive display needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a flowchart of the large model interactive page rendering method provided in an embodiment of the present application;

[0038] Figure 2 is a flowchart of a large model interactive page rendering method provided by another embodiment of the present application;

[0039] Figure 3 yes Figure 1 Flow chart of step S101 in FIG.

[0040] Figure 4 is a flowchart of a large model interactive page rendering method provided by another embodiment of the present application;

[0041] Figure 5 yes Figure 1 Flow chart of step S104 in FIG.

[0042] Figure 6 is a flowchart of a large model interactive page rendering method provided by another embodiment of the present application;

[0043] Figure 7 It is a structural diagram of a large model interactive page rendering system provided in an embodiment of the present application;

[0044] Figure 8 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0045] Fig. 9 This is a schematic diagram of a large model interactive page provided in an embodiment of the present application;

[0046] Fig.10 This is a schematic diagram of a robot dialogue text box provided in an embodiment of the present application;

[0047] Fig.11 This is a schematic diagram of a complex rendering interaction scenario of a custom robot dialog component provided in an embodiment of the present application;

[0048] Fig.12 It is a schematic diagram of the custom rendering logic process of the response message provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0050] It should be noted that, although the functional modules are divided in the system and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0052] First, some nouns involved in this application are analyzed:

[0053] Web technologies, including JavaScript, HTML, CSS, DOM, and DOM browser-related events, such as click events.

[0054] JavaScript ("JS") is a lightweight, interpreted or just-in-time compiled programming language with function priority. Although it is famous as a scripting language for developing Web pages, it is also used in many non-browser environments. JavaScript is a dynamic scripting language based on prototype programming and multiple paradigms, and supports object-oriented, imperative, declarative, and functional programming paradigms.

[0055] DSL (Domain-Specific Language) is a programming language designed for a specific domain or application. DSL can make it easier and more efficient to write applications in a specific domain, and can improve the readability and maintainability of the code. DSL can be divided into two types: internal DSL and external DSL. Internal DSL is a DSL embedded in the main programming language, while external DSL is an independent programming language that usually requires the use of specific tools or frameworks to parse and execute. This embodiment uses an external DSL, which is an original language specifically used to solve the large model interactive page in this embodiment, and needs to be parsed by the DSL parser in this example.

[0056] Plain text is a very basic way of representing data. It only contains text content and limited character encoding information, and does not contain any format, font or color information. Plain text files only save text content, not the style of the text, and the file size is usually just the size of the text content.

[0057] Rich Text Format (RTF) is a cross-platform document format developed by Microsoft. Rich text not only saves text content, but also saves text style, font, color, and possible rich media content such as pictures and hyperlinks. Rich text files are usually larger than plain text files because in addition to text content, additional space is required to store formatting and style information.

[0058] Markdown is a lightweight markup language designed to simplify the text formatting process. It writes documents in plain text (easy to read, write, and change) and can eventually be published in HTML format.

[0059] DOM (Document Object Model) is a standard of W3C (World Wide Web Consortium) that defines the interface for accessing and manipulating the content, structure and style of HTML or XML documents. DOM regards a document (such as an HTML page) as a tree structure, in which each node is an object. These objects can be used to access and manipulate the structure, style and content of the document during programming.

[0060] DOM nodes. In HTML DOM, every element is a node. The document is a document node. All HTML elements are element nodes. All HTML attributes are attribute nodes. Text inserted into an HTML element is a text node.

[0061] CSS (Cascading Style Sheets) is a markup language used for web design, which defines the style and layout of various elements in a web page. The main function of CSS is to separate the content and style of a web page, making the structure of the web page clearer and easier to maintain and modify. The design goal of CSS is to make it easier for web designers to create web pages with rich styles, and also to make it easier for browsers to present web pages.

[0062] XSS attack: XSS is a computer security vulnerability in web applications that allows malicious web users to insert code into pages provided to other users.

[0063] Vue3: is a popular open source JavaScript framework for building user interfaces and single-page applications.

[0064] Asynchronous interface is a communication mechanism that allows the system to continue to execute other tasks after submitting a task without waiting for the task to be completed. The purpose of the design of asynchronous interface is that when a user or system initiates a request or operation, it does not need to get the result immediately, but can give up control and continue to handle other things until the result is available to notify the user or system. Asynchronous interface is usually used to handle scenarios that do not require immediate response or can tolerate a certain delay, such as receiving webhook notifications, background data processing, etc.

[0065] The SSE (Server-Sent Events) streaming interface is a technology for actively pushing data to a target object, allowing event notifications to be gradually sent to the target object while the connection remains open. These events can be text data or data in other formats.

[0066] Browser event delegation is a design pattern commonly used in software development. It allows an object (delegating object) to delegate the responsibility for handling specific events to another object (proxy object), thereby achieving decoupling and flexibility. In the traditional event handling model, objects usually register and handle events directly. However, in the event delegation pattern, the delegate object does not handle events directly, but sends events to the proxy object for processing. This pattern utilizes the event bubbling mechanism, that is, the event starts from the deepest node (or target node) and then propagates upward step by step to the least specific node, that is, the node where the event handler is added. By binding events to parent elements and handling events of child elements through the event bubbling mechanism, event delegation can reduce DOM operations and improve performance, especially when processing a large number of elements.

[0067] The embodiments of the present application provide a large model interactive page rendering method, system, electronic device and storage medium, which are intended to meet the business party's large model front-end interactive display needs.

[0068] The large model interactive page rendering method, system, electronic device and storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the large model interactive page rendering method in the embodiments of the present application is described.

[0069] The large model interactive page rendering method provided in the embodiment of the present application relates to the field of front-end development technology. The large model interactive page rendering method provided in the embodiment of the present application can be applied to the terminal, can also be applied to the server side, and can also be software running in the terminal or the server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or it can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured to provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms and other basic cloud computing services. Cloud servers; software can be applications that implement large model interactive page rendering methods, etc., but are not limited to the above forms.

[0070] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0071] Figure 1 is an optional flowchart of the large model interactive page rendering method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S105.

[0072] Step S101, obtaining a front-end page processing rule based on a domain specific language;

[0073] Step S102, registering the front-end page processing rules into the domain specific language parser;

[0074] Step S103, receiving a response message from the large model through the large model response processing module;

[0075] Step S104, processing the response message through the front-end page processing rules in the domain-specific language parser to obtain the target code;

[0076] Step S105, executing the target code to render the response message on the front-end interactive page.

[0077] Steps S101 to S105 shown in the embodiment of the present application, by obtaining the front-end page processing rules based on the domain-specific language input by the user, and then registering the front-end page processing rules in the domain-specific language parser, when the response message from the large model is received through the large model response processing module, the response message is processed by the front-end page processing rules in the domain-specific language parser to obtain the target code, and the target code is executed to render the response message on the front-end interactive page. The embodiment of the present application provides the user with a customized function for front-end page processing rules based on the domain-specific language, registers the user's customized rules in the domain-specific language parser, and when the system receives the response message of the large model, the domain-specific language parser determines the target code for rendering the response message, implements customized rendering of the response message, and meets the business party's large model front-end interactive display needs.

[0078] In step S101 of some embodiments, the languages ​​used by the front end to build Web applications include HTML, CSS, JavaScript, and frameworks such as React, Vue, and Angular used to build Web applications. Generally, developers will use the above technologies to develop Web large model dialogue applications and encapsulate them for use by business parties. Considering that the business party may need to customize the display form or interactive logic of the large model dialogue application according to its own business needs, in order to facilitate the customization of the business party and simplify the difficulty of customizing the rendering logic, the embodiment of the present application defines a mapping relationship between the DSL language and the Web application programming language, thereby building a DSL parsing layer. The front-end developers of the business party can use the easy-to-describe DSL language to register the front-end page processing rules to the large model dialogue application. The front-end page processing rules are used to define the rendering logic of the large model interactive page. The rendering logic includes event processing logic and data rendering logic. The event processing logic is used to characterize the execution timing of the data rendering operation, and the data rendering logic is used to characterize the data rendering method, that is, to define the display style of the data rendering. For example, assuming that the business requirement is that when a user clicks on the robot avatar, the big model related information can be displayed in a specific style, the front-end developer of the business party can use DSL language to describe the logic of the above business requirement, thereby realizing the registration of front-end page processing rules to the big model dialogue application.

[0079] In step S102 of some embodiments, the front-end page processing rules described in the domain-specific language cannot be directly run in the browser. The domain-specific language needs to be converted into the programming language of the browser (such as JavaScript) to run the front-end page processing rules. Therefore, the front-end page processing rules need to be registered in the domain-specific language parser to achieve language conversion of the front-end page processing rules. Specifically, the parsing file in the domain-specific language parser includes lexical rules and grammatical rules. Lexical rules define various symbols (such as keywords, identifiers, and operators) in the DSL language, and grammatical rules define how the above symbols are combined into valid expressions. The file can be compiled into a JavaScript file through the command line tool of Jison, and the input domain-specific language can be parsed through the JavaScript file.

[0080] In step S103 of some embodiments, the big model dialogue application includes a big model sending module and a big model answer processing module. The big model sending module is used to send a question text message to the big model backend, and the big model answer processing module is used to receive an answer message from the big model and submit the answer message to a DSL parser (i.e., a domain-specific language parser) for processing.

[0081] In step S104 of some embodiments, after receiving the response message, the DSL parser determines the rendering logic of the response message in combination with the front-end page processing rules stored therein, and converts the rendering logic into a programming language representation of the browser to obtain a target code executable by the browser.

[0082] In step S105 of some embodiments, the target code is submitted to the browser thread for execution, thereby achieving customized rendering of the response message.

[0083] See also Figure 2 In some embodiments, the large model interactive page rendering method of the embodiment of the present application may include but is not limited to steps S201 to S202:

[0084] Step S201, obtaining a message rendering configuration, and determining a corresponding text rendering mode according to the message rendering configuration, wherein the text rendering mode is a streaming rendering mode or a one-time rendering mode;

[0085] Step S202: register the text rendering mode into the large model response processing module, so that the large model response processing module submits a response message to the domain specific language parser according to the text rendering mode.

[0086] In this embodiment, a streaming rendering service and a one-time rendering service are encapsulated in the large model dialogue application. The streaming rendering service is used to render the answer text of the reply message word by word on the front-end interactive page, and specifically, the answer text of the reply message can be rendered word by word on the robot dialog box of the front-end interactive page. The one-time rendering service is used to render the answer text of the reply message as a whole on the front-end interactive page, and specifically, the answer text of the reply message can be rendered as a whole on the robot dialog box of the front-end interactive page. The business party can set the message rendering configuration, and the large model dialogue application determines the corresponding text rendering mode according to the set message rendering configuration. The text rendering mode can be a streaming rendering mode or a one-time rendering mode, and then the text rendering mode is registered in the large model answer processing module. The large model answer processing module submits the answer message to the DSL parser in a streaming manner or a one-time manner based on the configured text rendering mode, thereby realizing a streaming rendering service or a one-time rendering service.

[0087] In some embodiments, the large model sending module can support both the common asynchronous interface and the SSE streaming interface, both of which are websokect interfaces. The large model sending module also provides a request parameter interface adaptation function, that is, the large model sending module can encapsulate the question text according to the calling rules of the large model backend calling interface to generate a calling request that conforms to the calling format of the large model backend calling interface.

[0088] In some embodiments, the large model response processing module receives and caches response messages and supports return parameter adaptation, that is, the response message is adapted according to the return message format of the large model backend to process the response message into the form required for subsequent processing of the large model dialogue application. The large model response processing module also supports processing for message processing exceptions or sending exceptions. The large model response processing module can use the SSE streaming interface to receive the response message. The SSE streaming interface is configured with a stop generation function, which can respond to the user's stop receiving instruction and suspend receiving the large model's response message.

[0089] In some embodiments, the large model dialogue application also supports rendering services for Markdown documents by configuring a Markdown syntax parser in the large model response processing module to parse the received response message in the form of a Markdown document, for example, parsing out titles, paragraphs, lists, pictures and other contents, and generating a response message recognizable by a DSL parser based on the parsed content (such as using DSL language to describe the Markdown document), thereby realizing the rendering service of the Markdown document.

[0090] See also Figure 3In some embodiments, step S101 may include but is not limited to steps S301 to S303:

[0091] Step S301, determining a custom renderer according to the input domain-specific language-based message rendering logic;

[0092] Step S302, configuring an execution event of a renderer according to the input event processing logic based on a domain specific language, wherein the renderer is at least one of a custom renderer and a system renderer;

[0093] Step S303: determining a front-end page processing rule according to the custom renderer and the execution event of the renderer.

[0094] In this embodiment, please refer to Fig. 9 The front-end page includes multiple parts, such as a background layer, a question input component 300, a user dialog component 100, and a robot dialog component 200. Accordingly, the front-end page processing rules may include at least one of the processing rules of the background layer, the processing rules of the question input component, the processing rules of the user dialog component, and the processing rules of the robot dialog component. In one example, the business party can customize the processing rules of the robot dialog component using DSL according to its own business needs, thereby defining the rendering logic of the response message.

[0095] A renderer mainly refers to a component or mechanism responsible for converting front-end code into a visual interface that can be displayed by the browser. This process usually involves multiple steps, including parsing HTML documents, calculating and applying CSS styles, and executing JavaScript, and finally rendering the content to the user's screen. The browser has a built-in system renderer, which can use the system rendering mechanism to achieve simple rendering of front-end pages (such as robot dialog components) and generate web page content that users can see. Business parties can customize the renderer by registering a new rendering mechanism by entering the rendering logic of a specific domain language, which can perform complex rendering of the front-end page. For example, by entering the message rendering logic for the robot dialog component, a custom renderer for the robot dialog component is built to achieve custom rendering of the reply message.

[0096] Furthermore, the business party can input the event processing logic of the DSL language to configure the execution event of the renderer. For example, the event processing logic is "If the question text is not empty and the send event is triggered, use the xxx (name) renderer", where the renderer name specifies the rendering object (such as the user dialog component) and the renderer (system renderer or custom renderer). Through the event processing logic, it can be determined that the execution event of the xxx renderer is that the question text is not empty and the send button is triggered. The various renderers customized by the business party and the configured renderer execution events together form the front-end page processing rules.

[0097] See also Figure 4 In some embodiments, the large model interactive page rendering method of the embodiment of the present application may also include but is not limited to steps S401 to S403:

[0098] Step S401, initializing the front-end interactive page according to the initialization rendering rule in the front-end page processing rule, wherein the front-end interactive page includes a question input component;

[0099] Step S402, in response to the question event of the question input component, determine the renderer corresponding to the question event according to the front-end page processing rules, render the question text in the question input component on the front-end interactive page, and send the question text through the large model sending device.

[0100] In this embodiment, after the business direction big model dialogue application registers the front-end page processing rules, the big model dialogue application can execute the corresponding initialization renderer according to the front-end page processing rules to initialize the front-end interactive page. The initialized front-end interactive page includes a question input component. Further, the initialized front-end interactive page can also include a robot dialog component, which includes a robot avatar and a dialog box. The dialog box can display the introduction content of "Hello, I am happy to serve you. Please describe the question you want to consult." After the user enters the question text in the question input component and clicks the "Send" button, the question event is triggered. The big model dialogue application calls the renderer corresponding to the question event according to the rendering logic of the user dialog component described in the front-end page processing rules, that is, after the question event occurs, the renderer is used to describe the rendering mechanism of the user dialog component, including the display style, and the question text is rendered by the renderer, so that the user dialog component containing the question text is displayed on the front-end interactive page. At the same time, after the question event occurs, the question text is sent through the big model sending device.

[0101] See also Figure 5 In some embodiments, step S104 may include but is not limited to steps S501 to S502:

[0102] Step S501, determining the dialog component rendering logic corresponding to the response message according to the front-end page processing rule, wherein the dialog component rendering logic includes rendering event logic and message rendering logic;

[0103] Step S502, parsing the response message to obtain data to be rendered;

[0104] Step S503 , determining a domain specific language code according to the data to be rendered and the dialog component rendering logic, and converting the domain specific language code into a target code.

[0105] In this embodiment, the front-end page processing rules in the DSL parser define the rendering logic of the reply message, that is, the robot dialog component rendering logic, which includes the rendering event logic and message rendering logic of the robot dialog component. After receiving the reply message, the DSL parser determines to adopt the robot dialog component rendering logic, and parses the reply message according to the rendering fields described in the robot dialog component rendering logic to obtain the data to be rendered. Exemplarily, the rendering fields include the answer text and the data source. By parsing the reply message with the custom rendering fields, the answer text data and the data source description data in the reply message can be extracted. Based on the data to be rendered and the dialog component rendering logic, the domain-specific language code that describes the rendering logic of the data to be rendered is determined, and then the domain-specific language code is compiled into the target code of the JavaScript language according to the parsing file in the DSL parser. The browser executes the target code to display it on the front-end page as follows. Fig.10 The robot dialogue text box shown shows the robot avatar, answer text and data source.

[0106] In some embodiments, the response message provided by the large model may be in plain text or rich text. If the large model provides a plain text response message, it is necessary to add rendering logic to the response message through the DSL parser of the embodiment of the present application to implement a customized description of the style of the format, font, or color of the plain text. If the large model provides a rich text response message, the response message can be directly rendered using the corresponding system renderer, or the rich text can be input into the DSL parser, and the default style of the rich text can be overwritten using the customized message rendering logic (including style definition) to implement a customized description of the style of the format, font, or color of the rich text.

[0107] In some embodiments, the large model dialogue application can set an XSS whitelist mechanism to improve the XSS attack problem when rendering rich text. The XSS whitelist mechanism is a method that predefines a set of allowed HTML tags and attributes (i.e., a whitelist) and filters the HTML code entered by the user on the application backend, retaining only the tags and attributes defined in the whitelist, which can effectively prevent the injection of malicious script code, thereby protecting the security of the application backend and users.

[0108] See also Figure 6 In some embodiments, the large model interactive page rendering method of the embodiment of the present application may include but is not limited to steps S601 to S602:

[0109] Step S601, in response to a log query event of a dialog component, determining a renderer corresponding to the log query event according to a front-end page processing rule;

[0110] Step S602: execute the renderer corresponding to the log query event to render the rendering log of the dialog component on the front-end interactive page.

[0111] In this embodiment, the dialog component may be a robot dialog component or a user dialog component.

[0112] The embodiment of the present application provides a customized complex rendering dialog component rendering scenario. In the DSL parser of the large model dialogue application backend, the program code for rendering the robot dialog component is determined according to the front-end page processing rules, and the program code is executed to render the front-end interactive page as shown in the figure. Fig.11 In the robot dialog component 200 shown, after the user clicks the button below the dialog box in the user dialog component, a log query event is triggered. The large model dialog application backend responds to the log query event of the dialog component by executing the corresponding command in the program code to call and execute the renderer corresponding to the log query event (the renderer describes the rendering style of the JSON log and other mechanisms), and renders the rendering log of the dialog component on the front-end interactive page, as shown in FIG. Fig.11 The JSON log is shown.

[0113] In some embodiments, the above-mentioned execution events include message body interaction events and message body element interaction events. The message body interaction event is a custom event processing function of the entire message body (such as like, voice playback), and the message body element interaction event is an interaction event of a DOM element in the message body (such as click, mouseDown). The customization of the message body interaction event can be achieved by passing the DSL description language into the chat window, and the message body element interaction event is implemented through the browser's event delegation mechanism through the click callback function of the message renderer top-level mounted message.

[0114] In some embodiments, the front-end page of the large model dialogue application may also be configured to support dynamic themes or static themes.

[0115] According to some embodiments of the present application, referring to Fig.12 , the custom rendering logic process of the response message of the embodiment of the present application is explained, wherein the dotted box represents the background processing logic of the large model dialogue application.

[0116] First, the custom message rendering logic or custom event processing logic required by the registration service is registered through the business data adaptation descriptive DSL on the third-party front end, and the incoming registration data is sent to the back end for DSL parsing and adaptation to JSON code, and the large model interaction page is initialized on the front end page. Then, the back end receives the user's question text, sends a request to the large model of the third-party back end through the large model sending device (i.e., the large model sending module), receives the returned response message through the large model response processing device (i.e., the large model response processing module), and transmits the response message to the DSL parser to obtain the target code containing the back-end data (i.e., the data to be rendered) and the description of the custom logic, and executes the target code to implement the custom event execution and the custom message rendering execution, and completes the rendering of the response message.

[0117] This embodiment introduces the easy-to-understand DSL to define the chat window, emphasizes the rendering logic of the custom renderer, and the custom event processing logic, develops a custom renderer and a DSL parser, and the combination of the two can realize the customized logic, and realizes that the event response of any DOM element in the message body can be customized to meet the customized events of markdown messages under different businesses. At the same time, if you just want to use the out-of-the-box chat window without using the DSL customization function, then this solution also includes a data processing layer when answering, which is easier for the caller to use than traditional chat devices.

[0118] See also Figure 7 The present application also provides a large model interactive page rendering system, including:

[0119] The first module is used to obtain the front-end page processing rules based on the domain-specific language;

[0120] The second module is used to register the front-end page processing rules into the domain-specific language parser;

[0121] The third module is used to receive a response message from the large model through the large model response processing module;

[0122] The fourth module is used to process the response message through the front-end page processing rules in the domain-specific language parser to obtain the target code;

[0123] The fifth module is used to execute the target code to render the response message on the front-end interactive page.

[0124] It can be understood that the contents of the above-mentioned large model interactive page rendering method embodiment are all applicable to the present system embodiment, the functions specifically implemented by the present system embodiment are the same as those in the above-mentioned large model interactive page rendering method embodiment, and the beneficial effects achieved are also the same as those achieved by the above-mentioned large model interactive page rendering method embodiment.

[0125] The embodiment of the present application also provides an electronic device, the electronic device comprising: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory, and the program is executed by the processor to realize the above-mentioned large model interactive page rendering method. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0126] See also Figure 8 , Figure 8 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0127] The processor 801 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0128] The memory 802 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 802 can store an operating system and other applications. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 802, and the processor 801 calls and executes the large model interactive page rendering method of the embodiment of this application;

[0129] Input / output interface 803, used to implement information input and output;

[0130] The communication interface 804 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WI FI, Bluetooth, etc.);

[0131] A bus 805 that transmits information between the various components of the device (e.g., the processor 801, the memory 802, the input / output interface 803, and the communication interface 804);

[0132] The processor 801 , the memory 802 , the input / output interface 803 and the communication interface 804 are connected to each other in communication within the device via a bus 805 .

[0133] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium used for computer-readable storage. The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned large model interactive page rendering method.

[0134] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0135] The large model interactive page rendering method, device, electronic device and storage medium provided in the embodiment of the present application obtain the front-end page processing rules based on the domain-specific language input by the user, and then register the front-end page processing rules in the domain-specific language parser. When the large model response processing module receives a response message from the large model, the response message is processed by the front-end page processing rules in the domain-specific language parser to obtain the target code, and the target code is executed to render the response message on the front-end interactive page. The embodiment of the present application provides the user with a customized function of front-end page processing rules based on the domain-specific language, registers the user's customized rules in the domain-specific language parser, and when the system receives the response message of the large model, the domain-specific language parser determines the target code for rendering the response message, realizes customized rendering of the response message, and meets the business party's large model front-end interactive display needs.

[0136] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0137] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0138] The system embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0139] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0140] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0141] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0142] In the several embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

[0143] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0144] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0145] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0146] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. A large model interactive page rendering method, characterized in that: The following steps are involved: Get the front-end page processing rules based on domain-specific languages; Registering the front-end page processing rules into a domain specific language parser; Receiving a response message from the big model through the big model response processing module; Processing the response message through the front-end page processing rules in the domain-specific language parser to obtain a target code; Execute the target code to render the response message on the front-end interactive page.

2. The large model interactive page rendering method according to claim 1 is characterized in that: The large model interactive page rendering method also includes the following steps: Obtaining a message rendering configuration, and determining a corresponding text rendering mode according to the message rendering configuration, wherein the text rendering mode is a streaming rendering mode or a one-time rendering mode; The text rendering mode is registered in the large model response processing module, so that the large model response processing module submits the response message to the domain specific language parser according to the text rendering mode.

3. The large model interactive page rendering method according to claim 1 is characterized in that: The method of obtaining the front-end page processing rules based on the domain-specific language includes the following steps: Determine a custom renderer based on the input domain-specific language-based message rendering logic; Configure an execution event of a renderer according to an input event processing logic based on a domain specific language, wherein the renderer is at least one of a custom renderer and a system renderer; A front-end page processing rule is determined according to the custom renderer and the execution event of the renderer.

4. The large model interactive page rendering method according to claim 3 is characterized in that: The large model interactive page rendering method also includes the following steps: Initializing a front-end interactive page according to an initialization rendering rule in the front-end page processing rule, wherein the front-end interactive page includes a question input component; In response to the question event of the question input component, the renderer corresponding to the question event is determined according to the front-end page processing rules to render the question text in the question input component on the front-end interactive page, and send the question text through the large model sending device.

5. The large model interactive page rendering method according to claim 4 is characterized in that: The process of processing the response message by the front-end page processing rule in the domain-specific language parser to obtain the target code comprises the following steps: Determine the dialog component rendering logic corresponding to the response message according to the front-end page processing rule, wherein the dialog component rendering logic includes rendering event logic and message rendering logic; Parsing the response message to obtain data to be rendered; A domain specific language code is determined according to the data to be rendered and the dialog component rendering logic, and the domain specific language code is converted into a target code.

6. The large model interactive page rendering method according to claim 1 is characterized in that: The large model interactive page rendering method also includes the following steps: In response to a log query event of the dialog component, determining a renderer corresponding to the log query event according to the front-end page processing rule; The renderer corresponding to the log query event is executed to render the rendering log of the dialog component on the front-end interactive page.

7. The large model interactive page rendering method according to claim 3 is characterized in that: The execution events include message body interaction events and message body element interaction events.

8. A large model interactive page rendering system, characterized in that: include: The first module is used to obtain the front-end page processing rules based on the domain-specific language; The second module is used to register the front-end page processing rules into the domain specific language parser; The third module is used to receive a response message from the large model through the large model response processing module; The fourth module is used to process the response message through the front-end page processing rules in the domain specific language parser to obtain the target code; The fifth module is used to execute the target code to render the response message on the front-end interactive page.

9. An electronic device, characterized in that: The electronic device includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory. When the program is executed by the processor, the steps of the method described in any one of claims 1 to 7 are realized.

10. A storage medium, the storage medium being a computer-readable storage medium, used for computer-readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any one of claims 1 to 7.

Citation Information

Cited By

  • Rendering method and device of answer content, equipment and medium

    CN120045700A

  • A method, apparatus, device, and medium for rendering answer content

    CN120045700B

  • Content rendering method and device and electronic equipment

    CN120469752A

  • A streaming interaction method, device and storage medium for processing large language model responses

    CN122691466A