Message processing method and device, electronic equipment and medium

By receiving and splicing structured format data output from the large model and obtaining associated information for supplementation, the problem of client waiting time is solved, and streaming output of structured format data is achieved and user experience is improved.

CN119807372APending Publication Date: 2025-04-11XINGIN INFORMATION TECH (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411883675.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

When the reply output by the big model is structured format data, such as data in Json format, the user's client needs to wait for the structured data to be fully output before it can be parsed, thus extending the user's waiting time.

Method used

By receiving the first message to be processed, splicing and completing the structured format data, obtaining the associated information and supplementing it into the data, streaming output of the structured format data is realized.

Benefits of technology

It reduces the waiting time of the client, enables users to parse and view structured format data in real time, improves the user experience, and enriches the content of output data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807372A_ABST
    Figure CN119807372A_ABST
Patent Text Reader

Abstract

One or more embodiments of the present specification provide a message processing method and apparatus, an electronic device and a medium, the method comprising: receiving a first message to be processed, the first message comprising a part of characters in first data; the first data is structured format data to be output to a client, and each character in the first data is sequentially output through a plurality of first messages; splicing characters in the received first data through the result queue, and performing completion and restoration of a structured format on the spliced result queue to obtain second data with a complete structured format, the second data comprising at least part of the characters in the first data; if the second data meets the preset processing condition, associated information is obtained based on the second data, the associated information is additional information except the first data, and the associated information is supplemented to the second data; and outputting the supplemented second data to the client.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of artificial intelligence technology, and in particular, to a message processing method, device, electronic device, and medium. Background Art

[0002] With the continuous development of artificial intelligence technology, large models are increasingly widely used in intelligent question-answering systems, which can have intelligent conversations with users, understand their language, and automatically generate relevant responses to their questions, providing users with a better conversation experience. For example, if an intelligent question-answering system is applied to a tourism consultation scenario, the system can understand the user's needs for their tourism consultation questions, and automatically recommend travel itineraries to users or provide users with detailed introductions to tourist destinations and other services.

[0003] However, it is found in practice that when the large model outputs structured data to the user, for example, data in Json format, the user's client usually needs to wait for the structured data to be completely output before parsing it, which prolongs the user's waiting time. Therefore, it is necessary to provide a method to reduce the waiting time when structured data is output and improve the user experience. Summary of the invention

[0004] In view of this, one or more embodiments of the present specification provide a message processing method, apparatus, electronic device, and medium to achieve streaming output of structured format data.

[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:

[0006] According to a first aspect of an embodiment of this specification, a message processing method is provided, the method comprising:

[0007] receiving a first message to be processed, wherein the first message includes some characters in first data; the first data is structured format data to be output to a client, and each character in the first data is output in sequence through a plurality of first messages;

[0008] splicing characters in the received first data through the result queue, and completing and repairing the spliced ​​result queue in a structured format to obtain second data in a complete structured format, wherein the second data includes at least part of the characters in the first data;

[0009] If the second data meets a predetermined processing condition, then obtaining related information based on the second data, the related information being additional information other than the first data, and supplementing the related information to the second data;

[0010] The supplemented second data is output to the client.

[0011] According to a second aspect of an embodiment of this specification, a message processing device is provided, the device comprising:

[0012] A message receiving module, configured to receive a first message to be processed, wherein the first message includes some characters in first data; the first data is structured format data to be output to a client, and each character in the first data is output in sequence through a plurality of first messages;

[0013] A message processing module, configured to concatenate characters in the received first data through a result queue, and complete and repair the concatenated result queue in a structured format to obtain second data in a complete structured format, wherein the second data includes at least part of the characters in the first data;

[0014] a message enrichment module, configured to obtain associated information based on the second data if the second data meets a predetermined processing condition, the associated information being additional information other than the first data, and supplement the associated information to the second data;

[0015] The result output module is used to output the supplemented second data to the client.

[0016] According to a third aspect of the embodiments of this specification, an electronic device is provided, including:

[0017] processor;

[0018] a memory for storing processor-executable instructions;

[0019] The processor implements the method described in any embodiment of this specification by running the executable instructions.

[0020] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the method described in any embodiment of this specification is implemented.

[0021] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method described in any embodiment of this specification is implemented.

[0022] The message processing method, device, electronic device and medium of the embodiments of the present specification not only complete and repair the structured format by splicing the characters in the received first data, and output the second data with a complete structured format in time, so that the client can parse the data in real time, reducing the waiting time of the client; but also enrich the data content of the second data to be output to the client by obtaining related information based on the second data and supplementing it into the second data, so that the user can obtain rich and accurate output data in time, and realize the streaming output of structured format data. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in one or more embodiments of the present disclosure or related technologies, the drawings required for use in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in one or more embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0024] Figure 1 It is a schematic diagram of the architecture of an intelligent question-answering system provided by an exemplary embodiment.

[0025] Figure 2 It is a flowchart of a message processing method provided by an exemplary embodiment.

[0026] Figure 3 is a schematic diagram of a message output provided by an exemplary embodiment;

[0027] Figure 4A It is a schematic diagram of message processing provided by an exemplary embodiment.

[0028] Figure 4B It is a schematic diagram of another message processing provided by an exemplary embodiment.

[0029] Figure 5 It is a schematic diagram of yet another message processing provided by an exemplary embodiment.

[0030] Figure 6 It is a structural diagram of a message processing device provided by an exemplary embodiment.

[0031] Figure 7 is a schematic diagram of an electronic device provided by an exemplary embodiment. DETAILED DESCRIPTION

[0032] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0033] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.

