Interaction method, device, equipment, medium and program product
By injecting business components and streaming rendering mode into the large-model interactive system, the problem of single functions and limited use of the large-model interactive system is solved, effective interaction with the business system and unified support for multi-business systems is achieved, and users are enhanced Experience and development efficiency.
Patent Information
- Application Number
- CN202411515430.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-10-28
AI Technical Summary
The large model interaction system has a single function and is limited in use, making it difficult to effectively interact with the business system.
By injecting business components, interaction with the business system is realized in the large-model interactive system, and front-end streaming rendering simulation is provided using streaming rendering mode to support unified interaction of multiple business systems.
It realizes easy interaction between large-model interactive systems and business systems, reduces developers' concerns, improves user experience, and supports unified management of multi-business systems.
Smart Images

Figure CN119415654A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an interaction method, device, equipment, medium and program product. Background Art
[0002] In recent years, the development of AI (Artificial Intelligence) is gradually changing the way people live and work. In particular, AIGC (Artificial Intelligence Generated Content) can shine in the advertising creative business. Through simple instructions, advertising content with certain creativity can be generated, which greatly saves manpower and brainpower and significantly improves the efficiency of advertising generation.
[0003] In addition, the demand for AI in the company's internal systems is also growing. For example, product personnel need AI to generate some creative images, creative videos, SQL (Structured Query Language) statements for querying data, etc. For another example, data personnel hope that AI can generate some good-looking charts. For another example, the CRM (Customer Relationship Management) system hopes to have an efficient AI customer service. Through AI customer service, you can easily display invoicing or directly open an account for a customer through a conversation, or in the operation background, you can ask questions through AI to conveniently implement the review of specific advertising ideas without having to go through complicated operations to reach the business component.
[0004] Technically speaking, the core of large model input and output lies in the model or algorithm itself. The design and data of the large model itself determine its intelligence. However, for a system that interacts deeply with users, the front-end interaction implementation is also an important component, especially for a system that needs to be deeply coupled with the business. Summary of the invention
[0005] Multiple aspects of the present application provide an interactive method, device, equipment, medium and program product to solve the technical problem that large model interactive system projects have single functions and limited use.
[0006] One aspect of the present application provides an interaction method, including: generating a question message based on a question operation; inputting the question message into a large model to obtain streaming response data returned by the interface of the large model; converting the streaming response data into a text content type, and using the business components in the large model interaction system for streaming rendering to generate an answer message corresponding to the question message.
[0007] Another aspect of the present application provides an interactive device, including: a generation module, configured to generate a question message based on a question operation; an input module, configured to input the question message into a large model, and obtain streaming response data returned by the interface of the large model; a rendering module, configured to convert the streaming response data into a text content type, and use the business components in the large model interaction system for streaming rendering to generate an answer message corresponding to the question message.
[0008] Another aspect of the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the interaction method as described above.
[0009] In another aspect of the present application, a computer-readable storage medium is provided, on which computer program instructions are stored. The computer program instructions can be executed by a processor to implement the interaction method as described above.
[0010] Another aspect of the present application provides a computer program product, including a computer program, wherein the computer program implements the above-mentioned interaction method when executed by a processor.
[0011] In the solution provided by the embodiment of the present application, by injecting business components, it is easy to realize the interaction with the business system in the large model interaction system, thereby realizing the support of all business systems through a set of systems. Through this system, large model interaction developers do not need to pay attention to the business. And business interaction developers do not need to pay attention to large model interactions. They only need to organize the relationship between model input and business components themselves to complete the rendering of business components on large model interactions. At the same time, the system also provides a better streaming rendering mode, which can provide front-end streaming rendering simulation for model interfaces that do not implement streaming output, providing users with a better experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0013] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0014] Figure 1A processing flow chart of an embodiment of the interactive method provided by the present application;
[0015] Figure 2 A processing flow chart of another embodiment of the interaction method provided by the present application;
[0016] Figure 3 A processing flow chart of another embodiment of the interaction method provided by the present application;
[0017] Figure 4 It is the interaction principle diagram of the large model interaction system coupled with the business;
[0018] Figure 5 A schematic diagram of a page containing business components;
[0019] Figure 6 A schematic diagram of the structure of an embodiment of the interactive device provided by the present application;
[0020] Figure 7 A schematic diagram of the structure of a device suitable for implementing the solution in the embodiment of the present application;
[0021] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0023] In a typical configuration of the present application, the terminal and the equipment of the service network each include one or more processors (CPU), input / output interface, network interface and memory.
[0024] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0025] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer program instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0026] The embodiment of the present application provides an interaction method, which can easily realize the interaction with the business system in the large model interaction system by injecting business components, thereby realizing the support of all business systems through a set of systems. Through this system, large model interaction developers do not need to pay attention to the business. And business interaction developers do not need to pay attention to large model interactions. They only need to organize the relationship between model input and business components themselves to complete the rendering of business components on large model interactions. At the same time, the system also provides a better streaming rendering mode, which can provide front-end streaming rendering simulation for model interfaces that do not implement streaming output, providing users with a better experience.
[0027] In actual scenarios, the execution subject of the above method can be a user device, or a network device, or a device formed by integrating a user device and a network device through a network, or an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablets, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or computer sets based on cloud computing. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing), where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.
[0028] Figure 1 The processing flow 100 of an embodiment of the interaction method provided by the present application is shown, and the method at least includes the following processing steps:
[0029] Step S101: Generate a question message based on the question operation.
[0030] In this embodiment, after the user inputs a question and performs a questioning operation, the execution subject of the interactive method may generate a questioning message.
[0031] The user enters a question in the input box and clicks the question button to submit the question to the above-mentioned execution entity. The above-mentioned execution entity can generate a question message based on the received question. Among them, the question can be a condition or guidance entered by the user to generate the required content based on AIGC. The condition or guidance can include but is not limited to: keywords, descriptions, samples, etc. The content can include but is not limited to: advertisements, images, videos, SQL statements, charts, etc.
[0032] The question message can be a data model at the Message level. The data model in the large model interaction system can be based on questions and answers and divided into four levels from bottom to top: TextContent, Text, Message, and Chat.
[0033] TextContent: TextContent is the smallest granularity of question and answer. The text or image entered by the user when asking a question can be used as a TextContent. In the streaming response of the large model, the text or component description returned in a response can also be converted into a TextContent. When answering a question, the large model may have several or hundreds of streaming interface returns. These returns need to be converted into data of the TextContent type in the large model interaction system first, and then these TextContent type data are input into the callback provided by the large model interaction system. The large model interaction system will then render these TextContent type data in order.
[0034] Text: The data involved in a complete answer of the large model is a Text. A question can also be described as a Text. In simple terms, a Text is a collection of several TextContents. A Text is a complete rendering.
[0035] Message: Since a question may be answered by the user, the text collection corresponding to the answer to a question is called a Message. The page is represented by the rendering of the question text or multiple answer texts, or multiple renderings of the same question answer. Of course, a Message may also contain only one Text.
[0036] Chat: A chat window is often composed of multiple question-and-answer processes. In the large model interaction system, it is called Chat.
[0037] In addition to managing specific Q&A content, the entire large model interaction system sometimes needs to configure multiple Chats. The data model for managing these multiple Chats is History. The basic information of a Chat is called a History. At the data level, Chat focuses on specific chat content, and History focuses on the addition, deletion, modification, and query of these Chats. In addition, a ChatState object is used to manage all data.
[0038] The data model uses Pinia as a state management tool. Pinia|The intuitive store for Vue.js keeps data responsive. Pinia is the state management library officially recommended by Vue. Based on this, the large model interaction system can work well with Vue, using the computed method in Vue to keep the UI (User Interface) responsive when the data changes. At the same time, developers can save data to local storage in real time through configuration to reduce the loading time of data the next time it is accessed. In addition, historical data can also be pulled from remote locations through functions. Among them, Vue is a JavaScript framework for building user interfaces, built on standard HTML (Hyper Text Markup Language), CSS (Cascading Style Sheets) and JavaScript, and provides a set of declarative, componentized programming models to help users develop user interfaces efficiently. Computed is a calculated property of Vue, which is a cached calculation based on dependencies and is updated only when its related dependencies change.
[0039] Step S102: input the question message into the big model, and obtain the streaming response data returned by the interface of the big model.
[0040] In this embodiment, the execution subject may input the question message into the large model and obtain the streaming response data returned by the interface of the large model.
[0041] A large model refers to a machine learning model with large-scale parameters and complex computing structures. These models are usually built from deep neural networks and have billions or even hundreds of billions of parameters. The purpose of designing large models is to improve the expressiveness and predictive capabilities of the models. Due to algorithm or hardware limitations, the generation speed of large models is slow at this stage, and they often output content continuously like a stream of water, that is, streaming response data. The data returned by the interface of the large model each time can be converted into a data model at the TextContent level. The streaming response data corresponding to a complete answer is a data model at the Text level. The streaming response data corresponding to at least one answer to the same question is a data model at the Message level.
[0042] Step S103, converting the streaming response data into a text content type, and performing streaming rendering using the business components in the large model interaction system to generate an answer message corresponding to the question message.
[0043] In this embodiment, the execution entity may convert the streaming response data into a text content type, and use the business components in the large model interaction system to perform streaming rendering to generate an answer message corresponding to the question message.
[0044] Due to algorithm or hardware limitations, the generation speed of large models is slow at this stage, and the content is often continuously output like a stream of water, that is, streaming response data. The data returned by the interface of the large model each time is the latest data of the streaming response data, which can be converted into the TextContent type. The business components in the large model interaction system can perform streaming rendering on the TextContent type data.
[0045] In order to adapt to the output of the big model in web page interaction, the business components in the big model interaction system can be used to render the continuously added TextContent type data based on the existing response data of the big model, that is, streaming rendering. Until the big model responds, the answer message corresponding to the question message is generated, thereby reducing the user's waiting time and improving the user experience. Among them, the answer message can be the answer to the question in the question message, which is a data model at the Message level.
[0046] The large model interactive system refers to a system that displays the output content of the large model on a web page and allows users to interact with it. Most businesses are generally presented to the outside world in the form of a network system, which is a series of different web pages for users. Business components are modules with specific functions on these web pages. In the code, business components can be reflected as a series of code file combinations.
[0047] Through the component injection mechanism, any basic or business component can be injected into the large model interaction system. When responding to questions and answers, you only need to configure the response TextContent to the corresponding type. By coupling the business component with the large model interaction system through injection, the function of calling the business component in the large model interaction system can be achieved.
[0048] There are two ways to inject the developed basic components, business components or any introduced components into the large model interaction system:
[0049] First, the component is injected when the project is initialized. For example, when the project is initialized, it is passed into app.use as an option of initLlmUi.
[0050] Second, the component is injected before rendering starts. For example, before rendering starts, use the llm-ui API to directly inject: registerRenderKey(customRenderKey).
[0051] After injecting the business component into the big model interactive system, you can agree with the big model input interface developer that when you need to render the business component, you can give the front end a certain type tag, or directly output the corresponding TextContent, or the front end can convert it into TextContent first, and then call the callback function of the onAsk event. In this way, the injected business component will appear in the rendering of the answer.
[0052] The embodiment of the present application provides an interaction method, which can easily realize the interaction with the business system in the large model interaction system by injecting business components, thereby realizing the support of all business systems through a set of systems. Through this system, large model interaction developers do not need to pay attention to the business. And business interaction developers do not need to pay attention to large model interactions. They only need to organize the relationship between model input and business components themselves to complete the rendering of business components on large model interactions. At the same time, the system also provides a better streaming rendering mode, which can provide front-end streaming rendering simulation for model interfaces that do not implement streaming output, providing users with a better experience.
[0053] Figure 2 A processing flow 200 of another embodiment of the interaction method provided by the present application is shown, and the method at least includes the following processing steps:
[0054] Step S201: Generate a question message based on the question operation.
[0055] In this embodiment, after the user inputs a question and performs a questioning operation, the execution subject of the interactive method may generate a questioning message.
[0056] The user enters a question in the input box and clicks the question button to submit the question to the above-mentioned execution entity. The above-mentioned execution entity can generate a question message based on the received question. Among them, the question can be a condition or guidance entered by the user to generate the required content based on AIGC. The condition or guidance can include but is not limited to: keywords, descriptions, samples, etc. The content can include but is not limited to: advertisements, images, videos, SQL statements, charts, etc.
[0057] The question message can be a data model at the Message level. The data model in the large model interaction system can be based on questions and answers and divided into four levels from bottom to top: TextContent, Text, Message, and Chat.
[0058] TextContent: TextContent is the smallest granularity of question and answer. The text or image entered by the user when asking a question can be used as a TextContent. In the streaming response of the large model, the text or component description returned in a response can also be converted into a TextContent. When answering a question, the large model may have several or hundreds of streaming interface returns. These returns need to be converted into data of the TextContent type in the large model interaction system first, and then these TextContent type data are input into the callback provided by the large model interaction system. The large model interaction system will then render these TextContent type data in order.
[0059] Text: The data involved in a complete answer of the large model is a Text. A question can also be described as a Text. In simple terms, a Text is a collection of several TextContents. A Text is a complete rendering.
[0060] Message: Since a question may have a user's need for an answer, the text collection corresponding to the answer to a question is called a Message. The page is represented by the rendering of a question text or multiple answer texts, or multiple renderings of the same question answer. Of course, a Message may also contain only one Text.
[0061] Chat: A chat window is often composed of multiple question-and-answer processes. In the large model interaction system, it is called Chat.
[0062] In addition to managing specific Q&A content, the entire large model interaction system sometimes needs to configure multiple Chats. The data model for managing these multiple Chats is History. The basic information of a Chat is called a History. At the data level, Chat focuses on specific chat content, and History focuses on the addition, deletion, modification, and query of these Chats. In addition, a ChatState object is used to manage all data.
[0063] The data model uses Pinia as a state management tool. Pinia|The intuitive store for Vue.js keeps data responsive. Pinia is the state management library officially recommended by Vue. Based on this, the large model interaction system can work well with Vue, using the computed method in Vue. Keep the UI responsive when the data changes. At the same time, developers can save data to local storage in real time through configuration, reducing the loading time of data the next time it is visited. In addition, historical data can also be pulled from remote locations through functions. Among them, Vue is a JavaScript framework for building user interfaces. It is built on standard HTML, CSS, and JavaScript, and provides a declarative, componentized programming model to help users develop user interfaces efficiently. Computed is a calculated property of Vue, which is a cached calculation based on dependencies and is updated only when its related dependencies change.
[0064] Step S202, creating a reply message, and creating text in the reply message.
[0065] In this embodiment, the execution subject may create a reply message and create text in the reply message.
[0066] It should be noted that the answer message and text are empty when they are created. The answer message can be the answer to the question in the question message, and is a data model at the Message level. The text can be the data involved in a complete answer of the large model, and is a data model at the Text level. An answer message can include at least one text.
[0067] Step S203: input the question message into the big model, and obtain the streaming response data returned by the interface of the big model.
[0068] In this embodiment, the execution subject may input the question message into the large model and obtain the streaming response data returned by the interface of the large model.
[0069] A large model refers to a machine learning model with large-scale parameters and complex computing structures. These models are usually built from deep neural networks and have billions or even hundreds of billions of parameters. The purpose of designing large models is to improve the expressiveness and predictive capabilities of the models. Due to algorithm or hardware limitations, the generation speed of large models is slow at this stage, and they often output content continuously like a stream of water, that is, streaming response data. The data returned by the interface of the large model each time can be converted into a data model at the TextContent level. The streaming response data corresponding to a complete answer is a data model at the Text level. The streaming response data corresponding to at least one answer to the same question is a data model at the Message level.
[0070] Step S204, obtaining the latest data from the streaming response data returned by the interface each time, and converting it into a text content type.
[0071] In this embodiment, the execution subject may obtain the latest data from the streaming response data returned by the interface each time, and convert the data into a text content type.
[0072] Due to algorithm or hardware limitations, the generation speed of large models is slow at this stage, and the output content is often continuous like a stream, that is, streaming response data. The data returned by the interface of the large model each time is the latest data of the streaming response data, which can be converted into the TextContent type. Among them, the latest data returned by the interface each time can be converted into a data model at the TextContent level.
[0073] Step S205, passing the latest data of the text content type as a parameter into the callback function, and executing the callback function to obtain processed data.
[0074] In this embodiment, the execution subject may pass the latest data of the text content type as a parameter into the callback function, and execute the callback function to obtain the processed data.
[0075] The callback function can be a callback function callback for processing response data. The large model returns streaming response data through the interface, and the data returned by the interface each time is the latest data of the streaming response data. After the latest data is converted into the TextContent type, it is passed to the callback function callback as a parameter. When the callback function callback is executed, the latest data can be simply processed to obtain the processed data.
[0076] Step S206, adding the processed data to the text.
[0077] In this embodiment, the execution entity may add the processed data to the text.
[0078] Step S207, use the large model stream component to perform streaming rendering on the newly added processed data in the text until the large model responds to the end, and generates an answer message corresponding to the question message.
[0079] In this embodiment, the execution subject can use the large model stream component to perform streaming rendering on the newly added processed data in the text until the large model responds to the end, thereby generating an answer message corresponding to the question message.
[0080] Due to algorithm or hardware limitations, the generation speed of large models is slow at this stage, and the content is often continuously output like a stream of water, that is, streaming response data. The data returned by the interface of the large model each time is the latest data of the streaming response data, which can be converted into the TextContent type. The business components in the large model interaction system can perform streaming rendering on the TextContent type data.
[0081] In order to adapt to the output of the big model in web page interaction, the big model flow component LlmFlow can be used to render the continuously added TextContent type data based on the existing response data of the big model, that is, streaming rendering. Until the big model responds, the answer message corresponding to the question message is generated, thereby reducing the user's waiting time and improving the user experience.
[0082] The large model interactive system refers to a system that displays the output content of the large model on a web page and allows users to interact with it. The large model flow component LlmFlow is a business component. Most businesses are generally presented to the outside world in the form of a network system, which is a different web page for users. Business components are modules with specific functions on these web pages. In the code, business components can be reflected as a series of code file combinations.
[0083] Through the component injection mechanism, any basic or business component can be injected into the large model interaction system. When responding to questions and answers, you only need to configure the response TextContent to the corresponding type. By coupling the business component with the large model interaction system through injection, the function of calling the business component in the large model interaction system can be achieved.
[0084] There are two ways to inject the developed basic components, business components or any introduced components into the large model interaction system:
[0085] First, the component is injected when the project is initialized. For example, when the project is initialized, it is passed into app.use as an option of initLlmUi.
[0086] Second, the component is injected before rendering starts. For example, before rendering starts, use the llm-ui API to directly inject: registerRenderKey(customRenderKey).
[0087] After injecting the business component into the big model interactive system, you can agree with the big model input interface developer that when you need to render the business component, you can give the front end a certain type tag, or directly output the corresponding TextContent, or the front end can convert it into TextContent first, and then call the callback function of the onAsk event. In this way, the injected business component will appear in the rendering of the answer.
[0088] The embodiment of the present application provides an interaction method, which can easily realize the interaction with the business system in the large model interaction system by injecting business components, thereby realizing the support of all business systems through a set of systems. Through this system, large model interaction developers do not need to pay attention to the business. And business interaction developers do not need to pay attention to large model interactions. They only need to organize the relationship between model input and business components themselves to complete the rendering of business components on large model interactions. At the same time, the system also provides a better streaming rendering mode, which can provide front-end streaming rendering simulation for model interfaces that do not implement streaming output, providing users with a better experience.
[0089] Figure 3 A processing flow 300 of another embodiment of the interaction method provided by the present application is shown, and the method at least includes the following processing steps:
[0090] Step S301: Generate a question message based on the question operation.
[0091] In this embodiment, after the user inputs a question and performs a questioning operation, the execution subject of the interactive method may generate a questioning message.
[0092] The user enters a question in the input box and clicks the question button to submit the question to the above-mentioned execution entity. The above-mentioned execution entity can generate a question message based on the received question. Among them, the question can be a condition or guidance entered by the user to generate the required content based on AIGC. The condition or guidance can include but is not limited to: keywords, descriptions, samples, etc. The content can include but is not limited to: advertisements, images, videos, SQL statements, charts, etc.
[0093] The question message can be a data model at the Message level. The data model in the large model interaction system can be based on questions and answers and divided into four levels from bottom to top: TextContent, Text, Message, and Chat.
[0094] TextContent: TextContent is the smallest granularity of question and answer. The text or image entered by the user when asking a question can be used as a TextContent. In the streaming response of the large model, the text or component description returned in a response can also be converted into a TextContent. When answering a question, the large model may have several or hundreds of streaming interface returns. These returns need to be converted into data of the TextContent type in the large model interaction system first, and then these TextContent type data are input into the callback provided by the large model interaction system. The large model interaction system will then render these TextContent type data in order.
[0095] Text: The data involved in a complete answer of the large model is a Text. A question can also be described as a Text. In simple terms, a Text is a collection of several TextContents. A Text is a complete rendering.
[0096] Message: Since a question may have a user's need for an answer, the text collection corresponding to the answer to a question is called a Message. The page is represented by the rendering of a question text or multiple answer texts, or multiple renderings of the same question answer. Of course, a Message may also contain only one Text.
[0097] Chat: A chat window is often composed of multiple question-and-answer processes. In the large model interaction system, it is called Chat.
[0098] In addition to managing specific Q&A content, the entire large model interaction system sometimes needs to configure multiple Chats. The data model for managing these multiple Chats is History. The basic information of a Chat is called a History. At the data level, Chat focuses on specific chat content, and History focuses on the addition, deletion, modification, and query of these Chats. In addition, a ChatState object is used to manage all data.
[0099] The data model uses Pinia as a state management tool. Pinia|The intuitive store for Vue.js keeps data responsive. Pinia is the state management library officially recommended by Vue. Based on this, the large model interaction system can work well with Vue, using the computed method in Vue. Keep the UI responsive when the data changes. At the same time, developers can save data to local storage in real time through configuration, reducing the loading time of data the next time it is visited. In addition, historical data can also be pulled from remote locations through functions. Among them, Vue is a JavaScript framework for building user interfaces. It is built on standard HTML, CSS, and JavaScript, and provides a declarative, componentized programming model to help users develop user interfaces efficiently. Computed is a calculated property of Vue, which is a cached calculation based on dependencies and is updated only when its related dependencies change.
[0100] Step S302, creating a reply message, and creating text in the reply message.
[0101] In this embodiment, the execution subject may create a reply message and create text in the reply message.
[0102] It should be noted that the answer message and text are empty when they are created. The answer message can be the answer to the question in the question message, and is a data model at the Message level. The text can be the data involved in a complete answer of the large model, and is a data model at the Text level. An answer message can include at least one text.
[0103] Step S303, triggering the onAsk event through the chat component.
[0104] In this embodiment, the above-mentioned execution subject can trigger the onAsk event through the chat component.
[0105] While creating the answer message, the chat component Chat can throw an onAsk event. The onAsk event is a commonly used strategy event, which means it is called when the market ask changes. The parameters of the onAsk event can include the question asked by the user and the callback function callback used to process the response data.
[0106] Step S304: input the question message into the big model, and obtain the streaming response data returned by the interface of the big model.
[0107] In this embodiment, the execution subject may input the question message into the large model and obtain the streaming response data returned by the interface of the large model.
[0108] A large model refers to a machine learning model with large-scale parameters and complex computing structures. These models are usually built from deep neural networks and have billions or even hundreds of billions of parameters. The purpose of designing large models is to improve the expressiveness and predictive capabilities of the models. Due to algorithm or hardware limitations, the generation speed of large models is slow at this stage, and they often output content continuously like a stream of water, that is, streaming response data. The data returned by the interface of the large model each time can be converted into a data model at the TextContent level. The streaming response data corresponding to a complete answer is a data model at the Text level. The streaming response data corresponding to at least one answer to the same question is a data model at the Message level.
[0109] Step S305, obtaining the latest data from the streaming response data returned by the interface each time, and converting it into a text content type.
[0110] In this embodiment, the execution subject may obtain the latest data from the streaming response data returned by the interface each time, and convert the data into a text content type.
[0111] Due to algorithm or hardware limitations, the generation speed of large models is slow at this stage, and the output content is often continuous like a stream, that is, streaming response data. The data returned by the interface of the large model each time is the latest data of the streaming response data, which can be converted into the TextContent type. Among them, the latest data returned by the interface each time can be converted into a data model at the TextContent level.
[0112] Step S306, passing the latest data of the text content type as a parameter into the callback function, and executing the callback function to obtain processed data.
[0113] In this embodiment, the execution subject may pass the latest data of the text content type as a parameter into the callback function, and execute the callback function to obtain the processed data.
[0114] The callback function can be the callback function callback in the parameter of the onAsk event, which is used to process the response data. The large model returns the streaming response data through the interface, and the data returned by the interface each time is the latest data of the streaming response data. After the latest data is converted to the TextContent type, it is passed as a parameter to the callback function callback. When the callback function callback is executed, the latest data can be simply processed to obtain the processed data.
[0115] Step S307, adding the processed data to the text.
[0116] In this embodiment, the execution entity may add the processed data to the text.
[0117] Step S308, in response to the large model stream component monitoring the text change, the large model rendering component is used to continuously analyze the newly added processed data in the text and split it into a rendering array.
[0118] In this embodiment, in response to the large model stream component monitoring text changes, the execution subject can use the large model rendering component to continuously analyze the newly added processing data in the text and split it into rendering arrays.
[0119] The large model flow component LlmFlow can monitor text changes through the computed method. When the large model flow component LlmFlow monitors text changes, it can use the processContent of the large model rendering component llmRender to process the newly added processing data in the text. Among them, the large model rendering component llmRender stores the rendering components registered by the application. processContent can continuously analyze the text and split it into rendering arrays of the RenderKey type. Each rendering array can include the rendering method and rendering data to be used. The rendering method can be rendering using the markdown rendering component or rendering using the registered component.
[0120] Step S309, using the rendering method to perform streaming rendering on the rendering data until the large model responds to the end, and generating an answer message corresponding to the question message.
[0121] In this embodiment, the execution subject may perform streaming rendering on the rendering data using a rendering method until the large model responds and generates an answer message corresponding to the question message.
[0122] By default, the markdown rendering component can be used for streaming rendering with a typewriter effect. In addition, in continuous analysis, if the key of the registered component is read, the props of the processed response can be passed to the rendering component. The rendering data in the rendering array of this part can be rendered using the registered component. It should be noted that the onFinish event must be provided in the registered component. Among them, the onFinish event can represent the callback when submitting.
[0123] In some embodiments, the large model flow component LlmFlow can provide a responsive rendering component array renderComponents. The rendering data renderData in the rendering array processed by the large model rendering component llmRender will enter the rendering component array renderComponents in sequence. The rendering component array renderComponents is rendered using a for rendering inside the large model flow component LlmFlow. If the rendering type is the markup language type markdown, the large model hypertext markup language component LlmHtml can be used to render the corresponding rendering data in the rendering component array. After the large model hypertext markup language component LlmHtml is rendered, an onFinish event is thrown internally (custom registered components do not need to throw an onFinish event). After the component throws the onFinish event, it will get the next rendering data renderData from the rendering array and add it to the rendering component array renderCompontents, and render it again. In this way, the content will be rendered in the large model flow component LlmFlow in sequence, achieving the effect of streaming response. After the large model response ends, the isDone parameter can be passed in the callback function callback, and the component and data function execution ends the process.
[0124] Chat component Chat, large model flow component LlmFlow, large model rendering component llmRender, rendering component markdown, registration component, large model hypertext markup language component LlmHtml, etc. can all be injected into the large model interaction system. Through the component injection mechanism, any basic or business component can be injected into the large model interaction system. You only need to configure the response TextContent to the corresponding type when responding to questions and answers. By coupling the business component with the large model interaction system through injection, you can achieve the function of calling the business component in the large model interaction system.
[0125] There are two ways to inject the developed basic components, business components or any introduced components into the large model interaction system:
[0126] First, the component is injected when the project is initialized. For example, when the project is initialized, it is passed into app.use as an option of initLlmUi.
[0127] Second, the component is injected before rendering starts. For example, before rendering starts, use the llm-ui API to directly inject: registerRenderKey(customRenderKey).
[0128] After injecting the business component into the big model interactive system, you can agree with the big model input interface developer that when you need to render the business component, you can give the front end a certain type tag, or directly output the corresponding TextContent, or the front end can convert it into TextContent first, and then call the callback function of the onAsk event. In this way, the injected business component will appear in the rendering of the answer.
[0129] The embodiment of the present application provides an interaction method, which can easily realize the interaction with the business system in the large model interaction system by injecting business components, thereby realizing the support of all business systems through a set of systems. Through this system, large model interaction developers do not need to pay attention to the business. And business interaction developers do not need to pay attention to large model interactions. They only need to organize the relationship between model input and business components themselves to complete the rendering of business components on large model interactions. At the same time, the system also provides a better streaming rendering mode, which can provide front-end streaming rendering simulation for model interfaces that do not implement streaming output, providing users with a better experience.
[0130] Figure 4 The interaction principle diagram of the large model interaction system coupled with the business is shown as follows:
[0131] The first step is to perform type conversion on the large model output data 401 to obtain data 402 of the TextContent type.
[0132] In the second step, the data 402 of the TextContent type is transmitted over the network.
[0133] In the third step, the data 402 of the TextContent type is deconstructed to obtain the business component and data 403.
[0134] Step 4: For the large model interactive system 404 coupled with the business component, the business component and data 403 are rendered on demand by calling back the relevant API (Application Programming Interface) to obtain a page 405 containing the business component (refer to Figure 5 ).
[0135] Among them, several business components can be injected into the large model interaction system using the functions provided by this application.
[0136] Figure 6 A schematic diagram of the structure of an embodiment of the interactive device provided by the present application is shown. Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0137] like Figure 6As shown, the interactive device 600 of this embodiment may include: a generation module 601, an input module 602 and a rendering module 603. The generation module 601 is configured to generate a question message based on the question operation; the input module 602 is configured to input the question message into the big model to obtain the streaming response data returned by the interface of the big model; the rendering module 603 is configured to convert the streaming response data into a text content type, and perform streaming rendering using the business components in the big model interactive system to generate an answer message corresponding to the question message, wherein the business components are injected into the big model interactive system through the injection component mechanism.
[0138] In this embodiment, in the interactive device 600, the specific processing of the generation module 601, the input module 602 and the rendering module 603 and the technical effects thereof can be referred to in Figure 1 The relevant descriptions of steps S101 to S103 in the corresponding embodiment are not repeated here.
[0139] In some optional implementations of the present embodiment, the interactive device 600 also includes: a creation module, configured to create a reply message and create text in the reply message, wherein the content of the reply message and the text is empty when they are created; and a rendering module 603 includes: a conversion submodule, configured to obtain the latest data from the streaming response data returned by the interface each time, and convert it into a text content type; an execution submodule, configured to pass the latest data of the text content type as a parameter to the callback function, and execute the callback function to obtain processed data; a adding submodule, configured to add the processed data to the text; and a rendering submodule, configured to use the large model streaming component to perform streaming rendering on the newly added processed data in the text until the large model response ends.
[0140] In some optional implementations of this embodiment, the interactive device 600 further includes: a trigger module configured to trigger an onAsk event through a chat component, wherein parameters of the onAsk event include a question asked and a callback function.
[0141] In some optional implementations of this embodiment, the rendering sub-module includes: a splitting unit, configured to respond to the large model streaming component monitoring text changes, use the large model rendering component to continuously analyze the newly added processed data in the text, and split it into a rendering array, wherein the rendering array includes a rendering method and rendering data; a first rendering unit, configured to use the rendering method to perform streaming rendering on the rendering data.
[0142] In some optional implementations of this embodiment, the rendering submodule further includes: a second rendering unit configured to render corresponding rendering data using the registered component if a key of the registered component is read during the continuous analysis.
[0143] In some optional implementations of this embodiment, the first rendering unit is further configured to: sequentially add the rendering data to the rendering component array of the large model stream component; and sequentially render the rendering data in the rendering component array.
[0144] In some optional implementations of this embodiment, the first rendering unit is further configured to: if the rendering type is a markup language type, render the corresponding rendering data in the rendering component array using a large model hypertext markup language component.
[0145] In some optional implementations of this embodiment, the business component is injected when the project is initialized or before rendering begins.
[0146] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application, and the method corresponding to the electronic device may be the interactive method in the aforementioned embodiment, and its principle of solving the problem is similar to that of the method. The electronic device provided in an embodiment of the present application includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.
[0147] The electronic device may be a user device, or a device formed by integrating a user device and a network device through a network, or may be an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablet computers, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets, which can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.
[0148] Figure 7The structure of a device suitable for implementing the method and / or technical solution in the embodiment of the present application is shown, and the device 700 includes a central processing unit (CPU, Central Processing Unit) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM, Read Only Memory) 702 or the program loaded from the storage part 708 to the random access memory (RAM, Random Access Memory) 703. In RAM 703, various programs and data required for system operation are also stored. CPU 701, ROM 702 and RAM 703 are connected to each other through a bus 704. An input / output (I / O, Input / Output) interface 705 is also connected to the bus 704.
[0149] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, etc., and a speaker, etc.; a storage section 708 including one or more computer-readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, etc.; and a communication section 709 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet.
[0150] In particular, the methods and / or embodiments in the embodiments of the present application may be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. When the computer program is executed by the central processing unit (CPU) 701, the above functions defined in the method of the present application are executed.
[0151] Another embodiment of the present application further provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the methods and / or technical solutions of any one or more embodiments of the present application described above.
[0152] Specifically, the present embodiment may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device, or device.
[0153] Computer readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than a computer readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0154] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0155] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0156] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0157] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0158] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or page 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0159] The units described 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.
[0160] 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 hardware plus software functional units.
[0161] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
[0163] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in a device claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
Claims
1. An interactive method, comprising: Based on the question operation, generate a question message; Input the question message into the large model, and obtain the streaming response data returned by the interface of the large model; The streaming response data is converted into a text content type, and streaming rendering is performed using a business component in the large model interaction system to generate an answer message corresponding to the question message, wherein the business component is injected into the large model interaction system through an injection component mechanism.
2. The method according to claim 1, wherein: The method further comprises: Creating a reply message, and creating text in the reply message, wherein the reply message and the text are empty when they are created; and The step of converting the streaming response data into a text content type and performing streaming rendering using a business component in a large model interaction system to generate an answer message corresponding to the question message includes: Acquire the latest data from the streaming response data returned by the interface each time, and convert it into the text content type; Passing the latest data of the text content type as a parameter into a callback function, and executing the callback function to obtain processed data; adding the processed data to the text; The large model stream component is used to perform streaming rendering on the newly added processed data in the text until the large model response ends.
3. The method according to claim 2, wherein: The method further comprises: An onAsk event is triggered through a chat component, wherein parameters of the onAsk event include the question asked and the callback function.
4. The method according to claim 2, wherein: The step of using the large model stream component to perform streaming rendering on the newly added processed data in the text includes: In response to the large model stream component monitoring the text change, the large model rendering component is used to continuously analyze the newly added processed data in the text and split it into a rendering array, wherein the rendering array includes a rendering method and rendering data; The rendering method is used to perform streaming rendering on the rendering data.
5. The method according to claim 4, wherein: The method of using the large model stream component to perform streaming rendering on the newly added processed data in the text also includes: If the key of the registered component is read in the continuous analysis, the corresponding rendering data is rendered using the registered component.
6. The method according to claim 5, wherein: The using the rendering method to perform streaming rendering on the rendering data includes: Adding the rendering data sequentially to the rendering component array of the large model stream component; The rendering data in the rendering component array are rendered in sequence.
7. The method according to claim 6, wherein: The rendering data in the rendering component array is rendered sequentially, including: If the rendering type is a markup language type, the corresponding rendering data in the rendering component array is rendered using a large model hypertext markup language component.
8. The method according to any one of claims 1 to 7, wherein: The business components are injected when the project is initialized or before rendering starts.
9. An interactive device, comprising: A generating module is configured to generate a question message based on the question operation; An input module, configured to input the question message into the large model, and obtain streaming response data returned by the interface of the large model; The rendering module is configured to convert the streaming response data into a text content type, and use the business components in the large model interaction system for streaming rendering to generate an answer message corresponding to the question message, wherein the business components are injected into the large model interaction system through an injection component mechanism.
10. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
11. A computer readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
TS processing method friendly to artificial intelligence algorithm and application thereof
CN108712677A
Artificial intelligence auxiliary counter for electric power business hall
CN114495377A
Business data processing method and device and computer equipment
CN117076881A
Real-time video stream multi-AI rendering method and system
CN117640990A
Method for generating statement from natural language to SQL in business scene based on large model
CN117708162A
Cited By
Text generation method, device and system based on intelligent agent
CN121257726A
Large language model streaming response processing method and device, medium, equipment and product
CN121705361A