Method and device for processing dialogue data, electronic equipment and computer readable medium
By building a multi-process and multi-threaded state machine in the customer reach system, using external models to process dialogue data and determine the response results based on confidence, the problems of low efficiency and limited scalability of manual reply are solved, and efficient and low-cost are achieved customer reach.
Patent Information
- Application Number
- CN202411179312.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-06
AI Technical Summary
The manual reply efficiency, high cost, limited scalability and high maintenance costs in existing customer reach systems make it difficult to ensure real-time and accuracy in high concurrency environments.
Obtain conversation messages by listening to message queues, process conversation data corresponding to different roles, call external model interfaces to obtain response results, and decide whether to issue models or manual response results based on confidence thresholds, and build multi-process and multi-threaded state machines to process high Concurrent requests.
It reduces service costs, improves the system's ability to handle high concurrent requests, reduces maintenance costs, and improves the maintainability and scalability of code.
Smart Images

Figure CN119088924A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method, device, electronic device and computer-readable medium for processing dialogue data. Background Art
[0002] Among existing customer contact systems, most are based on the traditional request / response model, where the client initiates requests and the server responds to these requests and returns the required data. These systems usually rely on multi-threading to handle concurrent requests to provide real-time or near real-time user experience. However, as the number of users grows and the frequency of requests increases, these systems often encounter performance bottlenecks, especially in terms of resource allocation and state management.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] Manual responses to customers are inefficient: Customer operations usually rely on manual responses to customer messages, and real-time performance is difficult to guarantee; Manual responses to customers are costly: Large-scale manual responses require a large number of personnel, and the investment in manpower and material resources is high; The accuracy of solving customer problems needs to be improved: The problems and demands reported by customers have specific scenarios, and manual responses require a lot of training to ensure accurate answers to customer questions; Limited scalability: With the increase in the number of customers, the amount of concurrency increases, and the limitations of system resources (such as database connections and thread pools) will lead to performance degradation; Complex state management: In a high-concurrency environment, the management of client status becomes complex, which is prone to race conditions and data inconsistencies; High maintenance costs: With the increase in system complexity, code maintenance and expansion become more difficult. Summary of the invention
[0005] In view of this, embodiments of the present invention provide a method, device, electronic device and computer-readable medium for processing conversation data to solve the technical problems of high investment in manpower and material resources, limited scalability and high maintenance cost.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for processing conversation data is provided, comprising:
[0007] In response to monitoring that the message queue stores a conversation message, the conversation message is consumed to obtain the current conversation data of the user, and the state is set to initialize;
[0008] Acquire historical conversation data of the user in the past period of time or historical conversation data close to the current conversation data, process the historical conversation data and the current conversation data into conversation data corresponding to different roles, and set the status to processed;
[0009] Using the dialogue data corresponding to the different roles as input parameters, calling the external model interface, thereby obtaining the response result returned by the model interface, and setting the status to the called interface;
[0010] Determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user and set the status to sent; if not, send the manual response result to the user and set the status to sent.
[0011] Optionally, before obtaining the historical conversation data of the user within a past period of time or the historical conversation data close to the current conversation data, the method further includes:
[0012] Get interface configuration parameters from the cache;
[0013] If the interface configuration parameter is enabled, after obtaining the response result returned by the model interface, determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user, and set the status to sent; if not, send the manual response result to the user, and set the status to sent;
[0014] If the interface configuration parameter is to pause, after obtaining the response result returned by the model interface, the manual response result is sent to the user, and the status is set to sent.
[0015] Optionally, determining whether the confidence of the response result returned by the model interface is greater than or equal to a confidence threshold; if so, sending the response result returned by the model interface to the user and setting the status to sent; if not, sending the manual response result to the user and setting the status to sent, including:
[0016] Determine whether the manual response result has been sent to the user, and set the status to verified manual;
[0017] If yes, then it ends and the status is set to issued;
[0018] If not, determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user, and set the status to sent; if not, send a response notification to the operator, store the response notification in the delay queue, and set the status to notified operation.
[0019] Optionally, after storing the response notification in a delay queue, the method further includes:
[0020] The response notification is taken out from the delay queue regularly through a timer task, and it is determined whether the manual response result has been sent to the user, and the status is set to verified manual;
[0021] If yes, then it ends and the status is set to issued;
[0022] If not, send a response notification to the operator again via instant messaging software or SMS, and set the status to "notified operator";
[0023] The response notification includes the user's current conversation data and the response result returned by the model interface.
[0024] Optionally, the method further comprises:
[0025] Use stress testing software to obtain the maximum query rate per second of the model interface;
[0026] Semaphore counting is adopted to make the query rate per second of the model interface less than or equal to the maximum query rate per second.
[0027] Optionally, the method further comprises:
[0028] If an exception occurs when calling the model interface, the preset response result will be used as the response result returned by the model interface.
[0029] In addition, according to another aspect of an embodiment of the present invention, there is provided a device for processing conversation data, comprising:
[0030] A consumption module, for consuming the conversation message in response to monitoring that the message queue stores the conversation message, thereby obtaining the user's current conversation data and setting the state to initialization;
[0031] A processing module, used to obtain the historical conversation data of the user in the past period of time or the historical conversation data close to the current conversation data, process the historical conversation data and the current conversation data into conversation data corresponding to different roles, and set the status to processed;
[0032] A calling module, used to call the external model interface with the dialogue data corresponding to the different roles as input parameters, thereby obtaining the response result returned by the model interface and setting the status to the called interface;
[0033] The sending module is used to determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, the response result returned by the model interface is sent to the user and the status is set to sent; if not, the manual response result is sent to the user and the status is set to sent.
[0034] Optionally, the sending module is further used for:
[0035] Get interface configuration parameters from the cache;
[0036] If the interface configuration parameter is enabled, after obtaining the response result returned by the model interface, determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user, and set the status to sent; if not, send the manual response result to the user, and set the status to sent;
[0037] If the interface configuration parameter is to pause, after obtaining the response result returned by the model interface, the manual response result is sent to the user, and the status is set to sent.
[0038] Optionally, the sending module is further used for:
[0039] Determine whether the manual response result has been sent to the user, and set the status to verified manual;
[0040] If yes, then it ends and the status is set to issued;
[0041] If not, determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user, and set the status to sent; if not, send a response notification to the operator, store the response notification in the delay queue, and set the status to notified operation.
[0042] Optionally, the sending module is further used for:
[0043] After storing the response notification in the delay queue, the response notification is taken out from the delay queue regularly by a timer task, and it is determined whether the manual response result has been sent to the user, and the status is set to verified manual;
[0044] If yes, then it ends and the status is set to issued;
[0045] If not, send a response notification to the operator again via instant messaging software or SMS, and set the status to "notified operator";
[0046] The response notification includes the user's current conversation data and the response result returned by the model interface.
[0047] Optionally, the calling module is further used for:
[0048] Use stress testing software to obtain the maximum query rate per second of the model interface;
[0049] Semaphore counting is adopted to make the query rate per second of the model interface less than or equal to the maximum query rate per second.
[0050] Optionally, the calling module is further used for:
[0051] If an exception occurs when calling the model interface, the preset response result will be used as the response result returned by the model interface.
[0052] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:
[0053] one or more processors;
[0054] a storage device for storing one or more programs,
[0055] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the above embodiments.
[0056] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.
[0057] According to another aspect of an embodiment of the present invention, 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 one of the above embodiments is implemented.
[0058] An embodiment of the above invention has the following advantages or beneficial effects: because the dialogue data corresponding to different roles is used as input parameters, the external model interface is called to obtain the response result returned by the model interface, and the status is set to the called interface; it is determined whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, the response result returned by the model interface is sent to the user, and the status is set to sent; if not, the manual response result is sent to the user, and the status is set to sent. Technical means, so it overcomes the technical problems of high human and material investment, limited scalability and high maintenance cost in the prior art. The embodiment of the present invention constructs a multi-process and multi-threaded state machine, so that the originally complex contact process can efficiently and smoothly contact the user, and at the same time, the user's questions are answered by calling an external large model. If the model cannot answer, it will be replied by manual intervention, which not only reduces the service cost and improves the system's processing ability for high concurrent requests, but also reduces the system's maintenance cost and improves the maintainability and scalability of the code.
[0059] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0061] Figure 1 is a flowchart of a method for processing conversation data according to an embodiment of the present invention;
[0062] Figure 2 is a flowchart of a method for processing conversation data according to a reference embodiment of the present invention;
[0063] Figure 3 is a flowchart of a method for processing conversation data according to another reference embodiment of the present invention;
[0064] Figure 4 is a flowchart of a method for processing conversation data according to yet another reference embodiment of the present invention;
[0065] Figure 5 is a schematic diagram of an apparatus for processing conversation data according to an embodiment of the present invention;
[0066] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0067] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0068] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0069] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0070] Figure 1 is a flow chart of a method for processing conversation data according to an embodiment of the present invention. As an embodiment of the present invention, Figure 1 As shown, the method for processing conversation data may include:
[0071] Step 101, in response to monitoring that a message queue stores a conversation message, the conversation message is consumed to obtain the user's current conversation data, and the state is set to initialized.
[0072] When the client initiates a conversation request to the server, the client calls the chat interface of the server. After receiving the conversation request sent by the client, the server encapsulates the user's current conversation data carried in the conversation request into a conversation message and writes the conversation message to the message queue.
[0073] The system monitors the message queue in real time. If a conversation message is detected in the message queue, the system takes the conversation message from the head of the message queue and consumes the conversation message to obtain the user's current conversation data and sets the state of the state machine to be initialized. Optionally, after obtaining the user's current conversation data, the user's current conversation data is stored in the database to record the data to prevent loss, and the state of the state machine is set to be saved.
[0074] Step 102, obtaining the historical conversation data of the user in the past period of time or the historical conversation data close to the current conversation data, processing the historical conversation data and the current conversation data into conversation data corresponding to different roles, and setting the status to processed.
[0075] After obtaining the user's current conversation data, obtain the user's historical conversation data in the past period of time from the database (such as historical conversation data in the last half hour, last hour, last 6 hours, or last 12 hours) or historical conversation data close to the current conversation data (such as the last 10, last 15, last 20, or last 30 historical conversation data), then process the user's historical conversation data and current conversation data into conversation data corresponding to different roles (such as user role and assistant role), and set the state of the state machine to processed.
[0076] Step 103, using the dialog data corresponding to the different roles as input parameters, calling the external model interface, thereby obtaining the response result returned by the model interface, and setting the state to the called interface.
[0077] After processing the dialogue data corresponding to different roles, the dialogue data corresponding to different roles are used as input parameters to call the external model interface to obtain the response result returned by the model interface, and then the state of the state machine is set to the called interface.
[0078] Step 104, determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user and set the status to sent; if not, send the manual response result to the user and set the status to sent.
[0079] In this step, first determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold. If so, the response result returned by the model interface is sent to the user, and the state of the state machine is set to sent. If not, the manual response result is sent to the user, and the state of the state machine is set to sent.
[0080] Optionally, step 104 may include: determining whether the manual response result has been sent to the user, and setting the status to verified manual; if so, ending, and setting the status to sent; if not, determining whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, sending the response result returned by the model interface to the user, and setting the status to sent; if not, sending a response notification to the operator, and setting the status to notified operation. Figure 2 As shown, after receiving the response result returned by the model interface, the system first determines whether the system has sent the manual response result to the user, and sets the state of the state machine to verified manual. If yes, the state of the state machine is set to sent. If not, it further determines whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold. If yes, the response result returned by the model interface is sent to the user, and the state of the state machine is set to sent. If not, a response notification is sent to the operator, and the status is set to notified operation.
[0081] It should be noted that if the operator has already responded to the user, the system will save the manual response result to the database. After receiving the response result returned by the model interface, it can be queried in the database whether there is the latest manual response data corresponding to the user. If so, it means that the system has sent the manual response result to the user. In an embodiment of the present invention, regardless of whether the response result returned by the model interface is sent to the user, the system will store the response result returned by the model interface in the database for continuous optimization of the model and algorithm to improve the response accuracy of the model.
[0082] In an embodiment of the present invention, before step 101, a multi-threaded multi-flow state machine is started, and a thread is created so that the thread executes steps 101 to 104. Before step 101, the state, event, trigger condition, and execution method are defined, and a unique ID is used throughout the state to set up a multi-branch state flow. Define the state values: initialized, saved, processed, model interface called, issued, manual verification, and operation notified. Define events: maintain success, process success, call success, issue success, manual verification success, and operation notification success.
[0083] According to the various embodiments described above, it can be seen that the embodiment of the present invention uses the dialogue data corresponding to different roles as input parameters to call the external model interface, thereby obtaining the response result returned by the model interface, and setting the status to the called interface; judging whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, the response result returned by the model interface is sent to the user, and the status is set to sent; if not, the manual response result is sent to the user, and the status is set to sent. The technical means solves the technical problems of high human and material investment, limited scalability and high maintenance cost in the prior art. The embodiment of the present invention constructs a multi-process and multi-threaded state machine, so that the originally complex contact process can efficiently and smoothly reach the user, and at the same time, the user's questions are answered by calling an external large model. If the model cannot answer, the reply is manually intervened, which not only reduces the service cost and improves the system's processing ability for high concurrent requests, but also reduces the system's maintenance cost and improves the maintainability and scalability of the code.
[0084] Figure 3 , which is a flow chart of a method for processing conversation data according to another reference embodiment of the present invention. Figure 3 As shown, the method for processing conversation data may include:
[0085] Step 301, in response to monitoring that a message queue stores a conversation message, the conversation message is consumed to obtain the user's current conversation data, and the state is set to initialized.
[0086] Step 302, obtain the interface configuration parameter from the cache. If the interface configuration parameter is enabled, execute steps 303, 304 and 305; if the interface configuration parameter is paused, execute steps 303, 304 and 306.
[0087] In an embodiment of the present invention, interface configuration parameters may be preconfigured, such as enabling or pausing, and the interface configuration parameters may be stored in a cache for easy retrieval.
[0088] Step 303, obtaining the historical conversation data of the user in the past period of time or the historical conversation data close to the current conversation data, processing the historical conversation data and the current conversation data into conversation data corresponding to different roles, and setting the status to processed.
[0089] Step 304, using the dialog data corresponding to the different roles as input parameters, calling the external model interface, thereby obtaining the response result returned by the model interface, and setting the state to the called interface.
[0090] Step 305, determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user and set the status to sent; if not, send the manual response result to the user and set the status to sent.
[0091] Step 306: Send the manual response result to the user and set the status to sent.
[0092] In the embodiment of the present invention, regardless of whether the interface configuration parameter is enabled, the model interface will be called to obtain the response result of the model interface. The difference is that if the interface configuration parameter is enabled, it is first determined whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold. If so, the response result returned by the model interface is sent to the user. If not, the manual response result is sent to the user. If the interface configuration parameter is paused, the manual response result is directly sent to the user. This helps to enrich the prediction of the model and improve the accuracy of the model's response.
[0093] It should be noted that throughout the entire process, the response results returned by the model interface and the response results made by the operator will be stored in the database to help optimize the algorithm model.
[0094] The embodiment of the present invention provides a solution for reaching existing customers under high concurrency based on a state machine, which solves the difficulty of reaching customers under the existing technology, and the performance bottleneck and scalability problems of reaching customers on a large scale concurrently. Specific technical issues include: introducing external large models to reduce customer service costs; improving the system's processing capabilities for high-concurrency requests; effectively managing the state of the state machine to ensure data consistency and accuracy; reducing the system's maintenance costs, while improving the maintainability and scalability of the code.
[0095] In addition, the specific implementation content of the method for processing conversation data in another reference embodiment of the present invention has been described in detail in the method for processing conversation data described above, so the repeated content will not be described again here.
[0096] Figure 41 is a flow chart of a method for processing conversation data according to another reference embodiment of the present invention. Figure 4 As shown, the method for processing conversation data may include:
[0097] Step 401, in response to monitoring that a message queue stores a conversation message, the conversation message is consumed to obtain the user's current conversation data, and the state is set to initialized.
[0098] Step 402, obtaining the historical conversation data of the user in the past period of time or the historical conversation data close to the current conversation data, processing the historical conversation data and the current conversation data into conversation data corresponding to different roles, and setting the status to processed.
[0099] Step 403, using the dialog data corresponding to the different roles as input parameters, calling the external model interface, thereby obtaining the response result returned by the model interface, and setting the state to the called interface.
[0100] Optionally, the method further includes: using stress testing software to obtain the maximum query rate per second of the model interface; using semaphore counting to make the query rate per second of the model interface less than or equal to the maximum query rate per second. In the entire process, the model interface takes the longest time and has the lowest concurrency in high concurrency scenarios. Therefore, the maximum query rate per second (QPS) of the model interface is detected in advance using stress testing software, and then semaphore counting is used to make the query rate per second of the model interface less than or equal to the maximum query rate per second to ensure the normal return of each interface.
[0101] Optionally, the method further includes: if an exception occurs when calling the model interface, a preset response result is used as the response result returned by the model interface. When receiving the return result of the model interface, if the interface returns abnormally, the system will print the interface error log, and the monitoring thread will collect the keywords of the log to alarm so as to notify the model developer to repair it. In addition, the system will also capture the exception, downgrade the interface call, and give a fallback answer (the response result can be preset) to ensure that the exception does not affect the normal flow of other tasks.
[0102] Step 404, determine whether the manual response result has been sent to the user, and set the status to verified manual; if so, end and set the status to sent; if not, execute step 405.
[0103] Step 405 , determining whether the confidence level of the response result returned by the model interface is greater than or equal to a confidence level threshold; if so, executing step 406 ; if not, executing step 407 .
[0104] Step 406: Send the response result returned by the model interface to the user, and set the status to sent.
[0105] Step 407: Send a response notification to the operator, store the response notification in a delay queue, and set the status to "notified operator". The response notification includes the current conversation data of the user and the response result returned by the model interface.
[0106] If the confidence level of the response result returned by the model interface is less than the confidence threshold, the response notification is pushed to the operator in real time through WebSocket technology to remind the operator to intervene and reply, add the response notification to the delay queue, and set the state of the state machine to have been notified.
[0107] Step 408, through the timer task, regularly take out the response notification from the delay queue, determine whether the manual response result has been sent to the user, and set the status to verified manual; if so, end and set the status to sent; if not, execute step 309.
[0108] Step 409, send a response notification to the operator again via instant messaging software or SMS, and set the status to "operator notified".
[0109] For the response notification in the delayed queue, after the specified time (such as 3 minutes after joining the queue, 5 minutes after joining the queue, 10 minutes after joining the queue) arrives, it will be checked again whether there is a manual reply. If there is no reply, the operator will be reminded once through instant messaging software or SMS, and the state of the state machine will be set to notified operation.
[0110] In the embodiment of the present invention, data such as state flow, trigger events, process ID, user dialogue data, historical dialogue data, response results returned by the model interface, and manually made response results are recorded in the database at each state flow to facilitate subsequent verification. Start a scheduled task to pull the response results returned by the model interface, historical dialogue data, and manually intervened response results at regular intervals every day to help improve and optimize the algorithm model.
[0111] The customer contact solution process is relatively complex. In a high-concurrency scenario, the embodiment of the present invention uses a state machine to ensure that each dialogue request can smoothly flow from the start state to the end state. By decoupling all event calls, the task state is changed after the previous event is completed, and the next event is notified to execute, effectively preventing event call failures.
[0112] The embodiment of the present invention constructs a multi-process and multi-threaded state machine so that the originally complex contact process can efficiently and smoothly reach users. At the same time, it answers users' questions by calling an external large model. If the model cannot answer the question, manual intervention will be used to reply. This not only reduces service costs and improves the system's ability to handle high-concurrency requests, but also reduces the system's maintenance costs and improves the maintainability and scalability of the code. Moreover, in the case of high concurrency, by defining the maximum QPS, it is guaranteed that the model interface is called without errors, ensuring the normal progress of the process. In addition, data recording and playback technology is also used to continuously optimize the model and algorithm to improve the accuracy of the response.
[0113] In addition, the specific implementation content of the method for processing conversation data in another reference embodiment of the present invention has been described in detail in the method for processing conversation data described above, so the repeated content will not be described again here.
[0114] Figure 5 Schematic diagram of an apparatus for processing conversation data according to an embodiment of the present invention. Figure 5 As shown, the device 500 for processing conversation data includes a consumption module 501, a processing module 502, a calling module 503 and a sending module 504; wherein the consumption module 501 is used for consuming the conversation message in response to monitoring that the message queue stores the conversation message, thereby obtaining the user's current conversation data and setting the state to initialized; the processing module 502 is used for obtaining the historical conversation data of the user in the past period of time or the historical conversation data close to the current conversation data, processing the historical conversation data and the current conversation data into conversation data corresponding to different roles, and setting the state to processed; the calling module 503 is used for calling the external model interface with the conversation data corresponding to the different roles as input parameters, thereby obtaining the response result returned by the model interface, and setting the state to the called interface; the sending module 504 is used for judging whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, sending the response result returned by the model interface to the user and setting the state to sent; if not, sending the manual response result to the user and setting the state to sent.
[0115] Optionally, the sending module 504 is further used for:
[0116] Get interface configuration parameters from the cache;
[0117] If the interface configuration parameter is enabled, after obtaining the response result returned by the model interface, determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user, and set the status to sent; if not, send the manual response result to the user, and set the status to sent;
[0118] If the interface configuration parameter is to pause, after obtaining the response result returned by the model interface, the manual response result is sent to the user, and the status is set to sent.
[0119] Optionally, the sending module 504 is further used for:
[0120] Determine whether the manual response result has been sent to the user, and set the status to verified manual;
[0121] If yes, then it ends and the status is set to issued;
[0122] If not, determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user, and set the status to sent; if not, send a response notification to the operator, store the response notification in the delay queue, and set the status to notified operation.
[0123] Optionally, the sending module 504 is further used for:
[0124] After storing the response notification in the delay queue, the response notification is taken out from the delay queue regularly by a timer task, and it is determined whether the manual response result has been sent to the user, and the status is set to verified manual;
[0125] If yes, then it ends and the status is set to issued;
[0126] If not, send a response notification to the operator again via instant messaging software or SMS, and set the status to "notified operator";
[0127] The response notification includes the user's current conversation data and the response result returned by the model interface.
[0128] Optionally, the calling module 503 is further used for:
[0129] Use stress testing software to obtain the maximum query rate per second of the model interface;
[0130] Semaphore counting is adopted to make the query rate per second of the model interface less than or equal to the maximum query rate per second.
[0131] Optionally, the calling module 503 is further used to:
[0132] If an exception occurs when calling the model interface, the preset response result will be used as the response result returned by the model interface.
[0133] It should be noted that the specific implementation content of the device for processing conversation data in the present invention has been described in detail in the method for processing conversation data described above, so the repeated content will not be described again here.
[0134] Figure 6 An exemplary system architecture 600 is shown to which the method for processing conversation data or the apparatus for processing conversation data according to the embodiments of the present invention can be applied.
[0135] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0136] The user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0137] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0138] The server 605 may be a server that provides various services, such as a backend management server (for example only) that provides support for shopping websites browsed by users using the terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as the item information query request, and feed back the processing results to the terminal device.
[0139] It should be noted that the method for processing conversation data provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the device for processing conversation data is generally disposed in the server 605 .
[0140] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0141] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0142] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 to a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0143] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0144] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0145] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0146] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0147] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as follows: a processor includes a consumption module, a processing module, a calling module and a sending module, wherein the names of these modules do not constitute a limitation on the modules themselves in some cases.
[0148] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently and not assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements the following method: in response to monitoring that a message queue stores a conversation message, consume the conversation message to obtain the user's current conversation data, and set the state to initialize; obtain the user's historical conversation data in the past period of time or the historical conversation data close to the current conversation data, process the historical conversation data and the current conversation data into conversation data corresponding to different roles, and set the state to processed; use the conversation data corresponding to the different roles as input parameters, call an external model interface, and obtain the response result returned by the model interface, and set the state to the called interface; determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user, and set the state to sent; if not, send the manual response result to the user, and set the state to sent.
[0149] As another aspect, an embodiment of the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the method described in any of the above embodiments is implemented.
[0150] According to the technical solution of the embodiment of the present invention, because the dialogue data corresponding to different roles is used as input parameters, the external model interface is called to obtain the response result returned by the model interface, and the status is set to the called interface; it is determined whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, the response result returned by the model interface is sent to the user, and the status is set to sent; if not, the manual response result is sent to the user, and the status is set to sent. Technical means, so it overcomes the technical problems of high human and material investment, limited scalability and high maintenance cost in the prior art. The embodiment of the present invention constructs a multi-process, multi-threaded state machine, so that the originally complex contact process can efficiently and smoothly reach the user, and at the same time, the user's questions are answered by calling an external large model. If the model cannot answer, it will be replied by manual intervention, which not only reduces the service cost and improves the system's processing ability for high concurrent requests, but also reduces the system's maintenance cost and improves the maintainability and scalability of the code.
[0151] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for processing conversation data, It is characterized in that include: In response to monitoring that the message queue stores a conversation message, the conversation message is consumed to obtain the current conversation data of the user, and the state is set to initialize; Acquire historical conversation data of the user in the past period of time or historical conversation data close to the current conversation data, process the historical conversation data and the current conversation data into conversation data corresponding to different roles, and set the status to processed; Using the dialogue data corresponding to the different roles as input parameters, calling the external model interface, thereby obtaining the response result returned by the model interface, and setting the status to the called interface; Determine whether the confidence level of the response result returned by the model interface is greater than or equal to a confidence level threshold; If yes, the response result returned by the model interface is sent to the user, and the status is set to sent; If not, the manual response result is sent to the user and the status is set to sent.
2. The method according to claim 1, It is characterized in that Before obtaining the historical conversation data of the user within a past period of time or the historical conversation data close to the current conversation data, the method further includes: Get interface configuration parameters from the cache; If the interface configuration parameter is enabled, after obtaining the response result returned by the model interface, determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user, and set the status to sent; if not, send the manual response result to the user, and set the status to sent; If the interface configuration parameter is to pause, after obtaining the response result returned by the model interface, the manual response result is sent to the user, and the status is set to sent.
3. The method according to claim 1, It is characterized in that Determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user and set the status to sent; If not, the manual response result is sent to the user and the status is set to sent, including: Determine whether the manual response result has been sent to the user, and set the status to verified manual; If yes, then it ends and the status is set to issued; If not, determine whether the confidence of the response result returned by the model interface is greater than or equal to the confidence threshold; if so, send the response result returned by the model interface to the user, and set the status to sent; if not, send a response notification to the operator, store the response notification in the delay queue, and set the status to notified operation.
4. The method according to claim 3, It is characterized in that After storing the response notification in the delay queue, the method further includes: The response notification is taken out from the delay queue regularly through a timer task, and it is determined whether the manual response result has been sent to the user, and the status is set to verified manual; If yes, then it ends and the status is set to issued; If not, send a response notification to the operator again via instant messaging software or SMS, and set the status to "notified operator"; The response notification includes the user's current conversation data and the response result returned by the model interface.
5. The method according to claim 1, It is characterized in that The method further comprises: Use stress testing software to obtain the maximum query rate per second of the model interface; Semaphore counting is adopted to make the query rate per second of the model interface less than or equal to the maximum query rate per second.
6. The method according to claim 1, It is characterized in that The method further comprises: If an exception occurs when calling the model interface, the preset response result will be used as the response result returned by the model interface.
7. A device for processing conversation data, It is characterized in that include: A consumption module, for consuming the conversation message in response to monitoring that the message queue stores the conversation message, thereby obtaining the user's current conversation data and setting the state to initialization; A processing module, used to obtain the historical conversation data of the user in the past period of time or the historical conversation data close to the current conversation data, process the historical conversation data and the current conversation data into conversation data corresponding to different roles, and set the status to processed; A calling module, used to call the external model interface with the dialogue data corresponding to the different roles as input parameters, thereby obtaining the response result returned by the model interface and setting the status to the called interface; The sending module is used to determine whether the confidence level of the response result returned by the model interface is greater than or equal to the confidence level threshold; If yes, the response result returned by the model interface is sent to the user, and the status is set to sent; If not, the manual response result is sent to the user and the status is set to sent.
8. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Route selection method and device, electronic equipment and storage medium
CN113256173A
Intelligent customer service dialogue method and device for man-machine cooperation
CN113282737A
Dialogue method and training method and device of dialogue model
CN116127035A
Conversation voice processing method based on confidence coefficient and related equipment
CN117014554A