[0034] The intelligent question-and-answer system can understand users' questions and automatically generate responses to users. Compared with manual question-and-answering, it reduces labor and time costs, making the intelligent question-and-answer system more and more widely used in various industries.

[0035] Figure 1 is a schematic diagram of the architecture of an intelligent question-answering system provided by an exemplary embodiment. Figure 1 As shown, the intelligent question answering system can be an agent, called an intelligent question answering agent. The intelligent question answering agent can include a capability agent, Figure 1 Taking the tourism consultation scenario as an example, several capabilities are illustrated (it can be understood that other capabilities may be used in other question-and-answer scenarios), such as "intention recognition capability" 11, "itinerary recommendation capability" 12, "city recommendation capability" 13, "location list recommendation capability" 14, "location details capability" 15 and other capabilities.

[0036] Each capability can be used as an independent functional unit in an intelligent agent, and different capabilities have different functional processing. Each capability can obtain its own output parameters after processing through the big model and certain business logic. Moreover, when receiving input parameters, the capability can obtain the previous dialogue history and search for relevant knowledge based on the user's input sentence, and input them into the big model together, so that the big model can output better answers.

[0037] These capabilities can pass parameters to each other and work together to generate responses to user questions. For example, each capability may have its own upper-level capability, or its own lower-level capability. The upper-level capability will receive the output parameters of the upper-level capability as input parameters, and then obtain its own output parameters after processing through the large model and certain business logic. This output parameter may be the input parameter of the lower-level capability, or it may be the final response returned to the user. That is, each capability included in the Agent is responsible for a functional module in the Agent. Each capability can pass parameters to each other and be connected in series to form a workflow for generating responses. This workflow may use one capability or multiple capability.

[0038] For example, still Figure 1 For example, the intent recognition capability body 11 can identify the user's intent based on the question input by the user, and extract the parameters required by the next capability body and give them to the next capability body. The itinerary recommendation capability body 12 can be used to output itineraries recommended to users based on the user's intent. The city recommendation capability body 13 can be used to generate cities recommended to users, such as recommending users to travel to Suzhou. The place list recommendation capability body 14 can be used to output specific places recommended to users, such as Suzhou's Humble Administrator's Garden. The place details capability body 15 can be used to generate detailed information about places recommended to users, which can be a detailed introduction to the places.

[0039] In current practice, there is sometimes a requirement that when the last capability in a workflow outputs reply information to the user's question to the user's client, the reply information is structured format data.

[0040] The structured format data may be, for example, data in Json format. For example:

[0041] {"card":"journey",

[0042] "name":"Shanghai Bund"}

[0043] Or, it can also be:

[0044] {"card":

[0045] {"title":"Personal Profile",

[0046] "profile":

[0047] {"name":"Zhang San",

[0048] "age":30,

[0049] "gender":"male",

[0050] "occupation":"Software Engineer"}

[0051] }

[0052] }

[0053] As shown above, this JSON-like structured format data can be displayed as a card structure with clear interface logic, order, and easy to understand after being parsed by the user's client.

[0054] However, if the above structured format data is output through a large model, there will be the following problems:

