Message response method and device, computer equipment and storage medium
The client uses POST request to send a large data volume message to the server, and uses the unique identification information of the SSE connection to obtain the reply information, which solves the problem of data volume limit in the SSE protocol and realizes efficient transmission of large data volume messages.
Patent Information
- Application Number
- CN202410998746.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-11-26
AI Technical Summary
In the prior art, when the SSE protocol transmits data to the server through GET request, the message size is limited, making it difficult to transmit messages with large data volumes, resulting in large limits in the data volume.
The client sends a question message to the server through a POST request. The server stores the message and generates unique identification information to establish an SSE connection. The client sends unique identification information through an SSE connection to obtain the message. The server obtains the reply information based on the unique identification information and returns it to the client. .
It realizes the transmission of question messages that support the large amount of data. Through the identity identification of unique identification information, the data volume limit in the SSE connection is avoided and data transmission efficiency is improved.
Smart Images

Figure CN119030847A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a message response method, device, computer equipment and storage medium. Background Art
[0002] In the prior art, the question-and-answer interaction between the client and the server uses SSE (Server-Sent Events) as a communication protocol, which allows the server to push data to the client in real time.
[0003] Although SSE supports clients to use GET requests to establish connections and send data to the server, the message size is usually limited, making it difficult to transmit messages with large amounts of data, which greatly limits the amount of data that can be asked by clients. Summary of the invention
[0005] The embodiments of the present application provide a message response method, apparatus, computer device and storage medium to solve the problem that although SSE supports the client to use GET request to establish a connection and send data to the server, the message size is usually limited, making it difficult to transmit messages with large amounts of data, thereby making the data size of the questions raised by the client subject to large restrictions.
[0006] In a first aspect, an embodiment of the present application provides a message response method, including:
[0007] Receiving a target POST request sent by a client to the server, wherein the target POST request includes a question message from the client;
[0008] storing the question message, generating unique identification information of the question message, and sending the unique identification information to the client;
[0009] Establishing an SSE connection with the client;
[0010] Receiving unique identification information sent by the client through the SSE connection, and acquiring the question message based on the unique identification information;
[0011] Acquire response information corresponding to the question message, and send the response information to the client based on the SSE connection.
[0012] A further technical solution is that the receiving the unique identification information sent by the client through the SSE connection includes:
[0013] Receiving a target GET request sent by the client through the SSE connection, wherein the target GET request encapsulates the unique identification information;
[0014] The target GET request is parsed to obtain the unique identification information.
[0015] A further technical solution is that the storing of the question message comprises:
[0016] Establishing a mapping relationship between the question message and the unique identification information of the question message;
[0017] The question message and the mapping relationship are stored in a preset storage medium.
[0018] A further technical solution is that obtaining the question message based on the unique identification information includes:
[0019] Acquire the mapping relationship;
[0020] Based on the mapping relationship and the unique identification information, the question message is searched and extracted from the storage carrier.
[0021] A further technical solution is that the step of obtaining the response information corresponding to the question message includes:
[0022] Determine whether answer information corresponding to the unique identification information is stored in a preset answer database;
[0023] If answer information corresponding to the unique identification information is stored in the answer database, the answer information corresponding to the unique identification information is used as the response information corresponding to the question message;
[0024] If the answer information corresponding to the unique identification information is not stored in the answer database, response information corresponding to the question message is obtained through a preset language processing model.
[0025] A further technical solution is that after obtaining the response information corresponding to the question message through a preset language processing model, the method further includes:
[0026] The unique identification information and the response information corresponding to the question message are stored in the answer database accordingly.
[0027] In a second aspect, an embodiment of the present application provides another message response method, including:
[0028] Sending a target POST request to the server, wherein the target POST request includes a question message from the client;
[0029] Receiving unique identification information of the question message returned by the server based on the target POST request;
[0030] Establishing an SSE connection with the server;
[0031] Sending the unique identification information to the server via the SSE connection;
[0032] Receive response information returned by the server through the SSE connection, wherein the response information is obtained by the server based on the question message.
[0033] A further technical solution is that sending the unique identification information to the server through the SSE connection includes:
[0034] Encapsulate the unique identification information in the body of a GET request to obtain a target GET request;
[0035] The targeted GET request is sent to the server via the SSE connection.
[0036] In a third aspect, an embodiment of the present application provides a message response device, which includes a unit for executing the above method.
[0037] In a fourth aspect, an embodiment of the present application further provides a computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the steps of any message response method provided in any embodiment of the present application.
[0038] In a fifth aspect, an embodiment of the present application further provides a storage medium, wherein the storage medium stores a plurality of instructions, wherein the instructions are suitable for loading by a processor to execute the steps in any message response method provided in any embodiment of the present application.
[0039] The message response method proposed in the embodiment of the present application aims at the problem that the amount of data transmitted from the client to the server through the GET request in the SSE connection is greatly limited and does not support the transmission of large amounts of question messages. First, the client sends the question message to the server through a POST request, and the POST request can support the transmission of large amounts of data; the server stores the question message, generates unique identification information for the question message, and sends the unique identification information to the client; the server establishes an SSE connection with the client; the client sends the unique identification information to the server through the SSE connection; the server obtains the question message based on the unique identification information; obtains the response information corresponding to the question message, and sends the response information to the client based on the SSE connection. Since the unique identification information is only an identity identifier of the question message and its data volume is very small, the client can quickly send the unique identification information to the server through the SSE connection, thereby realizing the support of question messages with large amounts of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0042] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0043] Figure 1 is a flowchart of a message response method provided in an embodiment of the present application;
[0044] Figure 2 It is a flowchart of a sub-process of the message response method provided in an embodiment of the present application;
[0045] Figure 3 is another flow chart of the message response method provided in an embodiment of the present application;
[0046] Figure 4 is a schematic block diagram of a message response device provided in an embodiment of the present application;
[0047] Figure 5 is a schematic block diagram of a message response device provided in another embodiment of the present application;
[0048] Figure 6 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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.
[0050] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0051] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0052] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0053] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0054] In order to solve the problem in the prior art that although SSE supports the client to use GET request to establish a connection and send data to the server, the message size is usually limited, making it difficult to transmit messages with large amounts of data, thereby making the data size of the questions raised by the client have a large limitation, the present application provides a message answering method, which can support question messages with large amounts of data.
[0055] Figure 1 A flow chart of a message response method provided in an embodiment of the present application, the method is applied to a server, see Figure 1 , the message response method comprises the following steps:
[0056] S101, receiving a target POST request sent by a client to the server, wherein the target POST request includes a question message from the client.
[0057] In a specific implementation, a user can send a question message to a server through a client, and the question message is included in a target POST request. The question message may include text content, voice content, image content, etc. For example, a user sends a chat message to a server through a client, and the chat message may include text, voice, image, video, etc. A POST request can support the transmission of a large amount of question messages to a server.
[0058] Among them, the target POST request refers to a POST request that carries the client's question message. In the embodiment of the present application, the target POST request is generated by the client encapsulating the question message to be sent to the server in the body of the POST request. The POST request refers to a request method for interaction between the client and the server defined by Http.
[0059] The question message refers to the information input by the user to the client, such as the user's text information, voice information, image information, etc., which is not specifically limited in this application.
[0060] S102: Store the question message, generate unique identification information of the question message, and send the unique identification information to the client.
[0061] In a specific implementation, the question message can be stored in a database, which refers to a collection of organized and sharable data stored in a computer for a long time. The data in the database is organized, described and stored according to a certain mathematical model, has less redundancy, higher data independence and easy scalability, and can be shared by various users.
[0062] The unique identification information refers to the unique identification id (IDentity) of the question message, which can be used to identify the identity of the question message. For the question message, in the same system, its unique identification id is constant and unique, and the unique identification ids of different question messages are different. The unique identification id can be generated by a unique identifier algorithm, which is not specifically limited in this application.
[0063] In one embodiment, the above step of "storing the question message" includes the following steps: establishing a mapping relationship between the question message and the unique identification information of the question message; and storing the question message and the mapping relationship in a preset storage medium.
[0064] In a specific implementation, after obtaining the unique identification information of the question message, a mapping relationship between the question message and the unique identification information of the question message is established. The mapping relationship can be specifically a mapping relationship table. Through the mapping relationship, the corresponding question message can be quickly found based on the unique identification information, which facilitates the rapid search of the question message and improves the search efficiency of the question message. Further, the question message and the mapping relationship are stored in a preset storage medium, which can be, for example, a database.
[0065] S103: Establish an SSE connection with the client.
[0066] Among them, SSE connection refers to the connection established between the client and the server by calling the native Server-Sent Events, which allows the server to push data to the client. SSE connection includes SSE short connection and SSE long connection.
[0067] Among them, SSE long connection refers to the long connection formed between the client and the server. This long connection will only be disconnected when the client or server actively closes the connection. Otherwise, it is like a channel that is always connected, so that data can be continuously transmitted.
[0068] In the embodiment of the present application, the SSE short connection is: connection-transmission-connection closing. For example, HTTP is a stateless short connection. Each time the browser and the server perform an HTTP operation, a connection is established, but the connection is terminated when the task is completed. Because the connection is disconnected after receiving data, there is no connection between each data reception and processing.
[0069] SSE long connection is: connect - transfer data - maintain connection - transfer data - ... - until one party closes the connection. After the long connection is established, the connection will be maintained regardless of whether it is used or not.
[0070] In the embodiment of the present application, the SSE connection established between the client and the server may be specifically an SSE persistent connection. Specifically, the client initiates an SSE persistent connection request to the server, and the server responds to the SSE persistent connection request to establish an SSE persistent connection between the server and the client.
[0071] S104: Receive unique identification information sent by the client through the SSE connection, and obtain the question message based on the unique identification information.
[0072] In a specific implementation, after the client establishes an SSE long connection with the server, the client sends the unique identification information previously received to the server so that the server can obtain the previously stored question message based on the unique identification information. For example, if the question message was previously stored in a database, the previously stored question message can be found from the database based on the unique identification information.
[0073] Specifically, the client encapsulates the unique identification information in the body of the GET request to obtain the target GET request. Since the unique identification information is only an identity identifier of the question message, its data volume is very small, so it does not exceed the data volume limit of the GET request. Afterwards, the client sends the target GET request to the server.
[0074] In one embodiment, the above step of "obtaining the question message based on the unique identification information" includes: obtaining the mapping relationship; and searching and extracting the question message from the storage medium based on the mapping relationship.
[0075] Specifically, in order to quickly locate and find the question message, a mapping relationship between the unique identification information and the question message is established, for example, the mapping relationship is a mapping table. The mapping table records the unique identification information and the storage location information of the corresponding question message, and the storage location information of the corresponding question message can be determined by the unique identification information, so that the question message can be searched and extracted from the storage carrier based on the storage location of the question message. The storage carrier can be specifically a database.
[0076] S105: Acquire response information corresponding to the question message, and send the response information to the client based on the SSE connection.
[0077] In a specific implementation, after obtaining the question message, the corresponding response information of the question message is obtained, and then the response information is sent to the client based on the SSE long connection established between the client and the server.
[0078] The response information can be obtained by the language processing model based on the question message, that is, the response information is input into the language processing model, and the language processing model generates a response message corresponding to the question message. For example, the language processing model can be specifically a ChatGpt model. The server sends the question message to the ChatGpt model for processing, and the ChatGpt model generates corresponding response information based on the question message. The server encapsulates the response information into an SSE event and pushes it to the client in real time through a persistent SSE long connection. The client receives and displays the response information in real time by listening to the SSE event.
[0079] In one example, the question message may specifically generate a summary of the main content of an article. The server may parse the main content of the article in the question message and send it to a preset language processing model, such as a ChatGpt model, for processing. The ChatGpt model outputs a summary of the main content of the article to obtain a response message.
[0080] Specifically, see Figure 2 In one embodiment, in order to improve the efficiency of obtaining the response information, the above step of "obtaining the response information corresponding to the question message" includes the following steps:
[0081] S51, determining whether answer information corresponding to the unique identification information is stored in a preset answer database.
[0082] In a specific implementation, in order to improve the efficiency of obtaining the response information, the present application first determines whether the response information corresponding to the question message is stored in the preset answer database. If the response information corresponding to the question message is stored in the preset answer database, it can be directly retrieved, thereby improving the efficiency. In a specific implementation, the answer database can be established in advance, and the answer database is used to record the response information corresponding to the question message that has been answered. Specifically, the unique identification information of the question message and the response information corresponding to the question message are stored in the answer database. As a result, when the same question message is encountered again, the same response information can be directly obtained, thereby improving the efficiency of obtaining the response information.
[0083] S52: If answer information corresponding to the unique identification information is stored in the answer database, use the answer information corresponding to the unique identification information as response information corresponding to the question message.
[0084] In a specific implementation, if the answer information corresponding to the unique identification information is stored in the answer database, the answer information corresponding to the unique identification information is used as the response information corresponding to the question message, and the answer information corresponding to the unique identification information is retrieved from the answer database.
[0085] S53: If the answer information corresponding to the unique identification information is not stored in the answer database, the response information corresponding to the question message is obtained through a preset language processing model.
[0086] In a specific implementation, if the answer information corresponding to the unique identification information is not stored in the answer database, the response information corresponding to the question message is obtained through a preset language processing model. The language processing model may be specifically a ChatGpt model. The server sends the question message to the ChatGpt model for processing, and the ChatGpt model generates corresponding response information based on the question message.
[0087] In one example, the question message may specifically generate a summary of the main content of an article. The server may parse the main content of the article in the question message and send it to a preset language processing model, such as a ChatGpt model, for processing. The ChatGpt model outputs a summary of the main content of the article to obtain a response message.
[0088] S54, storing the unique identification information and the response information corresponding to the question message in the answer database.
[0089] In a specific implementation, after the language processing model obtains the response information corresponding to the question message, the unique identification information and the response information corresponding to the question message are stored in the answer database accordingly. Thus, when the same question message is encountered next time, the corresponding response information can be directly obtained from the answer database, thereby improving the efficiency of obtaining the response information.
[0090] As can be seen from the above, the message response method proposed in the embodiment of the present application is aimed at the problem that the amount of data transmitted from the client to the server through the GET request in the SSE connection is greatly limited and does not support the transmission of large amounts of question messages. First, the client sends the question message to the server through a POST request, and the POST request can support the transmission of large amounts of data; the server stores the question message, generates unique identification information for the question message, and sends the unique identification information to the client; the server establishes an SSE connection with the client; the client sends the unique identification information to the server through the SSE connection; the server obtains the question message based on the unique identification information; obtains the response information corresponding to the question message, and sends the response information to the client based on the SSE connection. Since the unique identification information is only an identity identifier of the question message, and its data volume is very small, the client can quickly send the unique identification information to the server through the SSE connection, thereby realizing the support for large amounts of question messages.
[0091] The present application also provides a message response method, which is applied to the client. Figure 3 , the message response method includes:
[0092] S201. Send a target POST request to a server, where the target POST request includes a question message from a client.
[0093] The server refers to a server that interacts with the client, and the server can generate a response based on the target POST request of the client. For example, in one example, the client needs to generate a summary text content of the target text content. The client can encapsulate the target text content into the body of the target POST request and send it to the server. After receiving the target POST request, the server will process and generate the summary text content required by the client and send it to the client.
[0094] The client encapsulates the question message in the body of the POST request to generate a target POST request, and the client sends the target POST request to the server. The question message may include text content, voice content, image content, etc. For example, a user sends a chat message to the server through the client, and the chat message may include text, voice, pictures, videos, etc. The target POST request can support the transmission of large amounts of question messages.
[0095] In one example, taking the question message as chat information as an example, the client can encapsulate the chat information in the body of the POST request, obtain the target POST request, and then send the target POST request to the server.
[0096] S202: Receive unique identification information of the question message returned by the server based on the target POST request.
[0097] In a specific implementation, after receiving the target POST request sent by the client, the server parses the target POST request, extracts the question message in the target POST request, generates unique identification information of the question message, and returns the unique identification information to the client. Correspondingly, the client receives the unique identification information of the question message returned by the server.
[0098] Furthermore, the server stores the question message and its unique identification information in a database in correspondence, so that the question message can be quickly found in the database based on the unique identification information.
[0099] Accordingly, after the client establishes an SSE connection with the server, the client may send the unique identification information to the server, so that the server may find the corresponding question message from the database based on the unique identification information and process the question message.
[0100] S203: Establish an SSE connection with the server.
[0101] Among them, the SSE connection refers to the connection established between the client and the server by calling the native Server-Sent Events protocol. After the SSE connection is established, the server can push data to the client.
[0102] In the embodiment of the present application, the SSE connection established between the client and the server can be specifically an SSE persistent connection. Specifically, the client initiates an SSE persistent connection request to the server, and the server responds to the SSE persistent connection request to establish an SSE persistent connection between the server and the client. After the SSE persistent connection is established, the server can continuously push data to the client.
[0103] S204. Send the unique identification information to a server via the SSE connection.
[0104] In a specific implementation, after the client establishes an SSE long connection with the server, the client sends the previously received unique identification information to the server so that the server can obtain the previously stored question message based on the unique identification information. For example, if the server previously stored the question message in a database, the server can find the previously stored question message from the database based on the unique identification information.
[0105] In one embodiment, the above step of "sending the unique identification information to the server through the SSE connection" specifically includes the following steps: encapsulating the unique identification information in the body of the GET request to obtain a target GET request; and sending the target GET request to the server through the SSE connection.
[0106] First, the client encapsulates the unique identification information in the body of the GET request to obtain the target GET request. Since the unique identification information is only an identity identifier of the question message, its data volume is very small, so it does not exceed the data volume limit of the GET request. After that, the client sends the target GET request to the server through the SSE connection.
[0107] The server receives the target GET request in response, and parses the target GET request to obtain the unique identification information encapsulated in the target GET request.
[0108] S205. Receive response information returned by the server through the SSE connection, wherein the response information is obtained by the server based on the question message.
[0109] In a specific implementation, the response information is the response information that matches the question message and is obtained by the server based on the question message. The response information may include text content, voice content, picture content, video content and other information.
[0110] After obtaining the question message based on the unique identification information, the server obtains the response information corresponding to the question message, and then sends the response information to the client based on the SSE long connection established between the client and the server.
[0111] The response information can be obtained by the language processing model based on the question message, that is, the response information is input into the language processing model, and the language processing model generates a response message corresponding to the question message. For example, the language processing model can be specifically a ChatGpt model. The server sends the question message to the ChatGpt model for processing, and the ChatGpt model generates corresponding response information based on the question message. The server encapsulates the response information into an SSE event and pushes it to the client in real time through a persistent SSE long connection. The client receives and displays the response information in real time by listening to the SSE event.
[0112] In the embodiment of the present application, the client first uses a target POST request to send a large amount of question message to the server, and the server generates unique identification information of the question message, stores the question message and its unique identification information in a database, and then the server sends the unique identification information to the client; after the client receives the unique identification information, it establishes an SSE connection with the server, and then the client sends the unique identification information to the server through the SSE connection; after the server receives the unique identification information, it finds the previously stored question message from the database, and correspondingly obtains its response information, and sends the message response to the client through the SSE connection. Since the unique identification information is only an identity identifier of the question message, its data volume is very small, so the client can quickly send the unique identification information to the server through the SSE connection, thereby realizing the ability to support large amounts of question messages.
[0113] See also Figure 4 , Figure 4 : is a schematic block diagram of a message response device provided in an embodiment of the present application. The present application also provides a message response device. The message response device can be configured in a server. Specifically, the message response device includes:
[0114] A first receiving unit 401 is configured to receive a target POST request sent by a client to the server, wherein the target POST request includes a question message from the client;
[0115] A first storage unit 402 is used to store the question message, generate unique identification information of the question message, and send the unique identification information to the client;
[0116] A first establishing unit 403, configured to establish an SSE connection with the client;
[0117] The second receiving unit 404 is configured to receive the unique identification information sent by the client through the SSE connection, and obtain the question message based on the unique identification information;
[0118] The acquisition unit 405 is configured to acquire response information corresponding to the question message, and send the response information to the client based on the SSE connection.
[0119] In one embodiment, the receiving the unique identification information sent by the client through the SSE connection includes:
[0120] Receiving a target GET request sent by the client through the SSE connection, wherein the target GET request encapsulates the unique identification information;
[0121] The target GET request is parsed to obtain the unique identification information.
[0122] In one embodiment, storing the question message includes:
[0123] Establishing a mapping relationship between the question message and the unique identification information of the question message;
[0124] The question message and the mapping relationship are stored in a preset storage medium.
[0125] In one embodiment, the obtaining the question message based on the unique identification information includes:
[0126] Acquire the mapping relationship;
[0127] Based on the mapping relationship and the unique identification information, the question message is searched and extracted from the storage carrier.
[0128] In one embodiment, the obtaining response information corresponding to the question message includes:
[0129] Determine whether answer information corresponding to the unique identification information is stored in a preset answer database;
[0130] If answer information corresponding to the unique identification information is stored in the answer database, the answer information corresponding to the unique identification information is used as the response information corresponding to the question message;
[0131] If the answer information corresponding to the unique identification information is not stored in the answer database, response information corresponding to the question message is obtained through a preset language processing model.
[0132] In one embodiment, the message response device further includes:
[0133] The second storage unit is used to store the unique identification information and the response information corresponding to the question message in the answer database.
[0134] The message response method proposed in the embodiment of the present application aims at the problem that the amount of data transmitted from the client to the server through the GET request in the SSE connection is greatly limited and does not support the transmission of large amounts of question messages. First, the client sends the question message to the server through a POST request, and the POST request can support the transmission of large amounts of data; the server stores the question message, generates unique identification information for the question message, and sends the unique identification information to the client; the server establishes an SSE connection with the client; the client sends the unique identification information to the server through the SSE connection; the server obtains the question message based on the unique identification information; obtains the response information corresponding to the question message, and sends the response information to the client based on the SSE connection. Since the unique identification information is only an identity identifier of the question message and its data volume is very small, the client can quickly send the unique identification information to the server through the SSE connection, thereby realizing the support of question messages with large amounts of data.
[0135] See also Figure 5 , Figure 5 : is a schematic block diagram of a message response device provided in an embodiment of the present application. The present application also provides a message response device. The message response device can be configured in a client. Specifically, the message response device includes:
[0136] The first sending unit 501 is used to send a target POST request to the server, where the target POST request includes a question message from the client;
[0137] The third receiving unit 502 is used to receive the unique identification information of the question message returned by the server based on the target POST request;
[0138] A second establishing unit 503 is used to establish an SSE connection with the server;
[0139] A second sending unit 504 is used to send the unique identification information to the server through the SSE connection;
[0140] The fourth receiving unit 505 is configured to receive response information returned by the server through the SSE connection, wherein the response information is obtained by the server in response to the question message.
[0141] In one embodiment, sending the unique identification information to the server through the SSE connection includes:
[0142] Encapsulate the unique identification information in the body of a GET request to obtain a target GET request;
[0143] The targeted GET request is sent to the server via the SSE connection.
[0144] In the embodiment of the present application, the client first uses a target POST request to send a large amount of question message to the server, and the server generates unique identification information of the question message, stores the question message and its unique identification information in a database, and then the server sends the unique identification information to the client; after the client receives the unique identification information, it establishes an SSE connection with the server, and then the client sends the unique identification information to the server through the SSE connection; after the server receives the unique identification information, it finds the previously stored question message from the database, and correspondingly obtains its response information, and sends the message response to the client through the SSE connection. Since the unique identification information is only an identity identifier of the question message, its data volume is very small, so the client can quickly send the unique identification information to the server through the SSE connection, thereby realizing the ability to support large amounts of question messages.
[0145] The message response device can be implemented in the form of a computer program. Figure 6 Runs on the computer device shown.
[0146] like Figure 6 As shown, the embodiment of the present application provides a computer device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0147] Memory 113, used for storing computer programs;
[0148] In one embodiment of the present application, the processor 111 is used to implement the message response method provided by any one of the aforementioned method embodiments when executing the program stored in the memory 113.
[0149] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0150] Therefore, the present application also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program. When the computer program is executed by a processor, the processor executes the message response method provided by any of the aforementioned method embodiments.
[0151] The storage medium is a physical, non-transient storage medium, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which can store program codes. The computer-readable storage medium can be non-volatile or volatile.
[0152] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0153] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0154] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present application can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0155] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.
[0156] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0157] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0158] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A message response method, characterized in that: Applicable to servers, including: Receiving a target POST request sent by a client to the server, wherein the target POST request includes a question message from the client; storing the question message, generating unique identification information of the question message, and sending the unique identification information to the client; Establishing an SSE connection with the client; Receiving unique identification information sent by the client through the SSE connection, and acquiring the question message based on the unique identification information; Acquire response information corresponding to the question message, and send the response information to the client based on the SSE connection.
2. The method according to claim 1, characterized in that The receiving the unique identification information sent by the client through the SSE connection includes: Receiving a target GET request sent by the client through the SSE connection, wherein the target GET request encapsulates the unique identification information; The target GET request is parsed to obtain the unique identification information.
3. The method according to claim 1, characterized in that The storing of the question message comprises: Establishing a mapping relationship between the question message and the unique identification information of the question message; The question message and the mapping relationship are stored in a preset storage medium.
4. The method according to claim 3, characterized in that The obtaining the question message based on the unique identification information includes: Acquire the mapping relationship; Based on the mapping relationship and the unique identification information, the question message is searched and extracted from the storage carrier.
5. The method according to claim 1, characterized in that The obtaining of response information corresponding to the question message includes: Determine whether answer information corresponding to the unique identification information is stored in a preset answer database; If answer information corresponding to the unique identification information is stored in the answer database, the answer information corresponding to the unique identification information is used as the response information corresponding to the question message; If the answer information corresponding to the unique identification information is not stored in the answer database, response information corresponding to the question message is obtained through a preset language processing model.
6. The method according to claim 5, characterized in that After obtaining the response information corresponding to the question message through the preset language processing model, the method further includes: The unique identification information and the response information corresponding to the question message are stored in the answer database accordingly.
7. A message response method, characterized in that: Applied to the client, including: Sending a target POST request to the server, wherein the target POST request includes a question message from the client; Receiving unique identification information of the question message returned by the server based on the target POST request; Establishing an SSE connection with the server; Sending the unique identification information to the server via the SSE connection; Receive response information returned by the server through the SSE connection, wherein the response information is obtained by the server based on the question message.
8. The method according to claim 7, characterized in that The sending the unique identification information to the server through the SSE connection includes: Encapsulate the unique identification information in the body of a GET request to obtain a target GET request; The targeted GET request is sent to the server via the SSE connection.
9. A message response device, characterized in that: The method comprises means for executing the method according to any one of claims 1 to 8.
10. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 8 when executing the computer program.
11. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 can be implemented.