[0055] First, in order to allow users to see the reply information generated by the Agent as quickly as possible, the Agent generally uses a streaming output method. For example, when the capability body outputs structured format data by calling the large model, it can output the content character by character or word by word, and feed it back to the user's client in real time. The user can also view the content output by the large model in real time. For example, if the large model outputs "I recommend you to go to the Lion Grove in Suzhou, which is especially suitable for children to play and has many rockery", then as the large model outputs character by character, the user can also see the output content in real time, which provides a good user experience.

[0056] Secondly, the above-mentioned large model streaming output usually refers to the streaming output of text. For example, for a descriptive text, the large model can output the content word by word, and the user can also see the generated text in real time. However, for structured format data like Json, when streaming output, the result of each streaming output can be a colon, or a curly bracket, or a word, and before the structured format data is completely output, the data format received by the client is incomplete. For example, the client receives an incomplete Json structure of "{"card":"jou"", which cannot be parsed and rendered by the client at all. If you wait for the structured data to be fully output and then parse it, the user will still have to wait a long time to see it, which loses the meaning of the large model streaming output.

[0057] Based on the above, the embodiments of this specification provide a message processing method, the purpose of which is to speed up the display efficiency of the client and realize the streaming output of the structured format data when a large model outputs structured format data.

[0058] Figure 2 is a flowchart of a message processing method provided by an exemplary embodiment, such as Figure 2 As shown, the method may include the following processing:

[0059] In step 200, a first message to be processed is received, and partial characters in first data are included in the first message; the first data is structured format data to be output to a client, and each character in the first data is output sequentially through a plurality of first messages.

[0060] For example, the first message may be a message output by a large model. Among them, the large model may be a model in an ability body. For example, a large model included in the last ability body in the intelligent question and answer workflow in an Agent.

[0061] The first message can be understood through Figure 3 the example shown below:

[0062] For example, please refer to Figure 3 as shown. Assume that the structured format data to be output by the large model is: the json structure {"card":"journey","name":"The Bund"...........}, where the ellipsis indicates that there are other characters after "The Bund" in this Json structure, and the rest are not listed one by one.

[0063] Based on the above Figure 3 as an example, the concepts involved in this step are explained as follows:

[0064] 1) First data:

[0065] The first data may be structured format data to be output to a client. For example, the first data may be output by the above-mentioned large model. For example, the above Json structure data {"card":"journey","name":"The Bund"...........} can be called the first data.

[0066] 2) Reply character:

[0067] As mentioned above, the Json structure includes multiple reply characters. For example, {, ", c, a, r, d.....", etc. Each character can be called a "reply character". Figure 3 Only the reply characters "" and "c" are marked as examples. It can be understood that other output characters are also reply characters. In addition, it can be understood that Figure 3 the way of outputting single characters one by one is also an example, and other output methods can also be adopted.

[0068] 3) First message:

[0069] Each character in the above first data can be output sequentially through a plurality of first messages.

[0070] For example, Figure 3The "first message", "second message",..., "x + 1th message", etc. shown in can each be referred to as a "first message". Moreover, each first message output by the large model can include a part of the reply characters, that is, each first message can include some characters in the first data. For example, the first message output by the large model includes the reply character "{", the second message output by the large model includes the reply character "", the third message output by the large model includes the reply character "c", and so on. The large model outputs multiple reply characters included in the first data by sequentially outputting multiple first messages.

[0071] 4) Message group:

[0072] Figure 3 The multiple first messages output by the large model for the first data described in form a message group. For example, for the first data {"card":"journey","name":"The Bund"...........}, to achieve the streaming output of each reply character in the first data, the large model may output x + M first messages, where both x and M are natural numbers. Then the whole of the x + M first messages constitutes a message group. Any message in this message group can be referred to as a first message.

[0073] The execution subject of the method in this embodiment can be a message processing device, and this message processing device can be a logic module responsible for processing the first message. Exemplarily, please refer to Figure 4A shown. This message processing device can be a logic module added to the capability body. For the first message output by the capability body calling the large model, it can be processed by the message processing device and then output to the client.

[0074] In this step, the message processing device can receive any first message output by the large model.

[0075] In step 202, through the result queue, the characters in the first data that have been received are concatenated, and the concatenated result queue is complemented and repaired in a structured format to obtain the second data with a complete structured format, and the second data includes at least some characters in the first data.

[0076] Please refer to Figure 4B shown. After receiving the first message, the message processing device can concatenate each reply character in the first data that has been received. It can be understood that the characters in the first data that have been received here can be received multiple times through multiple first messages.

[0077] For example, taking Figure 4BTake one of the first messages in it (the message referred to as "example"). The reply character output by this first message is "r". Although this first message includes a reply character "r", before this, the message processing device has received multiple first messages, and all the reply characters before "r" have been received. Therefore, the message processing device can splice the reply character received this time and each of the previously received reply characters together through the result queue, thereby obtaining {"card":"jour.

[0078] After splicing, the message processing device can also complete and repair the received reply characters in the result queue in a structured format to obtain the second data with a complete structured format.

[0079] For example, please continue to refer to Figure 4B , taking the structured format as Json format as an example, the string {"card":"jour" spliced by each of the received reply characters in the result queue 41 is still not a string with a complete Json format. Therefore, it can be completed and repaired, that is, after adding the characters "" and "}", the second data {"card":"jour"} is obtained. Obviously, this second data 42 is already a data with a complete Json format.

[0080] For each first message output by the large model, the message processing device can splice and complete and repair it in the above manner to obtain the second data with a complete structured format. It can be understood that although it can be completed and repaired, before the complete first data is output, the reply characters included in the completed second data are still at least part of the reply characters in the first data. For example, the characters included in the second data {"card":"jour"} are incomplete and only part of the characters in the first data {"card":"journey","name":"The Bund"...........} are output.

[0081] Of course, if the first message is the last message when outputting the first data, then the second data obtained by the message processing device can include all the reply characters in the first data, that is, {"card":"journey","name":"The Bund"...........}.

[0082] In step 204, if the second data meets the predetermined processing condition, the associated information is obtained based on the second data. The associated information is additional information outside the first data, and the associated information is supplemented to the second data.

[0083] In this step, it is possible to detect whether the second data obtained after completion and repair meets a predetermined processing condition. For example, the predetermined processing condition may be that the second data includes a predetermined field. If the predetermined field is included in the second data, additional associated information can be obtained based on the field value of the predetermined field and supplemented to the second data.

[0084] For example: for the first data {"card":"journey","name":"The Bund"...........}, during the process of the large model outputting the first data, for each second data obtained by repair, if the second data includes the predetermined field "name", additional information can be searched and obtained according to this field "name" and supplemented to the second data to enrich the data content in the Json structure format, and then the second data is output to the client.

[0085] Specifically, it can be combined with Figure 5 as shown in the schematic diagram. As Figure 5 shown, after the message processing device obtains the second data through character splicing and completion and repair, it can detect whether there is a predetermined field "name" in the second data. If the predetermined field "name" does not exist in the second data, or the predetermined field "name" exists in the second data but the corresponding field value (the field value is also the specific name corresponding to name) has not been obtained, it can continue to wait until the field value of the predetermined field is obtained.

[0086] For example, Figure 5 in the second data 51, the name field does not exist, so it can continue to wait for the output of the large model. When it is detected that the predetermined field "name" already exists in the second data 52, it can continue to wait for the specific field value of "name" output by the large model. When it is detected that the field value "The Bund" has been output in the second data 53, associated information can be obtained based on this field value "The Bund", and this associated information is additional information outside the first data. That is to say, the searched associated information does not exist in the first data output by the large model and belongs to the rich content obtained by additional search. Exemplarily, the associated information may be the location details corresponding to "The Bund", such as information including but not limited to pictures of The Bund, latitude and longitude of The Bund, etc.

[0087] The obtained associated information can be supplemented to the second data. For example, the original second data {"card":"journey","name":"The Bund"}, after supplementing the associated information, it can be {"card":"journey","name":"The Bund",picture:”***”,latitude:”***”,longitude:”***”}. It can be seen that the content of the second data is more enriched.

[0088] Furthermore, more abundant contents may be added in actual implementation. For example, multiple predetermined fields may be set, and corresponding associated information may be searched and obtained according to each predetermined field and added to the second data.

[0089] For example, in addition to the above-mentioned predetermined field "name", another predetermined field F1 may be included. Then, in Figure 5 In the illustrated example, the message processing device may detect that the second data includes both the predetermined field "name" and the predetermined field F1, and search for associated information based on the two fields respectively, add the associated information to the second data, and then output the second data to the client. Alternatively, the rich data obtained based on the predetermined field "name" and F1 may be output separately. For example, Figure 5 After searching and supplementing the related information according to the predetermined field "name", the second data is output, and then the first message output by the large model is continued to be received, and whether the predetermined field F1 exists in the second data obtained after processing the first message is continued to be detected. When F1 exists, the related information is searched according to F1 and supplemented to the second data before output.

[0090] In step 206, the supplemented second data is output to the client.

[0091] In this step, the message processing device may output the completed second data to the client.

[0092] Since the second data already has a complete structured format, for example, the second data {"card":"jour"} already has a complete Json format structure, the client can parse it.

[0093] Based on this, after receiving the first message, the message processing device can perform the above-mentioned character splicing and format completion and repair processing, and then output the second data with a complete structured format to the client. The client can parse the second data in the structured format in real time, and the user can also see the second data displayed by the client, that is, after the large model outputs the first message, it can complete and enrich the first message, and then output the obtained second data, thereby realizing the streaming output of Json data. For example, from the client side, the user can see that the output content in this Json card is constantly increasing, thereby realizing that as the large model streams the first data, the user can also see the streaming output content in real time.

[0094] The message processing method of this embodiment completes and repairs the reply characters in the first message by concatenating and formatting them, obtains related information based on the completed second data, uses the related information to supplement the second data, and then outputs it to the client, so that the client can parse the second data with a complete structured format, thereby realizing the streaming output of structured format data, and the content of the second data is also enriched.

[0095] In addition, the message processing device enriches the structured format data and then outputs it. This method can also have the following advantages:

[0096] 1) Improves the output efficiency of structured format data and reduces client waiting time.

[0097] For example, after the message processing device obtains related information based on the field "name" and adds the related information to the second data, it can output the second data to the client. Since the format of the second data is a complete structured format, such as complete Json format data, the client can parse and display it in real time, thereby significantly improving the data output efficiency compared to waiting for the first data to be output before parsing.

[0098] 2) Enriched the content of structured format.

[0099] For example, the original second data includes the name field value "Waitan", and the second data after supplementing the associated information also adds some additional location details of "Waitan", such as pictures of Waitan, longitude and latitude, etc. This makes the content of the second data output to the user richer, and the user can obtain richer data content.

[0100] 3) Improved the accuracy of structured format output content.

[0101] For example, if the first message is output by a large model, in this case, some data may be inaccurate if it is output by the large model. In this case, these data can no longer be output based on the large model, but only some predetermined fields can be obtained through the large model, and the message processing device can search and obtain more accurate data content based on the predetermined fields. For example, the pictures, longitude and latitude and other information in the location details mentioned in the above example can be output by the large model. The name of the location "The Bund", after obtaining the location name, the message processing device can search and obtain accurate location details based on the location name, and add it to the second data, so that users can see more accurate structured format data.

[0102] In another embodiment, the message processing device may also be: after obtaining the second data with a complete structured format and before the second data reaches the predetermined processing condition, it may first determine whether the second data meets the message output condition. If the message output condition is met, the second data may be output to the client; otherwise, it may continue to wait until the message output condition is met for output. That is to say, on the one hand, as Figure 5 shown in the example, each first message may correspond to a second data obtained after complementing and repairing. Even if a certain second data does not reach the predetermined processing condition and there is no need to obtain associated information, as long as the second data meets the message output condition, the second data may be output to the client. On the other hand, in the case of obtaining associated information based on the second data mentioned in the above example, "the second data is supplemented with associated information" may also be used as a message output condition, that is, if the second data has been supplemented with associated information, the second data may be output.

[0103] This embodiment does not limit the "message output condition", which may be a variety of conditions set independently. The following are several example conditions, but it should be understood that the following are only examples and are not limited thereto in actual implementation.

[0104] Example message output condition 1: The second data includes a predetermined character.

[0105] For example, it can be set that if the reply characters included in the second data form a complete word, it is acceptable. For instance, if the second data includes the complete character "journey", it can be output; or, for another example, if the second data includes the complete "name", it can be output. In this case, the message processing device can detect the integrity of the characters. If the integrity is met, it can be considered that the second data includes the predetermined character.

[0106] For another example, it can also be a specified specific word. For example, if the second data includes "journey", it can be output, and then this "journey" can be considered as the predetermined character.

[0107] Example message output condition 2: The second data includes complete field content.

[0108] For example, in a data in Json structure, it may include multiple fields. For example, taking {"name":"张三"; "age":30; "gender":"男"; "occupation":"软件工程师"} as an example, it includes name field, age field, gender field and occupation field.

[0109] For each field, when the large model outputs the complete content of the field, it can be output. For example, if the large model outputs "age" but has not yet output the specific value "30" of the field "age", it can be temporarily not output until the large model outputs the specific value "30" of the field "age" before outputting.

[0110] Example message output condition three: satisfying a predetermined interval condition.

[0111] For example, you can set it to output once every time the large model outputs 5 characters, or, for example, output once every time the large model outputs the contents of two fields, and so on.

[0112] Take a scenario as an example: Please refer to Figure 5 As shown, the second data 51 has not yet met the predetermined processing condition, and has not yet met the message output condition (for example, the condition may be to include a complete character, jour is not complete), then the second data 51 is not output to the client for the time being. For the second data 52, it has not yet met the predetermined processing condition but has met the message output condition, and can be output to the client. For the third data 53, the predetermined processing condition has been met, then the associated information is obtained according to the predetermined field, the associated information is supplemented to the second data, and the message output condition is also met, then the supplemented second data can be output to the client.

[0113] The following takes the intelligent question and answer in the tourism scenario as an example to describe an example of intelligent question and answer by the method of the embodiment of this specification. The intelligent question and answer is implemented by an intelligent question and answer agent, and the agent of the intelligent question and answer is responsible for receiving questions from the client and outputting replies to the client, and the agent may include multiple capability bodies.

[0114] For example, the intent recognition capability in the Agent receives a question from a user who wants to travel to Shanghai and asks the Agent to recommend a Shanghai travel itinerary. The intent recognition capability recognizes the user's intent, extracts input parameters such as "travel", "itinerary", and "Shanghai", and gives them to the "itinerary recommendation capability". The "itinerary recommendation capability" searches for some knowledge based on the input parameters, and inputs the input parameters and knowledge into the big model. The big model outputs a json structure of {"card":"journey","name":"The Bund"...} for streaming output.

[0115] Next, the message processing device according to the embodiments of this specification can receive the messages output by the large model, and perform processing such as character splicing and Json completion and repair according to the message processing method of the foregoing embodiments to obtain the second data. It can also detect whether there is a predetermined field "name" in the second data. After the large model outputs the field value "The Bund" of the field "name", the message processing device searches for and obtains the location details of the Bund and supplements them to the second data, and outputs the second data to the client. The client parses and renders the second data.

[0116] If there is other content after "The Bund" in the json structure {"card":"journey","name":"The Bund"………} output by the large model, the message processing device can continue to receive each first message output by the large model and process and output it in the above manner. For example, the message can be output to the client after completion and repair, or if it is necessary to enrich the content according to other predetermined fields, it can continue to detect whether the second data contains the predetermined fields, and supplement the content according to the predetermined fields and then output it to the client.

[0117] Figure 6 It is a schematic structural diagram of a message processing device provided by an exemplary embodiment. This device can be applied to implement the message processing method described in any embodiment of this specification. As Figure 6 shown, the device may include: a message receiving module 61, a message processing module 62, a message enriching module 63, and a result output module 64.

[0118] The message receiving module 61 is configured to receive a first message to be processed, where the first message includes some characters in the first data; the first data is structured format data to be output to the client, and each character in the first data is sequentially output through a plurality of first messages.

[0119] The message processing module 62 is configured to splice the characters in the received first data through a result queue, and perform completion and repair of the structured format on the spliced result queue to obtain second data with a complete structured format, where the second data includes at least some characters in the first data.

[0120] The message enriching module 63 is configured to, if the second data meets a predetermined processing condition, obtain associated information based on the second data, where the associated information is additional information outside the first data, and supplement the associated information to the second data.

[0121] The result output module 64 is configured to output the supplemented second data to the client.

[0122] In one example, the message enrichment module 63, when used to obtain related information based on the second data if the second data meets a predetermined processing condition, includes: if the second data includes a predetermined field, obtaining related information based on the field value of the predetermined field.

[0123] In one example, the message enrichment module 63 is further used to: if the predetermined field does not exist in the second data, or the predetermined field exists in the second data but the corresponding field value has not been obtained, continue to wait for the field value of the predetermined field.

[0124] In one example, the result output module 64 is further configured to output the second data to the client if it is determined that the second data meets the message output condition before the second data meets the predetermined processing condition.

[0125] In one example, the message output condition includes: the second data includes predetermined characters.

[0126] In one example, the message receiving module 61, when used to receive a first message to be processed, includes: receiving a first message output by a capability body, wherein the capability body is one of the capability bodies included in an intelligent question and answer agent, and the intelligent question and answer agent is used to receive questions from a client and output a reply to the client.

[0127] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

[0128] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0129] like Figure 7 As shown, Figure 7 A hardware structure diagram of an electronic device in which the navigation broadcast device of an embodiment of the specification is located is shown, and the device may include: a processor 710, a memory 720, an input / output interface 730, a communication interface 740, and a bus 750. The processor 710, the memory 720, the input / output interface 730, and the communication interface 740 are connected to each other in communication within the device through the bus 750.

[0130] The processor 710 can 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 this specification. The processor implements the above method by running executable instructions.

[0131] The memory 720 for storing processor executable instructions can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 720 can store operating systems and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 720.

[0132] The input / output interface 730 is used to connect the input / output module to realize information input and output. The input / output module can be configured as a component in the device (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0133] The communication interface 740 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0134] The bus 750 comprises a pathway that transmits information between the various components of the device (eg, the processor 710 , the memory 720 , the input / output interface 730 , and the communication interface 740 ).

[0135] It should be noted that, although the above device only shows the processor 710, the memory 720, the input / output interface 730, the communication interface 740 and the bus 750, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.

[0136] The embodiments of the present specification also provide a computer-readable storage medium on which a computer program is stored, and the program implements the above method when executed by a processor.

[0137] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules 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, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic 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. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0138] The embodiments of the present specification also provide a computer program, which is used to implement the method described in any embodiment of the present specification when executed.

[0139] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0140] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0141] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0142] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.

Claims

1. A message processing method, characterized in that: The method comprises: receiving a first message to be processed, wherein the first message includes some characters in first data; the first data is structured format data to be output to a client, and each character in the first data is output in sequence through a plurality of first messages; splicing characters in the received first data through the result queue, and completing and repairing the spliced ​​result queue in a structured format to obtain second data in a complete structured format, wherein the second data includes at least part of the characters in the first data; If the second data meets a predetermined processing condition, then obtaining related information based on the second data, the related information being additional information other than the first data, and supplementing the related information to the second data; The supplemented second data is output to the client.

2. The method according to claim 1, characterized in that If the second data meets a predetermined processing condition, obtaining associated information based on the second data includes: If the second data includes a predetermined field, the associated information is acquired based on the field value of the predetermined field.

3. The method according to claim 1, characterized in that After obtaining the second data in a complete structured format and before acquiring the associated information based on the second data, the method further includes: If the predetermined field does not exist in the second data, or if the predetermined field exists in the second data but the corresponding field value has not been obtained, continue to wait for the field value of the predetermined field.

4. The method according to claim 1, characterized in that: The method further comprises: Before the second data reaches a predetermined processing condition, if it is determined that the second data reaches a message output condition, the second data is output to a client.

5. The method according to claim 4, characterized in that The message output condition includes: the second data includes a predetermined character.

6. The method according to claim 1, characterized in that The receiving a first message to be processed comprises: A first message output by a receiving capability body is outputted, where the capability body is one of the capability bodies included in the intelligent question-and-answer agent, and the intelligent question-and-answer agent is used to receive questions from a client and output a reply to the client.

7. A message processing device, characterized in that: The device comprises: A message receiving module, configured to receive a first message to be processed, wherein the first message includes some characters in first data; the first data is structured format data to be output to a client, and each character in the first data is output in sequence through a plurality of first messages; A message processing module, configured to concatenate characters in the received first data through a result queue, and complete and repair the concatenated result queue in a structured format to obtain second data in a complete structured format, wherein the second data includes at least part of the characters in the first data; a message enrichment module, configured to obtain associated information based on the second data if the second data meets a predetermined processing condition, the associated information being additional information other than the first data, and supplement the associated information to the second data; The result output module is used to output the supplemented second data to the client.

8. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 6 by running the executable instructions.

9. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.