Response generation method, apparatus and computer-readable storage medium

By analyzing the intent and emotion of user input text, and combining product keywords and user preferences to generate multiple candidate responses, the problem of monotonous responses in traditional chat tools is solved, and personalized and professional response generation is achieved.

CN122489702APending Publication Date: 2026-07-31YIYUNYING (SHANDONG) NETWORK TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YIYUNYING (SHANDONG) NETWORK TECHNOLOGY CO LTD
Filing Date
2026-04-30
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Traditional chat assistance tools lack personalized responses, failing to accurately match user intent and emotions, resulting in monotonous responses that fail to provide specific information or demonstrate humanistic care.

Method used

By acquiring and analyzing user input text, identifying intent and emotional information, and combining product keywords to retrieve response composition information from a pre-set knowledge base, the system determines the response template style based on user preferences and generates multiple candidate responses for selection.

Benefits of technology

It ensures the completeness, accuracy, and professionalism of the responses, meets users' emotional needs and expression preferences, and improves the accuracy of responses and user satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122489702A_ABST
    Figure CN122489702A_ABST
Patent Text Reader

Abstract

This application relates to a response generation method, apparatus, and computer-readable storage medium. The method includes: acquiring and analyzing user input text to obtain intent information, sentiment information, and product keywords; retrieving response composition information from a preset knowledge base based on the intent information and product keywords; determining the information organization method of the response composition information based on the matching results of the product keywords and the preset product information base; acquiring user preferences and determining the response template style based on the sentiment information and user preferences; generating multiple candidate responses for the user input text according to the response composition information, information organization method, and response template style, and selecting at least one candidate response as the interactive response. This method can improve the accuracy of responses and user satisfaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of response generation technology, and in particular to a response generation method, apparatus and computer-readable storage medium. Background Technology

[0002] Traditional chatbots often provide fixed template responses, lacking personalization to user intent and emotions, making it difficult to accurately match responses to user needs. For example, when a user expresses an intention to purchase construction machinery, the system often cannot provide specific models, parameters, and prices; when a user is anxious, the system still responds in a uniform style, failing to demonstrate care and humanization. Therefore, existing technologies offer monotonous responses and cannot dynamically generate multi-style, multi-candidate personalized responses based on user intent, emotions, and historical behavior. Summary of the Invention

[0003] Therefore, it is necessary to provide a response generation method, apparatus, and computer-readable storage medium that can improve the accuracy of responses and user satisfaction, addressing the aforementioned technical problems.

[0004] To address the aforementioned technical issues, firstly, a response generation method is provided, which includes: Acquire and analyze user input text to obtain intent information, sentiment information, and product keywords; The system retrieves response information from a pre-defined knowledge base based on intent information and product keywords. The information organization method of the response is determined based on the matching results between product keywords and the preset product information database; Obtain user preferences and determine the response template style based on sentiment information and user preferences; Based on the information composition, information organization method, and response template style, generate multiple candidate responses for the user's input text, and select at least one candidate response as the interactive response.

[0005] In one embodiment, acquiring and analyzing user input text to obtain intent information, emotion information, and product keywords includes: Obtain user input text, input the user input text into a language model, and use the language model to determine product keywords and intent information; The user input text is fed into a convolutional neural network, which then performs emotion recognition to obtain emotion information.

[0006] In one embodiment, the language model includes an embedding layer, an encoding layer, a classification layer, and a sequence labeling layer. User input text is fed into the language model, and the language model determines product keywords and intent information, including: The user input text is segmented by an embedding layer. Each segmented word is converted into a word embedding vector, and a corresponding position embedding vector and segment embedding vector are added to each word to generate an input vector. The input vector is fed into the encoding layer, where it is encoded by a multi-layer encoder to output a context semantic representation vector. This context semantic representation vector is used to characterize the semantic dependencies between words. The vector corresponding to the classification label is extracted from the context semantic representation vector. The vector corresponding to the classification label aggregates the semantic information corresponding to the entire input vector. The vector corresponding to the classification label is then input into the classification layer. The classification layer outputs the probability distribution of each intent based on the vector corresponding to the classification label, and selects the intent with the highest probability as the intent information; The context semantic representation vector is input into the sequence labeling layer, which outputs a label for each word position in the input sequence. The label is used to identify whether the word is a component of the product keyword. Continuously labeled entity words are extracted as product keywords.

[0007] In one embodiment, the convolutional neural network includes a word embedding layer, a convolutional layer, a pooling layer, and a fully connected layer. User input text is fed into the convolutional neural network, which performs emotion recognition to obtain emotion information, including: The user-input text is segmented into words to obtain a word sequence; Each word in the word sequence is mapped to a word vector through a word embedding layer to form an input matrix. The input matrix is ​​then fed into a convolutional layer, where multiple convolutional kernels of different sizes are used to perform convolution operations to extract local semantic features of continuous word sequences of different lengths in the input matrix, outputting multiple feature maps. Each feature map is used to represent a local expression pattern related to emotion. Multiple feature maps are input into the pooling layer. Max pooling is performed on each feature map. The maximum value in each feature map is extracted as the most significant emotion feature corresponding to that feature map. The maximum values ​​are concatenated to form a feature vector representing the global emotion. The feature vector is input into a fully connected layer, and the activation function maps the feature vector to a preset emotion category space, outputting the probability of each emotion category; Emotion categories with a probability higher than a preset threshold are selected as emotion information.

[0008] In one embodiment, the method further includes: Determine if a user profile exists in the cache; If a user profile exists in the cache, load the user profile from the cache; If a user profile is not found in the cache, load the user profile from the database and write it to the cache. Determine a response strategy that matches the user profile.

[0009] In one embodiment, determining a response strategy that matches the user profile includes: In response to user profiles, including historical intents, the activity and dispersion of various historical intents are determined. Based on the activity of historical intents, the tone of the response is determined; based on the dispersion of historical intents, the guidance method for the response is determined; and the tone and guidance method are incorporated into the response strategy; and / or, In response to user profiles, including product preferences, the types of products to be recommended are determined based on the distribution characteristics of product preferences, and these recommended product types are incorporated into the response strategy. In response to user profiles including language preferences, the language style of responses is determined based on the type of language preference, and this language style is incorporated into the response strategy; and / or, In response to user profiles, including interaction frequency, an index of interaction frequency is used to determine the guidance strength and information density of responses, and guidance strength and information density are incorporated into the response strategy; and / or, In response to user profiles, including user levels, the priority of response generation methods is determined based on user levels. The priority of generation methods is incorporated into the response strategy, which is the order in which different generation methods are selected when generating responses.

[0010] In one embodiment, retrieving response composition information from a preset knowledge base based on intent information and product keywords includes: Obtain a preset mapping relationship table, and select a preset knowledge base that matches the intent information as the target knowledge base based on the preset mapping relationship table. The preset mapping relationship table stores the mapping relationship between intent information and preset knowledge base types. The preset knowledge base includes at least one of product information base, industry knowledge base, and common questions base. Retrieve response information from the target knowledge base based on product keywords.

[0011] In one embodiment, retrieving response composition information from the target knowledge base based on product keywords includes: In response to a pre-defined knowledge base, including a product information base, at least one of the following is retrieved from the product information base: basic product information, product specifications, product price information, and product status information, as the response component information; and / or, In response to a pre-defined knowledge base, including an industry knowledge base, at least one of the following related information—trade terms, payment methods, quality standards, technological processes, and after-sales services—is retrieved from the industry knowledge base as part of the response information; and / or, In response to a pre-defined knowledge base including a FAQ database, at least one of the following is retrieved from the FAQ database: a question identifier that matches the user's input text, a standard answer to the question, and related products associated with the question, as the answer's constituent information.

[0012] In one embodiment, the information organization method for determining the response composition information based on the matching results of product keywords and a preset product information database includes: Determine whether the product keywords match product records in the preset product information database; In response to the matching of product keywords with product records in the preset product information database, the information organization method is determined to include filling the response composition information into the response template.

[0013] In one embodiment, determining whether product keywords match product records in a preset product information database further includes: In response to a mismatch between product keywords and product records in the preset product information database, the information organization method is determined to include calling preset general scripts to generate guiding responses, which are used to guide users to supplement product requirement information.

[0014] In one embodiment, obtaining user preferences and determining the response template style based on sentiment information and user preferences includes: Analyze users' historical chat records and identify at least one of product preferences, language preferences, and communication preferences as user preferences. The emotional type of the response is determined based on emotional information; wherein, the emotional type is used to characterize the category of emotional expression used in the response, and the emotional expression category includes at least one of the following: reassuring, enthusiastic, efficient, professional, or exploratory. Determine the preferred way to express responses based on user preferences; Determine the style of the response template by combining the emotional type and expression preferences.

[0015] In one embodiment, generating multiple candidate responses to the user's input text according to the response composition information, information organization method, and response template style includes: The response strategy, the information components of the response, the information organization method, and the style of the response template are preset dimensions. Multiple preset generation methods are obtained, and candidate responses are generated according to different preset generation methods; among them, the preset dimensions selected when generating candidate responses differ for different preset generation methods.

[0016] In one embodiment, generating candidate responses according to different preset generation methods includes: Based on the response strategy and response template style, a target response template is determined. This template is then parsed according to the information organization method. Variable placeholders within the target response template are identified. Fields with the same names as the variable placeholders are extracted from the response structure information and used as fill content. The fill content is then used to replace the variable placeholders, generating the first candidate response; and / or, Obtain the contextual information of the user input text, and fill the preset prompt word template with the contextual information, intent information, sentiment information, response strategy, response template style, and response composition information to generate the model user input text. Using the model user input text as the initial sequence, the target model predicts the next word word by word based on the initial sequence. After each word is generated, it is appended to the end of the sequence. The next word is generated based on the updated initial sequence until a termination condition is met. All generated words are combined into a second candidate response and output. The contextual information includes at least the user input text from at least one round prior to the current user input text round and the corresponding response; and / or, Based on the information organization method, key information is extracted from the information constituting the response to construct a template skeleton. Under the semantic constraints of the template skeleton, the target model generates an extended language that has a contextual semantic relationship with the template skeleton. The template skeleton and the extended language are combined to generate a third candidate response. The template skeleton is a structured text framework that contains key information but does not contain a complete expression.

[0017] In one embodiment, selecting at least one candidate response as an interactive response includes: A relevance score is determined based on the semantic similarity between the candidate responses and the user's input text; An emotion matching score is determined based on the degree of matching between the selected responses and the response template style. The target length range is determined based on intent information and language preferences in user profiles. The appropriate length score is determined by calculating the deviation of the text length of the candidate responses from the target length range. The professionalism score is determined by examining the completeness of professional information and the standardization of terminology in the candidate responses. The relevance score, sentiment matching score, appropriate length score, and professionalism score are weighted and combined to obtain the comprehensive score of each candidate response. The multiple candidate responses are sorted according to their overall scores, and at least one candidate response with the highest overall score is selected as the interactive response for display.

[0018] To address the aforementioned technical problems, a second aspect provides a response generation apparatus, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps: the processor executes the computer program to perform the steps of the method described in the first aspect.

[0019] In order to solve the above-mentioned technical problems, in a third aspect, this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in the first aspect.

[0020] Unlike existing technologies, this application obtains and analyzes user input text to acquire intent information, emotional information, and product keywords, accurately identifying the user's current needs, emotional state, and core concerns, providing a precise input foundation for subsequent response generation. It ensures the completeness, accuracy, and professionalism of the response content by retrieving response composition information from a pre-set knowledge base based on intent information and product keywords. It determines the information organization method of the response composition information based on the matching results between product keywords and the pre-set product information database, enabling flexible adjustments to the organization strategy based on the matching situation. By acquiring user preferences, it determines the response template style based on emotional information and user preferences, integrating the user's emotional state and expression habits to ensure the response meets both the user's emotional needs and expression preferences. It generates multiple candidate responses based on the response composition information, information organization method, and response template style, achieving multi-element collaborative control and generating rich candidate responses, providing users with a choice. Finally, it selects at least one candidate response as the interactive response, improving response accuracy and user satisfaction. Attached Figure Description

[0021] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart of the response generation method in one embodiment; Figure 2 This is a flowchart illustrating the response generation method in another embodiment; Figure 3 This is a schematic diagram of the response display interface in one embodiment; Figure 4 This is a structural block diagram of a response generation device in one embodiment; Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0023] To make the objectives, technical methods, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0024] In one embodiment, such as Figure 1 As shown, a response generation method is provided, which includes the following steps: Step 101: Obtain and analyze user input text to obtain intent information, sentiment information, and product keywords.

[0025] User input text can be obtained through the chat window of communication tools (such as WhatsApp, WeChat Work, etc.).

[0026] To ensure the accuracy and integrity of the text, the screen can be periodically captured, and the captured images can be used for text recognition to obtain the user's input text. For example, the screen image of the chat area can be captured at a preset period (such as 5 seconds), and irrelevant characters in the image (such as meaningless text generated by input errors, advertising logos, etc.) can be filtered out through a multi-threshold noise reduction algorithm. Then, a high-precision text recognition engine can be used to extract the user's input text.

[0027] After obtaining user input text, the user input text is fed into a language model to determine product keywords and intent information; the user input text is then fed into a convolutional neural network to perform emotion recognition and obtain emotion information.

[0028] For example, the language model could be the BERT model, specifically bert-base-chinese. The language model includes embedding layers, encoding layers, classification layers, and sequence labeling layers. This model can contain a 12-layer Transformer encoder, 768 hidden layers, 12 attention heads, and approximately 110 million parameters. Based on pre-training on general Chinese corpora (such as Chinese Wikipedia), it can be further fine-tuned using business data from trade communication scenarios to adapt to the intent classification task in this field.

[0029] User input text can be fed into the input embedding layer of the BERT model. The model first segments the user input text, converting each word into a corresponding word embedding vector with a dimension of 768. Simultaneously, a positional embedding vector is added to each word to represent its position within the input sequence, preventing the self-attention mechanism from losing sequence order. The positional embeddings are learned during model pre-training and have the same dimension as the word embeddings. A segmental embedding vector is then added to each word to distinguish different segments in the input sequence; for single-sentence input scenarios, all words share the same segmental embedding. The word embedding vectors, positional embedding vectors, and segmental embedding vectors are element-wise summed to form the model's input vector, with a dimension of [sequence length × 768], which serves as the input to the subsequent Transformer encoder.

[0030] The input vector is sequentially passed through a 12-layer Transformer encoder. Each encoder layer contains a multi-head self-attention mechanism and a feedforward neural network. The multi-head self-attention mechanism uses 12 attention heads to compute the association weights between words in the text in parallel, enabling the model to capture long-distance dependencies; the feedforward neural network performs a non-linear transformation on the attention output to extract higher-level semantic features. After layer-by-layer computation by the 12 encoder layers, the model outputs a contextual semantic representation vector of the text, with dimensions of [sequence length × 768].

[0031] The vector corresponding to the [CLS] marker in the context semantic representation vector output by the encoder (this vector aggregates the semantic information of the entire sequence) is used as the overall representation of the text and input into the classification layer. The classification layer consists of a fully connected layer and a softmax function, mapping the 768-dimensional semantic representation to a multi-dimensional intent category space and outputting the probability distribution of each intent category. The category with the highest probability is selected as the final intent information output. For example, when a user inputs "I want to buy an excavator", the model calculates that the probability of the "inquiry" category is 0.92, so the output intent information is "inquiry".

[0032] The contextual semantic representation vector can be input into the sequence labeling layer, which outputs a label for each word position in the input sequence. The label identifies whether the word is part of a product keyword. Continuously labeled entity words are extracted as product keywords. Specifically, the model outputs information for each word in the input sequence, with information types including B-product, I-product, B-model, I-model, B-price, I-price, and O (irrelevant). By extracting continuously labeled entity words, a list of product keywords is obtained. For example, from "I want to buy a SY215C excavator," the model labels "SY215C" as "B-model" and "excavator" as "B-product," extracting the product keywords as "SY215C" (model) and "excavator" (product category).

[0033] Convolutional neural networks (CNNs) can be used to perform emotion recognition on user-input text to obtain emotional information. For example, a TextCNN model (a deep learning model that applies CNNs to text classification tasks) can be used. Its embedding dimension can be 300 (using Word2Vec pre-trained word vectors), the convolutional kernel size can be [2,3,4,5]-gram, the number of each type of convolutional kernel is 100, the total number of features is 400, the dropout rates are 0.5 and 0.3 respectively, the hidden layer activation function can be ReLU, the output layer activation function can be Sigmoid, and the loss function can be BinaryCrossEntropy.

[0034] The user input text can be segmented into a word sequence [w1, w2, ..., wn]. Each word is mapped to a low-dimensional, dense vector representation using a pre-trained word embedding layer (e.g., 300-dimensional word vectors trained on a large corpus using Word2Vec). After processing, the text of length n is transformed into an input matrix of dimension n × 300, where each row corresponds to the semantic vector of a word.

[0035] The obtained input matrix is ​​fed into the convolutional layer. To capture local semantic patterns of different lengths (granularities), convolutional kernels of various sizes can be used for parallel convolution operations. Specifically, convolutional kernels of sizes 2, 3, 4, and 5 are selected to extract 2-gram, 3-gram, 4-gram, and 5-gram continuous word sequence features, respectively. For example, a convolutional kernel of size 3 covers the word vectors of three consecutive words at a time, and the semantics of the combination of these three words are represented through convolution operations. To fully capture diverse emotional expressions, 100 convolutional kernels of each size are set. Each convolutional kernel performs sliding window calculation on the input matrix to extract local n-gram features (local semantic features). For example, a 3-gram convolutional kernel covers the word vectors of three consecutive words at a time, and the local semantic features of the combination of these three words are extracted through convolution operations. After the convolution operation, each kernel size produces 100 feature maps. Each feature map represents a specific local pattern in the text that is related to a certain emotion (such as very good, not so good, eagerly want, etc.). The dimension of each feature map is the sequence length minus the kernel size plus 1.

[0036] To extract the most critical signals from each feature map and address the issue of inconsistent user input text length, max pooling is performed on each feature map, which involves taking the maximum value from all values ​​in that feature map. This maximum value represents the strongest emotional feature captured by the convolutional kernel in the entire text. After pooling, the 400 feature maps become 400 pooled values. Concatenating these values ​​forms a 400-dimensional global feature vector, which represents the emotional representation of the entire user input text.

[0037] Before inputting the feature vector into the fully connected layer, a Dropout layer can be used to randomly discard some neurons with a certain probability (e.g., 0.5 and 0.3). This effectively prevents the model from over-relying on certain specific features and improves generalization ability. The 400-dimensional feature vector is then input into the fully connected layer and, with the help of activation functions such as ReLU, undergoes a non-linear transformation to map it to a predefined sentiment category space.

[0038] For multi-label emotion recognition tasks (where a text may contain both excitement and urgency), the output layer uses the sigmoid activation function to output an independent probability value P, ∈ [0, 1], for each emotion category, representing the confidence level of that emotion. During training, the convolutional neural network model can use binary cross-entropy as the loss function to optimize the model parameters. Since this task involves multi-label classification, binary cross-entropy can independently measure the prediction error of each emotion category, making it more suitable than multi-class cross-entropy.

[0039] For example, the output of the Sigmoid layer can be binarized according to a preset threshold (such as 0.5), and at least one emotion category with a probability higher than the threshold can be used as the output emotion information. For instance, when a user inputs "I want to buy an excavator!!", the model outputs "excitement" with a probability of 0.85, "eagerness" with a probability of 0.72, and "neutrality" with a probability of 0.12, so the output emotion information is "excitement" and "eagerness".

[0040] It is understood that intent information may include awareness tags obtained from user input text and / or intent text contained within user input text, and emotion information may also include emotion tags obtained from user input text and / or emotion text contained within user input text, without limitation.

[0041] In one embodiment, the response generation method provided in this application further includes: determining whether a user profile exists in the cache; in response to the existence of a user profile in the cache, loading the user profile from the cache; in response to the absence of a user profile in the cache, loading the user profile from the database and writing the user profile into the cache, and determining a response strategy that matches the user profile.

[0042] Specifically, when retrieving a user's profile, the system first checks if the user's profile data exists in the Redis cache. If it doesn't exist (i.e., it's the first time accessing the database or the cache has expired), it queries the user's profile information from the MySQL database, writes the query result to the Redis cache, and sets the TTL to 24 hours. Within the next 24 hours, when accessing the user's profile again, it is read directly from the Redis cache without needing to query the database again.

[0043] The determination of response strategies matching user profiles includes: responding to user profiles including historical intents, determining the activity level and dispersion of various historical intents, determining the tone of the response based on the activity level of historical intents, determining the guidance method of the response based on the dispersion of historical intents, and incorporating tone and guidance method into the response strategy; and / or, responding to user profiles including product preferences, determining the preferred product types based on the distribution characteristics of product preferences, and incorporating the preferred product types into the response strategy; responding to user profiles including language preferences, determining the language style of the response based on the type of language preference, and incorporating the language style into the response strategy; and / or, responding to user profiles including interaction frequency, determining the guidance strength and information density of the response based on the interaction frequency index, and incorporating the guidance strength and information density into the response strategy; and / or, responding to user profiles including user levels, determining the priority of response generation methods based on user levels, and incorporating the priority of generation methods into the response strategy, where the priority of generation methods is the order in which different generation methods are selected when generating a response.

[0044] User profiles can be obtained by analyzing users' historical interaction behavior. User profiles include information from multiple dimensions such as historical intent, product preferences, language preferences, interaction frequency, and user value level.

[0045] Among them, historical intent is a record of the types of intents that users have shown in past interactions, including inquiries, technical consultations, complaints, order guidance, casual conversations, etc., with an accompanying time decay weight.

[0046] Product preferences are the product categories and their weight distribution that a user focuses on in their historical interactions, reflecting the degree of interest a user has in specific product types. Product preferences can be obtained by extracting entities from a user's historical chat logs.

[0047] Language preference refers to the tendency of a user's language expression in their historical interactions, reflecting their preferred language style and expression methods. Language preferences can be obtained by analyzing the language style of a user's historical messages. Specifically, language preferences can include concise (users prefer short sentences and direct expression), detailed (users prefer long sentences and complete expressions), technical (users prefer technical jargon and technical details), and colloquial (users prefer everyday expressions and conversational language).

[0048] Interaction frequency refers to the number of times a user interacts with the system and the speed of their response within a certain time window, reflecting the user's activity level and responsiveness. The interaction frequency index can be obtained by statistically analyzing user interaction behavior within a preset window (such as the last 30 days).

[0049] User value rating refers to a user's overall rating based on their historical value, interactive behavior, and potential value. It is used to guide the selection of response strategies and can be specifically divided into high-value users, ordinary users, and new users.

[0050] By selecting historical intent records from the most recent N sessions (e.g., the most recent 10 sessions) or the most recent M days (e.g., the most recent 30 days), and traversing each interaction within the statistics window in chronological order (from most recent to oldest), the decay factor for each interaction can be calculated. The longer the time elapsed, the smaller the decay factor. For each type of intent, the corresponding decay factor at the time of its occurrence is summed to obtain the activity level of that type of intent.

[0051] Intent activity is used to measure the weighted activity of a specific intent category over a time series, with more recently occurring intents given higher weights and earlier intents given lower weights.

[0052] The specific formula for calculating intent activity is as follows: ; Among them, Active(I j ) represents the activity score of the j-th intent, N represents the total number of interactions within the statistics window, and w t This represents the weight of this type of intent in the t-th interaction (if the intent of this interaction is I). j Then w t =1, otherwise w t =0), indicating an attenuation coefficient (e.g., 0.8), 0 < α < 1, d t This represents the difference in days or order between the t-th interaction and the current time.

[0053] Tone of voice refers to the emotional tone to be used in a response, including reassuring, efficient, professional, and exploratory tones. For example, if complaints, order reminders, or after-sales service intentions are more active in the historical intent statistics, it indicates that the user is expressing significant negative emotions. In this case, the tone of voice in response should be reassuring, expressing apology, understanding, and commitment to handling the issue. Similarly, when inquiry or comparison intents are more active, the tone of voice should be efficient, providing information directly and concisely. When technical consultation intents are more active, the tone of voice should be professional, using technical terminology and data-supported expressions. When historical intents are more dispersed, the tone of voice should be exploratory, using open and friendly expressions to guide users to clarify their needs.

[0054] Intent dispersion is an index of the degree of dispersion of intent distribution obtained after statistical analysis of historical intents, reflecting the concentration or dispersion of user intents. Entropy calculation or variance analysis can be performed on the distribution of historical intents. If the proportions of various intents are similar, the intent dispersion is high; if a certain type of intent dominates, the intent dispersion is low.

[0055] The specific formula for calculating intent dispersion is as follows: ; Where H represents the intent dispersion (entropy value), k represents the total number of intent categories, and p i This represents the frequency (percentage of occurrences) of the i-th type of intent within the statistical window.

[0056] Guidance methods refer to the ways in which users are guided to further interaction during the response process. These include quick processing guidance, direct answer guidance, and need confirmation guidance. When the historical intent dispersion is low (i.e., there is a dominant intent), the guidance method is determined to be the one that matches the dominant intent. For example, complaint intent corresponds to quick processing guidance (promising a solution and giving a time limit), and inquiry intent corresponds to direct answer guidance (directly giving a price or information). When the historical intent dispersion is high (i.e., the user's intent is ambiguous), the guidance method is determined to be need confirmation guidance (multiple rounds of follow-up questions and clarification of needs).

[0057] Entity extraction can be performed on users' historical chat logs to identify and extract product-related entity information, including product name, model, tonnage, brand, budget range, and applicable working conditions. The frequency of users mentioning various products within a preset window is counted, and product preference scores are calculated by combining time decay weights to obtain product preference distribution characteristics, such as "excavator: 0.8, loader: 0.3, crane: 0.1".

[0058] Product preferences reflect a user's level of interest in specific product types, and their distribution characteristics include concentration and weight distribution. Product preferences are used to determine the preferred product types for recommendation. When the preference weight of a certain product category is higher than a preset threshold, that product category is determined to be the preferred product type, and products of that category are recommended in subsequent responses. When the preference weights of all product categories are lower than the preset threshold, popular products are prioritized for recommendation, or users are guided to explicitly state their preferences.

[0059] Language style analysis can be used to identify language preference types in user profiles. Specifically, language style analysis can be performed on user historical messages to identify features such as sentence structure, word choice habits, and level of detail in expression, thereby analyzing the user's expressive tendencies. Language preference types include concise, detailed, technical, and colloquial.

[0060] Language preference is used to determine the language style of a response. Language style refers to the sentence structure, vocabulary preferences, and level of detail in the response, including concise, detailed, technical, and colloquial styles. When the language preference is concise, the language style is determined to be short sentences with minimal modifiers, prioritizing short sentence templates; when the language preference is detailed, the language style is determined to be long sentences with background information, prioritizing detailed explanation templates; when the language preference is technical, the language style is determined to be rich in technical terminology and complete parameters, prioritizing technical terminology templates; when the language preference is colloquial, the language style is determined to be colloquial expressions and analogies, prioritizing colloquial templates.

[0061] Interaction frequency index can be obtained from user profiles through interaction behavior statistics. Specifically, the number of user interactions and average response time within a preset window (e.g., the last 30 days) can be counted. The number of interactions reflects the user's activity level, and the average response time reflects the user's responsiveness. Based on the above statistics, the interaction frequency index is calculated to determine the guidance strength and information density of the response, which measures the user's activity level and responsiveness.

[0062] The guidance intensity refers to the degree to which guiding statements are used in responses, categorized into high, medium, and low levels. When the interaction frequency index is higher than a preset threshold, the user is identified as a high-frequency user, and the guidance intensity is set to low, reducing repetitive greetings and guiding phrases. When the interaction frequency index is lower than the preset threshold, the user is identified as a low-frequency user, and the guidance intensity is set to high, increasing caring phrases and relationship-maintaining content. Information density refers to the amount of information contained in a unit of response, also categorized into high, medium, and low levels. When the interaction frequency index is higher than the preset threshold, the information density is set to high, directly providing high-density information. When the interaction frequency index is lower than the preset threshold, the information density is set to low, providing information in stages to avoid information overload. Furthermore, when the average response time is lower than a preset threshold, the user is identified as a response time-sensitive user, and template generation is prioritized to accelerate response speed.

[0063] User value levels within a user profile can be determined through a weighted comprehensive score. Specifically, a comprehensive user value score is calculated based on dimensions such as historical value (e.g., historical purchase amount, purchase frequency), interactive behavior (e.g., interaction frequency, response speed), and potential value (e.g., attention to high-value products, inquiry depth). Based on this comprehensive score, users are categorized into high-value users, ordinary users, and new users.

[0064] User value level is used to determine the priority of response generation methods. Generation method priority determines the order in which different generation methods are selected when generating responses. Specifically, for high-value users, the priority is AI (Artificial Intelligence) generation > template filling > greeting / guided response, prioritizing the use of more personalized AI generation methods to provide customized services; for ordinary users, the priority is template filling > AI generation > greeting / guided response, prioritizing the use of standardized templates combined with rule-based filling to achieve a balance between personalization and efficiency; for new users, the priority is greeting / guided response > template filling > AI generation, prioritizing the use of greetings plus guidance to establish trust and guide the expression of needs.

[0065] In this way, the various pieces of information included in the user profile are processed and combined to form a complete response strategy, which guides subsequent response generation. The response strategy specifically includes tone, guidance method, priority product types recommended, language style, guidance intensity, information density, and priority of generation methods. These collectively define the strategic direction of response generation, ensuring that the response content matches the user characteristics in terms of tone, style, information content, and generation method.

[0066] For example, for a high-value user whose historical intent is primarily price inquiries and is focused, whose language preference is concise, and whose interaction frequency is high, the determined response strategy is: a highly efficient tone, direct guidance, priority for recommending user-preferred products, concise language style, low guidance intensity, high information density, and AI-generated priority. Responses generated based on these strategy parameters will be concise, efficient, and direct, with AI generation prioritized to ensure personalization.

[0067] Step 102: Retrieve response composition information from a preset knowledge base based on intent information and product keywords.

[0068] Obtain a preset mapping relationship table, and select a preset knowledge base that matches the intent information as the target knowledge base based on the preset mapping relationship table. The preset mapping relationship table stores the mapping relationship between intent information and preset knowledge base types. The preset knowledge base includes at least one of product information base, industry knowledge base, and common questions base. Retrieve the answer composition information in the target knowledge base based on product keywords.

[0069] A pre-built knowledge base can be a pre-constructed collection of structured or semi-structured knowledge used to store various types of business information for retrieval and retrieval. Specific pre-built knowledge bases may include product information bases, industry knowledge bases, frequently asked questions bases, and answer template bases.

[0070] The product information database stores structured information related to products, typically in the form of a relational database (such as MySQL). Basic product information (product ID, product name), product specifications (product model, brand, technical parameters), product pricing information, and product status information (product inventory status, applicable operating conditions, image links, etc.) can be retrieved from the product information database.

[0071] For example, the product ID is P10001, the product name is excavator, the model is SY215C-9, the brand is Sany, the technical parameters are weight 21.5 tons, power 118 kilowatts, the price is FOB Shanghai 38,000 USD, the inventory status is in stock, and the applicable working conditions are earthwork engineering and mining.

[0072] An industry knowledge base is used to store industry-related professional knowledge, and can be stored in graph databases (such as Neo4j) or in document format. The industry knowledge base includes product-related trade terms, payment methods, quality standards, processes, after-sales service, and other information.

[0073] For example, the trade term FOB refers to Free On Board, where the seller is responsible for loading the goods onto the ship, and the buyer bears the subsequent freight and insurance costs; the payment method T / T refers to wire transfer, which is fast but expensive; the quality standard ISO9001 is an international quality management system certification; the process flow includes casting, machining, assembly, testing, and packaging, with a standard product production cycle of 15 days; the after-sales service warranty period is 2 years or 3000 hours, whichever comes first.

[0074] The FAQ database stores standard answers to frequently asked questions by users. It is usually stored in a cache (such as Redis) as key-value pairs to improve retrieval efficiency. It can retrieve question identifiers (question ID, question keywords, question description), standard answers to questions, and related products that match the user's input text from the FAQ database.

[0075] For example, the question ID is FAQ001, the question keywords are excavator and warranty, the question description is "How long is the warranty for an excavator?", the standard answer is "The standard warranty period is 2 years or 3000 hours, whichever comes first", the associated products are SY215C, SY60U, and SY375H, and the weight is 0.9.

[0076] The response template library (JSON file) includes tone templates (enthusiastic, relaxed, formal and rigorous, empathetic and patient), intent templates (inquiry scripts, complaint handling, order placement guidance), and scenario templates (greetings, closing remarks, follow-up scripts).

[0077] The target knowledge base is a preset knowledge base used for this retrieval, matched with the intent information. A mapping table between preset intents and knowledge base types is obtained. This mapping table pre-stores multiple intent entries, each corresponding to a knowledge base type. The intent information is matched against the intent entries in the mapping table, and the knowledge base type corresponding to the successful match is selected as the target knowledge base. The target knowledge base is thus the preset knowledge base matched with the intent information used for this retrieval. For example, when the intent information is a price inquiry, the product information database is selected for retrieval; when the intent information is a technical consultation, the industry knowledge base is selected; and when the intent information is a complaint, the frequently asked questions database is selected.

[0078] After determining the target knowledge base, a matching search is performed within the target knowledge base based on product keywords to obtain specific response information. Specifically, the search methods can include exact matching and fuzzy matching. When product keywords are specific product models, standard terms, or other explicit information, exact matching is used, directly locating the corresponding precise record in the target knowledge base. When product keywords are product categories, contain typos, or are incomplete, fuzzy matching is used, employing fuzzy matching algorithms or synonym expansion techniques to retrieve relevant product records or knowledge entries. For example, when the intent is an inquiry and the product keyword is "SY215C," exact matching retrieves the technical parameters (weight 21.5 tons, power 118 kW) and price information (FOB Shanghai $38,000) for that model in the product information base. When the intent is an inquiry and the product keyword is "excavator," fuzzy matching retrieves a list of all excavator models in the product information base, sorted by popularity. The retrieved information is then integrated into a structured response.

[0079] This application supports collaborative retrieval of multiple preset knowledge bases. When the target knowledge base corresponding to the intent information fails to retrieve valid information, other preset knowledge bases can be searched sequentially until the answer composition information is obtained or it is determined that there are no matching results. Simultaneously, it also supports parallel retrieval of multiple preset knowledge bases, merging search results from different sources to form more complete answer composition information. For example, when a user enters "How long is the excavator warranty?", the intent information is technical consultation. First, the industry knowledge base is searched to obtain relevant knowledge about the warranty period (2 years or 3000 hours); simultaneously, the FAQ base is searched in parallel to obtain standard answers from the FAQ for supplementary verification; finally, the search results from the two knowledge bases are integrated to form more complete answer composition information including professional explanations and standard answers. In this way, richer and more accurate answer composition information can be obtained, providing sufficient answer material support for subsequent answer generation.

[0080] Step 103: Determine the information organization method of the response based on the matching results of product keywords and the preset product information database.

[0081] Specifically, the system determines whether the product keywords match product records in a pre-set product information database. If the product keywords match, the system populates the response template with the required information. If the product keywords do not match, the system can use pre-set generic scripts to generate a guiding response, which guides the user to supplement their product needs. Alternatively, if the product keywords do not match, the system can skip generating a response, not output any response, and transfer the current conversation to a human customer service representative.

[0082] The system can match product keywords with product records in a pre-defined product information database. Matching methods include exact matching, fuzzy matching, and multi-entity matching. When the product keyword is a specific product model, exact matching is used. The database searches precisely for the model number; if a matching record exists, the match is successful; otherwise, it fails. When the product keyword is a product category or contains misspellings, fuzzy matching is used. Algorithms such as synonym expansion, pinyin matching, and edit distance calculation are employed. If the similarity exceeds a pre-defined threshold, the match is successful; otherwise, it fails. When the product keyword contains multiple information units, multi-entity matching is used. Each information unit is matched separately and the results are combined. If the model number matches successfully, the match is successful; if the model number fails to match but the product category matches successfully, it is considered a partial match.

[0083] Based on the matching results, the appropriate organization method is selected. Specifically, if the match is successful, a matching response template is selected from the response template library according to the language style and tone tendency in the response strategy. The response template is a pre-built response content framework, which includes fixed text and fillable variable placeholders. Then, the retrieved response composition information is filled into the variable placeholders of the selected template. The filled content includes product name, model, technical parameters, price, applicable working conditions, etc. Finally, a complete personalized response is generated.

[0084] If a match fails, a matching guiding script template is selected from the general script library based on the guiding method and tone tendency in the response strategy; then, based on the specific circumstances of the match failure, the content direction of the guiding response is determined. The guiding response is used to confirm the budget range, intended use, expected model range, or specific working condition information with the user; finally, a guiding response is generated.

[0085] In practice, the two organizational methods can be used in conjunction. When product keywords are determined to be a partial match, a hybrid organizational approach can be adopted. First, the matched product information is listed using a personalized organizational method, and then the user is guided to further clarify their preferences using a general organizational method. In this way, by selecting the most appropriate response organization method based on the specific user input, accurate information can be provided when the needs are clear, and effective guidance can be provided when the needs are ambiguous, thereby improving the relevance of the response and the efficiency of the interaction.

[0086] Step 104: Obtain user preferences and determine the response template style based on sentiment information and user preferences.

[0087] By analyzing users' historical chat logs, at least one of the following user preferences—product preference, language preference, and communication preference—can be identified as user preferences. The emotional type of the response can be determined based on emotional information. The emotional type characterizes the category of emotional expression used in the response, which includes at least one of the following: reassuring, enthusiastic, efficient, professional, or exploratory. The preferred expression style of the response can be determined based on user preferences. Finally, the response template style can be determined by combining the emotional type and expression style preferences.

[0088] Specifically, multidimensional analysis can be performed on the user's historical chat records within a preset window (such as the last 30 days or the last 50 interactions) to obtain user preferences, which include at least one of product preferences, language preferences, and communication preferences.

[0089] By extracting entities from historical chat logs, information such as product categories, tonnage, budget, and intended use mentioned repeatedly by users can be identified and extracted. The frequency of mentions for each product type can be statistically analyzed, and a product preference score can be calculated by combining this with a time decay weight. For example, if a user repeatedly mentions "excavator," "mini excavator," or "SY215C," then the preference score for excavator-related products is relatively high, indicating that the user's current product preference is for excavator-related products.

[0090] Language preferences reflect a user's preferred language type, formal or colloquial expression style, and sentence length preference, including concise, detailed, technical, and colloquial styles. By analyzing the language style of historical messages, characteristics such as sentence structure, word choice habits, and level of detail can be identified, revealing the user's expressive tendencies.

[0091] Historical interaction behavior can be statistically analyzed to understand how users respond to different types of responses. Specifically, the system can analyze user responsiveness to parameter-based responses (such as technical specifications), pricing-based responses (such as price information), and guiding responses (such as questions confirming needs) to determine which type of response the user prefers.

[0092] The emotional type and intensity of the response are determined based on emotional information. Emotional information may include emotional tags and emotional scores, where emotional tags represent the emotional category to which the user's current input belongs, and emotional scores represent the intensity of that emotional category (ranging from 0 to 1).

[0093] Based on the mapping rules between emotion labels and sentiment types, the sentiment type of the response is determined. Sentiment type is used to characterize the category of emotional expression used in the response, including reassuring, enthusiastic, efficient, professional, or exploratory.

[0094] For example, when the emotion label is dissatisfaction, anger, disappointment, or anxiety, the emotion type is determined to be reassuring, used to express apology, understanding, and commitment in the response; when the emotion label is excitement, joy, or gratitude, the emotion type is determined to be enthusiastic, used to express a positive and friendly attitude in the response; when the emotion label is urgency, tension, or eagerness, the emotion type is determined to be efficient, used to provide information directly and concisely; when the emotion label is neutral and the intended information is technical consultation, the emotion type is determined to be professional, used to express information using professional terminology and data support; when the emotion label is neutral and the intended information is ambiguous or casual, the emotion type is determined to be exploratory, used to guide the user to clarify their needs using open and friendly expressions.

[0095] The emotional intensity of a response is determined based on an emotion score. Emotional intensity controls the degree of emotional expression, and multiple intensity thresholds can be preset to divide the emotion score into different intensity ranges. For example, when the emotion score is greater than or equal to 0.7, it is determined to be a high intensity level, indicating that the user's emotions are very strong and a stronger emotional expression is needed in the response; when the emotion score is greater than or equal to 0.3 and less than 0.7, it is determined to be a medium intensity level, indicating that the user's emotions are moderate and a moderate emotional expression is needed in the response; when the emotion score is less than 0.3, it is determined to be a low intensity level, indicating that the user's emotions are weak and a mild emotional expression is needed in the response.

[0096] Based on the acquired user preferences, the preferred way of expressing responses is determined. This preference controls the sentence structure, word choice, and level of detail in the responses.

[0097] When the language preference is concise, the preferred expression style is short sentences with minimal modifiers, and short sentence templates should be used first. When the language preference is detailed, the preferred expression style is long sentences with background information, and detailed explanation templates should be used first. When the language preference is technical, the preferred expression style is rich in technical terms and complete parameters, and technical terminology templates should be used first. When the language preference is colloquial, the preferred expression style is everyday language and analogies, and colloquial templates should be used first.

[0098] Furthermore, the expression preferences can be adjusted based on communication preferences. If users respond positively to parameter-based responses, the expression preference will lean towards data-driven expression, adding technical parameters, performance data, and other content to the response; if users respond positively to price-based responses, the expression preference will lean towards price-priority expression, prioritizing price information in the response; if users respond positively to guiding responses, the expression preference will lean towards open-ended questions, adding guiding statements to the response.

[0099] The response template style is determined by combining the identified emotion type, emotion intensity, and expression preference. The response template style is a comprehensive reflection of these three factors, guiding the selection and generation of response templates in subsequent steps. For example, when the emotion type is reassuring, the emotion intensity is strong, and the expression preference is detailed, the determined response template style is a deeply reassuring style with detailed explanations, suitable for scenarios where the user is strongly dissatisfied; when the emotion type is efficient, the emotion intensity is moderate, and the expression preference is concise, the determined response template style is a concise and clear quick response style, suitable for scenarios where the user urgently inquires about prices; when the emotion type is professional, the emotion intensity is low, and the expression preference is technical, the determined response template style is an objective and rigorous technical explanation style, suitable for technical consultation scenarios; when the emotion type is enthusiastic, the emotion intensity is high, and the expression preference is popular, the determined response template style is a friendly and guiding style, suitable for scenarios where new users interact for the first time.

[0100] By following the steps above, a response template style that matches the user's historical preferences and current emotional state can be generated, laying the foundation for subsequent personalized response generation.

[0101] Step 105: Generate multiple candidate responses for the user's input text according to the response composition information, information organization method, and response template style, and select at least one candidate response as the interactive response.

[0102] The response strategy, response composition information, information organization method, and response template style can be used as preset dimensions; multiple preset generation methods can be obtained, and candidate responses can be generated according to different preset generation methods; among them, the preset dimensions selected when generating candidate responses by different preset generation methods are different.

[0103] Specifically, the preset generation methods can include the first type, the second type, and the third type, which correspond to the template filling generation method, the AI ​​model generation method, and the hybrid generation method, respectively.

[0104] When the preset generation method is Type 1, a template-filling generation method is adopted. First, based on the tone, language style, and response template style in the response strategy, a matching target response template is selected from the response template library. The target response template is a pre-built response content framework containing fixed text and fillable variable placeholders. Then, according to the determined information organization method of the response composition information, the variable placeholders in the target response template are identified. Variable placeholders are used to indicate the positions that need to be dynamically filled, and their names correspond to the field names in the response composition information. For example, variable placeholders can adopt a preset identifier format, such as {{field name}}, {field name}, or [field name], etc. Fields with the same name as variable placeholders are extracted from the response composition information as fill content. Specifically, the name of the variable placeholder is parsed, the field with the same name is searched in the response composition information, and the value corresponding to that field is read. The extracted fill content is used to replace the corresponding variable placeholder in the target response template to generate the first candidate response. The fill content is not limited to product name, model, technical parameters, price, applicable working conditions, etc. This generation method is suitable for scenarios that require standardized terminology and complete fields, such as quotation descriptions and parameter displays, and can ensure the accuracy and standardization of the response content.

[0105] When the preset generation method is type two, an AI model generation method is used. The contextual information, intent information, and sentiment information of the user's input text, the response strategy, the response template style, and the retrieved response composition information are all used as input to the target model. The target model refers to a generative model used to generate natural language responses, specifically a GPT series model. The contextual information includes at least the user's input text and corresponding responses from at least one round prior to the current user input text round, used to maintain the coherence and consistency of the dialogue. The target model uses a generative language model to generate a natural language response based on the input information, outputting a second candidate response. This method is suitable for scenarios where user expression is colloquial and context-dependent, and can generate natural-sounding and flexible responses.

[0106] Specifically, the system maintains a conversation cache queue, storing user input text and system-generated responses for each round in chronological order. When a new round of dialogue begins, the system retrieves the most recent p-round dialogue records (p > 1) from the cache queue, concatenates them chronologically, and uses them as context information. If the current conversation has fewer than p rounds, all existing dialogue records are retrieved, and a preset prompt word template is used to replace each variable with specific content values ​​to generate a complete model input. The preset prompt word template is a pre-designed text framework containing several variable placeholders. Context information, the current user input text, intent information, sentiment information, response strategy, response template style, and response composition information retrieved from the knowledge base are filled into the corresponding variable placeholders in the template to form the complete model user input text. The model user input text is then sent to the target model, which can be a GPT series large language model, using a word-by-word iterative autoregressive generation method. Specifically, the constructed model user input text is used as the initial sequence. Based on the current sequence, the model calculates the probability distribution of each word in the vocabulary through a softmax layer and selects the word with the highest probability as the next word. The generated words are appended to the end of the sequence to form a new sequence. The model continues to generate the next word based on the new sequence, and this process is repeated iteratively. Generation stops when the model generates a preset end marker or when the number of generated words reaches the set maximum length. All generated words are concatenated in the order they were generated to obtain the second candidate response.

[0107] When the preset generation method is type three, a hybrid generation method is adopted. First, based on the information organization of the response's constituent information, key information is extracted from the response's constituent information to construct a template skeleton. The template skeleton is a structured text framework containing key information but not a complete expression, such as "[Product Model] Price is [Price], Parameters are [Parameters]". Then, under the semantic constraints of the template skeleton, the target model generates extended language with contextual semantic relationships to the template skeleton. The extended language can include connectives, reassuring phrases, or guiding phrases, used to string together the key information in the template skeleton into a complete natural language expression. Finally, the template skeleton and the extended language are combined to form the third candidate response. This method combines the accuracy of template filling with the naturalness of AI model generation, ensuring both the accurate presentation of key information and improving the fluency of language expression.

[0108] Thus, this application can generate multiple different types of candidate responses, including template-filled versions, AI-generated versions, and hybrid generated versions. These candidate responses each have their own emphasis in terms of accuracy, naturalness, and flexibility, providing users with a diverse range of choices. Subsequently, the best response is selected for display through a scoring and ranking process.

[0109] In one implementation, scores can be calculated for multiple candidate responses, and at least one candidate response can be selected as the interactive response based on the scores.

[0110] First, a multi-dimensional score is calculated for each candidate response. The multi-dimensional score includes relevance score, sentiment matching score, appropriate length score, and professionalism score.

[0111] The relevance score measures the degree of match between the candidate response and the user's current needs. The relevance score can be calculated based on the semantic similarity between the candidate response and the user's input text; the greater the semantic similarity, the higher the relevance score.

[0112] The specific formula for calculating the relevance score is as follows: ; Scorerel = sim(R,Q) × 100; Where Scorerel represents the relevance score, ranging from 0 to 100, R represents the candidate response text, Q represents the user input text, sim(R,Q) represents the semantic similarity function, and V R V represents the semantic vector of the candidate response text. Q This represents the semantic vector of the user-input text. The semantic vector can be obtained by extracting the output vector at the [CLS] position from a language model (such as BERT).

[0113] Emotion matching score is used to measure the degree of fit between the emotional expression of the candidate response and the user's emotional state. The emotion matching score can be calculated based on the degree of matching between the candidate response and the response template style.

[0114] The specific formula for calculating the emotion matching score is as follows: ; Among them, Score emo The emotion matching score ranges from 0 to 100, where n represents the number of features related to the response template style, and w represents the number of features related to the response template style. l The m represents the weight of the l-th feature term. l This indicates the matching degree (0 or 1) of the l-th feature term.

[0115] When the response template style is reassuring, a higher emotion matching score is achieved if the response includes expressions of apology, understanding statements, or commitments to action; when the response template style is efficient, a higher emotion matching score is achieved if the response is direct, concise, and action-oriented; when the response template style is professional, a higher emotion matching score is achieved if the response includes technical parameters, data support, or professional terminology; and when the response template style is exploratory, a higher emotion matching score is achieved if the response includes open-ended questions or guiding statements.

[0116] The "Appropriate Length" score measures whether the length of the candidate response text meets the requirements of the current interaction scenario. The target length range is determined based on intent information and language preferences in the user profile. When the intent is an inquiry and the language preference is concise, the target length range can be set to a shorter range; when the intent is a technical consultation and the language preference is detailed, the target length range can be set to a longer range. The deviation of the candidate response text length from the target length range is calculated; the smaller the deviation, the higher the "Appropriate Length" score. If the candidate response text length is within the target length range, it receives full marks; if it exceeds or falls short, points are deducted according to the degree of deviation.

[0117] The specific formula for calculating the appropriate length score is as follows: ; Among them, Score len The score indicates a moderate length, ranging from 0 to 100. L represents the actual length (number of characters) of the candidate response text. opt This represents the optimal length of the target length interval, and the penalty coefficient (e.g., 50).

[0118] The professionalism score measures the completeness of professional information and the standardization of terminology in the candidate responses. The score is calculated by examining the completeness of professional information and the standardization of terminology in the candidate responses. Completeness of professional information is assessed by checking whether the candidate responses contain product models, technical parameters, prices, operating conditions, or service information corresponding to the current intent; the more complete the information, the higher the score. Standardization of terminology is assessed by checking whether the use of professional terminology in the candidate responses is accurate and standardized; conforming to industry standards results in a higher score.

[0119] After scoring each dimension, the relevance score, sentiment matching score, appropriate length score, and professionalism score are weighted and merged to obtain a comprehensive score for each candidate response. The weight of each scoring dimension can be dynamically configured according to the business scenario. For example, in a technical consultation scenario, the weight of the professionalism score can be increased, and in a complaint handling scenario, the weight of the sentiment matching score can be increased.

[0120] Multiple candidate responses are sorted from highest to lowest based on their overall score. The response with the highest overall score is then selected as the interactive response and displayed. The display can be presented as a list, allowing the user to choose or directly use the highest-scoring response. This scoring mechanism selects the response that best matches the user's needs, best reflects their emotional expression, is most appropriate in length, and demonstrates the highest level of professionalism, thus improving response quality and user experience.

[0121] Please see Figure 2 In one specific implementation, the response generation method provided in this application can be as follows: S1: Acquire and analyze user input text to obtain analysis results, including intent information, sentiment information, and product keywords.

[0122] S2: Load user profiles. User profile data includes historical intent, product preferences, language preferences, and interaction frequency.

[0123] When retrieving a user's profile, the system first checks if the user's profile data exists in the Redis cache. If it doesn't exist (i.e., it's the first time accessing the database or the cache has expired), it queries the MySQL database for the user's profile information, writes the query result to the Redis cache, and sets the TTL to 24 hours. Within the next 24 hours, subsequent accesses to the user's profile will retrieve it directly from the Redis cache without needing to query the database again.

[0124] The cache expiration time starts from when the data is written to Redis. After 24 hours, the cached key-value pair automatically expires and is deleted. User profile data is valid in the cache for 24 hours; after 24 hours, it needs to be reloaded from the database.

[0125] When user profile data changes (e.g., when a user makes a new interaction), the system needs to synchronously update the MySQL database and Redis cache, and reset the TTL to 24 hours to ensure that the profile data in the cache remains up-to-date.

[0126] S3: Determine the response strategy based on user profiles.

[0127] S4: Query from the knowledge base, which includes a product information database (MySQL), a frequently asked questions (FAQs) database (Redis), and a response template library (JSON files). The FFAs database stores standard answers to frequently asked user questions to improve retrieval efficiency. Based on product keywords or intent information, the system performs a matching search within the FFAs database. When a user's input question matches a keyword in the FFAs database, the system directly returns the corresponding standard answer as part of the response's structure. The response template library stores various response templates for use in subsequent response generation. The product information database stores structured information related to the product and performs matching searches based on product keywords.

[0128] The knowledge base in this application supports full-text search and can call data from the Redis cache layer through the knowledge base API to achieve fast front-end response.

[0129] S5: If a matching product keyword is found, construct the response content; if no matching product keyword is found, use a generic response and then construct the response content.

[0130] S6: Determine the content of the response template based on emotional information and user preferences.

[0131] S7: Determine whether to use an AI model to generate a response.

[0132] If used, GPT / local LLM is invoked to generate personalized content; if not used, template variables are populated based on rules to generate a templated response. That is, it determines whether to use an AI model to generate a response and determines the type of response generation. The type of generation includes at least one of AI generation, template generation, and hybrid generation.

[0133] S8: Generate multiple candidate responses (e.g., AI-generated responses, template-generated responses, and responses generated using a hybrid approach).

[0134] S9: Perform a quality check on the generated response.

[0135] Specifically, this can include length checking (determining the length of the content text, ensuring it does not exceed 500 characters, and if it does, truncating it to 500 characters). Sensitive word check: Determine if sensitive words are included, and filter / replace sensitive words. Syntax check: Determine if there are any syntax errors, and correct them if they are found. S10: Calculate the scores of the candidate responses, and select at least one candidate response as the interactive response based on the scores.

[0136] S11: Provides a one-click copy button and a customizable edit box, allowing users to flexibly select, edit, and send replies. After a user sends a reply, the system logs the information, performs anonymization processing, updates the user profile, and synchronously saves the updated data to the MySQL database and Redis cache.

[0137] Taking the procurement of construction machinery as an example, this paper provides a detailed explanation of the method for generating a response to this application.

[0138] Example 1: A user inquired via WhatsApp, "I want to buy an excavator," and the data processing layer identified the intent as "excavator procurement." The system retrieved various excavator models from the construction machinery knowledge base, such as SY215C-9, SY60U, and SY375H, along with their corresponding tonnage, power, and FOB price. The system provided two types of responses to this intent: A professional-style response: Using parameters from the knowledge base, the response reads, "We have several excavator models to choose from (e.g., SY215C-9: 21.5t / 118kW / FOB Shanghai $38,000; SY60U: 6t / 40.9kW / FOB Guangzhou $15,200; SY375H: 37.5t / 213kW / FOB Qingdao $72,500). Which type of work are you more interested in?"

[0139] A friendly response would be generated: "Which excavator's configuration and price would you like to know? I can compile it for you right away," emphasizing a willingness to help the user.

[0140] The candidate responses are displayed in the user interface. Users can click the one-click copy button to paste them into the response box and make appropriate modifications according to the actual situation before sending.

[0141] Example 2: When a user asks, "With a limited budget, could you recommend a suitable mini excavator?", the system identifies the intent as "inquiry + mini excavator purchase" and the sentiment label as "cautious." The system retrieves information on lower-priced mini excavators from its knowledge base, generates a professional-style response listing specific models and prices, and a friendly response inquiring about the user's power or intended use preferences. Because the sentiment is cautious, the system automatically selects a more friendly response template. Users can customize a third response template on the interface, such as a more humorous or concise style, and save it for later use.

[0142] This application provides multiple response styles based on intent and emotion, reflecting both professionalism and friendliness to improve user satisfaction; it can automatically populate knowledge base information, reducing manual search and editing time; and it supports user-defined response templates to adapt to different business scenarios; at the same time, it can work in conjunction with intent analysis and user profile update modules to achieve a closed loop from understanding to response.

[0143] Please see Figure 3 This provides a schematic diagram of the response display interface.

[0144] The Vue 3 front-end interface in this application includes a top toolbar (for switching platforms, settings, and help), a main interface area, a chat window on the left, and an AI assistant panel on the right.

[0145] The left-hand chat box displays the intelligent recognition results, which are the extracted information, including the user's text and the system's response text.

[0146] The AI ​​assistant panel on the right includes three categories of labels (intelligent reply, user profile, and history).

[0147] The intelligent reply label displays the intent recognition results, sentiment analysis results, and the specific content of at least one reply. Users can flexibly select, edit, and send replies using a one-click copy button and a custom edit box. After a user sends a reply, the system logs and performs anonymization processing, updates the user profile, and synchronously saves the updated data to a MySQL database and a Redis cache.

[0148] User profile tags can include basic user information, which can be displayed in the form of a user profile. It also includes a dynamic weight display of user tag clouds, such as reviews, foreign trade, and high-value churn risk, and can show whether each dynamic weight is trending upwards or downwards. It also includes interaction history (first contact time, last interaction time, total number of interactions).

[0149] The History tab displays the chat history.

[0150] In one implementation, acquiring and analyzing user input text to obtain intent information, emotion information, and product keywords may include: S101: Obtain user input text.

[0151] In this embodiment, user-input text can be actively collected or passively received.

[0152] Taking message interaction scenarios as an example, the raw text content input by the user can be collected to complete the acquisition of user input text. This user input text can be text content directly entered by the user, or text content converted from user input voice messages, video messages, etc., or text content obtained by converting multimodal data input by the user; no specific limitations are imposed here.

[0153] S102: Use a semantic analysis system to identify and filter redundant text in the user input text to obtain key text, and perform intent judgment on the key text to obtain the interaction intent; among them, redundant text represents text content that has semantic discontinuities with the target industry scenario.

[0154] In this embodiment, a pre-set or pre-trained semantic analysis system can be used to perform semantic screening on the complete user input text. This identifies redundant text that may be semantically disconnected from the target industry scenario and has no practical interactive value. Redundant text is then filtered out, and the relatively core and effective key text within the user input text is extracted. It is easy to understand that redundant text can be considered as content that is detached from the business scenario, semantically fragmented, and invalid, which may pose a risk of interfering with the accuracy of subsequent interaction recognition. By relying on a semantic analysis system to perform semantic parsing and intent determination on the simplified key text, the accuracy of identifying the user's true interaction needs can be improved, and the reliability of the output interaction intent can be enhanced.

[0155] S103: Use a sentiment analysis model to identify the sentiment of the target text to obtain the interactive sentiment; wherein, the target text includes user input text and / or key text.

[0156] In this embodiment, either the user-input text or the key text, or a combination of both, can be selected as input to the sentiment analysis model. At least one of the user-input text or the key text is used as the target text for sentiment analysis. The model leverages its sentiment recognition logic to capture emotional expression features within the text, thereby determining the user's emotional tendency and quantifying the user's current interactive emotions.

[0157] S104: Generate intent tags that match the interaction intent, and generate emotion tags that match the interaction emotion.

[0158] In this embodiment, based on the identified interaction intent, corresponding intent tags can be automatically generated according to preset tagging specifications; simultaneously, based on the parsed interaction emotion, corresponding emotion tags are generated. This dual-tag annotation method categorizes the user input text into its demand and emotional attributes.

[0159] Therefore, this embodiment, at least when performing intent analysis on user input text, can identify text content within the user input text that has semantic gaps with the target industry scenario, treating it as redundant text. It can be assumed that redundant text in the target industry scenario typically lacks substantial content, thus filtering it from the user input text to obtain key text. This simplifies the text content to be identified and extracts effective information, thereby improving the reliability of intent analysis and identification. Specifically, it can identify and filter interfering information within the user input text that is inconsistent with the actual intent, thus enhancing the reliability of content analysis. Furthermore, using key text for sentiment analysis can also reduce noise interference. Simultaneously, sentiment analysis can be performed using user input text to reduce the risk of filtering out emotionally expressive words.

[0160] In one embodiment, user-input text can be obtained.

[0161] Taking the user-input text as an example of image recognition, the following is an example of how it is obtained.

[0162] It can acquire an image containing user-input text to be recognized. For example, an image acquisition unit can capture a scene containing the text to be extracted, forming a complete image to be recognized, within which the user-input text can be contained.

[0163] This method can detect text-generating regions within an image that match regional features. These regional features include at least one of text box features, font features, language arrangement features, and background features. In other words, this embodiment can pre-configure various regional features adapted to the target recognition scenario, and rely on feature matching algorithms to perform a full-domain search and comparison of the image to be recognized, accurately locating text-generating regions containing text content within the image. It is easy to understand that features such as text box outlines, font styles, text layout, and background can all distinguish text regions from blank background regions, thereby achieving rapid and accurate text region locking and narrowing the processing scope for subsequent text recognition.

[0164] Furthermore, a pre-defined corpus of the target industry scenario can be used to assist in character recognition of the text region to obtain the initial text. The pre-defined corpus includes at least one of industry terminology, product information, and multilingual mixed text. Text metrics of the initial text can be evaluated, and these metrics can be used to filter the initial text to obtain the user input text. These text metrics include at least one of the following: matching degree with the target industry scenario, semantic continuity of the initial text, and character confidence.

[0165] In other words, collaborative text recognition is performed on the identified text generation areas using a pre-built corpus corresponding to the target industry scenario. By leveraging industry-specific terminology, product-related materials, and multilingual text samples, the adaptability of text recognition is optimized, reducing errors in recognizing technical terms and special expressions, thereby extracting the original initial text content from the text generation areas. The generated initial text is then comprehensively evaluated using multi-dimensional metrics, verifying the text's relevance to the target industry scenario, the semantic coherence of the sentence context, and the reliability of single-character recognition. Based on the evaluation results of these text metrics, invalid content with recognition errors, semantic breaks, and poor industry adaptability can be relatively effectively eliminated, purifying the initial text and ultimately yielding standardized user input text suitable for subsequent analysis and processing.

[0166] In response to acquiring user input text, a semantic analysis system can be used to identify whether the user input text contains redundant text.

[0167] In response to the semantic analysis system failing to identify redundant text, the system uses the semantic analysis system to determine the user's input text and thus obtain the interaction intent. The principle behind determining intent from user input text is similar to that from key text; please refer to the section on the principle of intent determination from key text later, which will not be elaborated upon here.

[0168] In response to the semantic analysis system identifying redundant text, the redundant text is filtered out.

[0169] Optionally, the semantic analysis system includes a semantic analysis model. User input text can be fed into the semantic analysis model. The model identifies industry keywords related to the target industry scenario within the user input text. Semantic analysis is performed on the user input text to determine its semantic continuity. Text content with semantic breaks from the industry keywords is considered redundant text. Redundant text is then removed from the user input text to obtain the key text. Here, redundant text refers to text content with semantic breaks from the target industry scenario.

[0170] In other words, a semantic analysis system can use a trained semantic analysis model as a processing unit. User input text is fed into a sentiment analysis model, which then identifies industry-specific keywords relevant to the target industry scenario. Based on keyword relationships, the system assesses the contextual coherence of the entire text, identifying redundant text fragments that are logically disconnected from industry keywords or semantically fragmented. Redundant text is then removed to retain only the valid information fragments in the user input text, thereby improving the conciseness and semantic integrity of the key text used for intent recognition.

[0171] Optionally, the semantic analysis system may also include an intent output layer and a joint discriminator.

[0172] Key text can be transmitted to the intent output layer and the joint discriminator. The intent output layer, combined with industry keywords within the key text, evaluates and outputs the probability distribution of the key text belonging to various preset intents. The joint discriminator extracts industry keywords from the key text to match keyword information associated with those keywords in the target industry scenario. Finally, the preset intent, based on a combination of keyword information and probability distribution, is selected as the interaction intent.

[0173] In layman's terms, the semantic analysis system in this embodiment integrates an intent output layer and a joint discriminator. It synchronously distributes the extracted key text to both the intent output layer and the joint discriminator for collaborative discrimination. The intent output layer combines industry keywords from the key text with preset interactive intents (i.e., pre-defined intents), quantifying the probability of the key text matching each intent to form a probability distribution of the user input text containing each preset intent. The joint discriminator extracts industry keywords from the key text, retrieves industry databases to match keyword association information, and clarifies the scenario and business attributes corresponding to the keywords. Combining keyword association information and intent probability distribution as references, the system selects the preset intent with the highest matching degree from multiple preset intents to determine the interactive intent of the user input text and the key text.

[0174] Specifically, the interaction categories represented by keyword information can be identified, and the confidence level of the key text belonging to each preset intent can be evaluated by combining the interaction categories. The interaction categories include at least one of the following: purchasing, inquiry, and order constraint categories. Based on the combined probability distribution and category confidence level, the preset intent is selected as the interaction intent. Furthermore, the matched keyword information can be categorized and analyzed to classify different interaction categories such as purchasing, inquiry, and order constraints. Based on the interaction category to which the key text belongs, the category confidence level of its corresponding preset intent is specifically calculated, supplementing the criteria for category dimension determination. Combining intent probability distribution and category confidence level enables multi-dimensional verification to improve the comprehensiveness and accuracy of verification, effectively reducing intent recognition bias and thus improving the accuracy of identifying the user's true needs through interaction intent.

[0175] Furthermore, in this embodiment, a sentiment analysis model can be used to identify the emotion of the target text to obtain the interactive emotion. The target text includes user-input text and / or key text.

[0176] Specifically, the target text can be input into a sentiment analysis model. The model then identifies the sentiment features of the target text to obtain the current sentiment represented by the text. Finally, a smoothing process is applied to the current sentiment to obtain the interactive sentiment.

[0177] The target text is input into a preset or pre-trained sentiment analysis model. The model captures multi-dimensional information such as word usage features, emotional vocabulary, and sentence tone to extract the emotional tendency and characteristics within the target text, thus initially identifying the current emotion corresponding to the target text. Simultaneously, to reduce the risk of incomplete emotional expression in a single sentence or excessive fluctuations in emotion recognition affecting the reliability of emotion determination, this embodiment can also perform smoothing correction and optimization calibration on the initially acquired current emotion. This weakens the interference of accidental and fragmented emotions, improves the stability and reliability of the determined interactive emotions, and thus helps to improve the completeness of restoring the user's true emotional state during instant messaging interactions.

[0178] The following provides a detailed explanation of the principles behind smoothing correction processing.

[0179] The current emotion can be corrected by incorporating textual factors. And / or, it can be corrected by incorporating auditory features. That is, smooth correction can adopt a single correction method or a multi-dimensional composite correction method. It can complete emotion correction based on the text's own correlation features, or it can combine the acoustic features of the original speech to assist in emotion correction. The two correction methods can be implemented independently or used in combination, and it can adapt to target texts from different source types.

[0180] In detail, the sentiment type represented by the textual factors of historical user input text and user input text can be analyzed to obtain text correction factors. These textual factors include at least one of the following: the time interval between user input text and historical user input text, the trend of historical sentiment notes, semantic transition structures, and the trend of text content changes. The text correction factors are then used to correct the current sentiment.

[0181] In this embodiment, historical user input text corresponding to the user's input text interaction is retrieved and compared with the current user input text, comprehensively considering the emotional change patterns reflected by multiple text factors. Among these, the interaction time interval reflects the duration of the user's emotions, the trend of historical emotion tag changes reflects the user's long-term emotional tendency, semantic transition structures are used to identify sudden emotional shifts caused by sentence transitions, and the trend of text content changes reflects emotional fluctuations caused by changes in interaction requests. Through comprehensive analysis and quantitative calculation of various text factors, a text correction factor adapted to the current interaction scenario is generated. Based on this correction factor, the current emotion initially output by the model is weighted and smoothed, weakening occasional extreme emotional expressions in single sentences, which helps improve the fit between the emotion recognition results and the user's overall interaction state.

[0182] This system can respond to user-input text converted from speech messages and analyze the emotional type represented by the sound features of the speech message to obtain a speech correction factor. The sound features include at least one of speech rate features, pause features, and pitch features. The speech correction factor is then used to correct the current emotional state.

[0183] In this embodiment, when the user inputs text derived from a voice message transcription, the original voice data can be traced back to extract multi-dimensional sound features such as speech rate, pause rhythm, and pitch fluctuations. These features are then combined with the emotional expression patterns corresponding to various acoustic features to determine the true emotional type carried at the speech level, and a voice correction factor is calculated accordingly. While text recognition only reflects literal emotion, the voice correction factor can supplement the emotional differences brought about by tone and intonation. In this embodiment, the voice correction factor is applied to the current emotion for secondary calibration, which can overcome the limitations of pure text emotion recognition and further improve the comprehensiveness and realism of interactive emotion recognition.

[0184] Generate intent tags that match the interaction intent, and generate emotion tags that match the interaction emotion.

[0185] Interaction intent and / or interaction emotion can be used as intent tags and / or emotion tags themselves, or they can be obtained through secondary processing such as formatting. No limitation is made here.

[0186] The training principle of a pre-trained semantic analysis model will be illustrated below with examples.

[0187] Optionally, training samples labeled with industry keywords for at least one interaction stage can be obtained to train a semantic analysis model. Industry keywords include at least one of product keywords, industry terminology keywords, and business keywords; interaction stages include consultation stages, transaction stages, after-sales stages, and other stages.

[0188] In other words, actual interaction data can be collected and organized in advance, and training samples can be selected to form multiple interaction stages, and industry keywords can be labeled for them. It's easy to understand that the text expression habits and content emphasis differ significantly across different interaction stages. Coupled with refined labeling of product keywords, industry terminology keywords, and business keywords, the learning dimensions of the model can be enriched. Inputting well-labeled training samples into the model training process allows the semantic analysis model to fully learn the text semantic rules, keyword association logic, and contextual expression features of different interaction stages in the target industry scenario. This strengthens the model's ability to understand industry-specific content and improves its performance in recognizing industry keywords, judging semantic continuity, and distinguishing redundant text.

[0189] Optionally, at least one type of perturbation sample can be obtained as validation samples to be used for model validation and iterative optimization of the trained semantic analysis model. The perturbation sample types include sample confusion category types, industry-specific near-synonymous expression sample types for the target industry scenario, sample classification bias types, and questionable sample types, where the questionable sample type indicates that the sample confidence level is below a confidence threshold.

[0190] In other words, after completing the basic training, multiple types of validation sample sets can be further constructed, including validation samples of at least one type of perturbation sample. Perturbation samples with high difficulty and susceptibility to interference are specifically introduced. Among them, confusion category samples can easily cause confusion in the model's intent judgment; industry-specific synonymous expression samples can test the model's ability to distinguish between synonymous but different expressions; classification bias samples are used to identify common recognition vulnerabilities in the model; and questionable samples with insufficient confidence can cover special text scenarios with ambiguous boundaries. By using the above-mentioned multi-dimensional perturbation validation samples to test and verify the trained semantic analysis model, it is beneficial to discover the defects and shortcomings of the semantic analysis system / model in complex contexts, similar expressions, and boundary text recognition, and to iteratively update and optimize them. Adjusting model parameters and optimizing semantic discrimination rules based on the validation feedback results can enhance the semantic analysis model's anti-interference ability and generalization ability in complex real-world interaction scenarios, and also improve the long-term stability and accuracy of the semantic analysis model and system in completing text semantic parsing and redundant content recognition.

[0191] The training principle of a pre-trained sentiment analysis model will be illustrated below with examples.

[0192] We can acquire text corpora carrying pre-defined emotion labels as emotion samples. We then convert these emotion samples into word vectors and extract local emotion features from these word vectors.

[0193] Local emotion features are pooled to obtain discriminative features for emotion classification using predefined emotion labels. A fully connected layer evaluates the probability distribution of these discriminative features belonging to each predefined emotion, and the predefined emotion to which the emotion sample belongs is determined by adapting the probability distribution to the training emotion. The emotion analysis model is updated using the training loss corresponding to the training emotion and the predefined emotion labels.

[0194] In layman's terms, this approach allows for the batch collection of massive amounts of text corpora from instant messaging interactions and target industry scenarios. Standardized sentiment annotation is then applied to these collected text corpora, assigning each piece of text a unique or composite pre-defined sentiment label. This constructs a rich and well-annotated dataset of sentiment samples, serving as a supervised training data source for the sentiment analysis model. The selected sentiment samples undergo text digitization, and a pre-trained word embedding algorithm maps the natural language text content into uniformly dimensional word vectors to quantify the semantic information of words and sentences. Subsequently, the sentiment analysis model can analyze the continuously arranged word vectors layer by layer, extracting key information such as emotional tendencies and tone expressions contained in word combinations and short sentence contexts, thereby improving the accuracy of extracting local sentiment features scattered throughout text fragments.

[0195] For the extracted fragmented local emotion features, pooling operations are used to aggregate and denoise the features, which helps to remove redundant feature information and compress feature dimensions. This facilitates the integration of semantically complete and feature-focused discriminative features, making them suitable for subsequent multi-category emotion classification. The integrated discriminative features are then input into a fully connected layer for feature mapping and weight calculation, quantifying the probability distribution of the discriminative features matching various preset emotions. Based on the numerical proportion of the probability distribution and the matching priority, the preset emotion with the highest confidence is selected as the training emotion for the model's inference output.

[0196] Furthermore, the training emotions inferred by the sentiment analysis model are compared with the pre-labeled sentiment tags of the emotion samples. The deviation between the two is calculated using loss functions such as cross-entropy loss, generating the corresponding training loss. Using the training loss as the basis for backpropagation, the model parameters of the sentiment analysis model are updated. This helps to reduce the error between the model's predictions and the standard labeled data, thereby strengthening the model's ability to capture text sentiment features and improve classification accuracy. Ultimately, this enhances the stability and generalization performance of the sentiment analysis model in complex interactive text scenarios.

[0197] In one embodiment, obtaining user input text may include: S201: Initialize the monitoring unit and load its capture area plugin to obtain the coordinates of the monitoring area.

[0198] S202: Periodically take screenshots of the area corresponding to the coordinates of the monitored area at preset intervals to obtain the original image of the interactive area.

[0199] S203: Calculate the hash value of the original image as the current hash value.

[0200] S204: Compare the current hash value with the hash value of the adjacent previous screenshot.

[0201] In this embodiment, when it is determined that the current hash value matches the hash value of the adjacent previous screenshot, step S202 is executed; when it is determined that the current hash value does not match the hash value of the adjacent previous screenshot, step S205 is executed.

[0202] S205: New interactive data has been determined.

[0203] S206: Denoise the original image to obtain the image to be identified.

[0204] The specific noise reduction principle will be explained in the following embodiments.

[0205] S207: Identify the status of preloaded engines in the engine pool and obtain idle engines to perform user input text recognition.

[0206] S208: Detect the instant messaging platform to which the image to be identified belongs as the target interaction environment.

[0207] S209: When a user language cache exists, the user language model is invoked; when no user language cache exists, the text language in the image to be recognized is recognized, the recognized text language is taken as the user language preference, and the corresponding language model is taken as the user language model and invoked.

[0208] S210: Use a pre-trained language model and a user language model to recognize text in parallel on the image to be recognized, merge the text recognition results, deduplicate the merged results, and score the quality.

[0209] S211: When character detection is available, character detection is performed on the image to be recognized, and the detected characters are quality verified. If the detected characters pass the quality verification, the quality score of the detected characters is evaluated. If the detected characters fail the quality verification, it is determined that a text classifier should be used for text detection. When character detection is not available, it is determined that a text classifier should be used for text detection. In response to the determination that a text classifier should be used for text detection, a preset text language model is called to perform text recognition on the image to be recognized, and the quality of the recognized text is verified. If the recognized text passes the verification, its quality score is calculated; otherwise, the reliability of the recognized text is intelligently downgraded, and a new recognition result is obtained using the default Chinese model. The quality score of the new recognition result is then evaluated.

[0210] S212: Determine if the quality score has reached the scoring threshold. If the quality score reaches the scoring threshold, the recognition is considered successful, and the initial text is obtained. If the quality score does not reach the scoring threshold, the original image is re-captured. If the number of retries reaches the retry threshold, the result is returned as the initial text and marked as a quality anomaly.

[0211] S213: Perform message parsing on the initial text, message grouping based on the session object, and space correction to obtain the user input text.

[0212] In this embodiment, the user-input text can be displayed on the front end and recorded in a recognition log. It can also be used for intent recognition and emotion recognition as described above.

[0213] The following example illustrates the detailed noise reduction principle of obtaining the image to be recognized by denoising the original image.

[0214] S301: Obtain the original image and perform grayscale conversion on the original image to obtain a grayscale image.

[0215] In this embodiment, an original image containing the text content to be extracted can be acquired. The original image can be a color image containing multi-channel color information or a grayscale image.

[0216] When the original image is a color image, a grayscale conversion algorithm can be used to reduce the channel dimension and simplify the color of the original image, remove redundant color interference information, unify the pixel grayscale measurement standard, convert the original color image into a single-channel grayscale image, reduce the amount of data for subsequent image processing, weaken the interference of color differences on text detection, and provide regular basic image data for subsequent image segmentation and feature extraction.

[0217] S302: Binarize the grayscale image based on the local window brightness distribution to obtain a normalized image.

[0218] In this embodiment, local sliding windows can be defined to traverse the pixel regions of the grayscale image and statistically analyze the pixel brightness distribution within each local window. A dynamic binarization threshold is adaptively set based on the brightness differences in different regions. The pixels of the grayscale image are then divided according to this threshold, uniformly mapping each pixel to either pure black or pure white, thus completing the image binarization operation. This reduces the impact of uneven overall illumination and local brightness deviations, improving the uniformity of global image contrast. Consequently, it enhances the image quality regularity and contrast balance of the normalized image, thereby improving the accuracy of distinguishing text areas from background areas.

[0219] S303: Identify text feature indicators of text regions within a normalized image, delete text regions corresponding to text feature indicators that match preset noise features, and obtain a filtered image. The text feature indicators include at least one of the following: character stroke width, connected region area, size ratio, positional distribution, and color layering information.

[0220] In this embodiment, region detection and contour extraction can be performed on the normalized image to accurately locate all target regions of suspected text in the image, and calculate multiple text feature indicators corresponding to each region. Noise feature standards are preset based on the characteristics of the target scene image, and the measured character stroke width, connected component area, aspect ratio, region location distribution, color layering, and other indicators are compared with the preset noise features one by one. If the feature indicators of a certain region meet the noise feature judgment conditions, the region is determined to be an invalid interference region such as stains, noise, or messy textures. This type of invalid text region is automatically removed and erased, retaining the target text region, thus completing image noise filtering to generate a filtered image free of miscellaneous interference.

[0221] S304: Perform text enhancement processing on the filtered image to obtain the image to be recognized. The text enhancement processing includes at least one of image opening / closing operations and edge-preserving smoothing processing.

[0222] In this embodiment, targeted text enhancement optimization can be performed on the filtered image after noise filtering. This can be achieved by using image opening / closing operations and edge-preserving smoothing alone, or by combining both methods for synergistic optimization. Image opening / closing operations fill in small gaps in text strokes and eliminate minor burrs around the text, optimizing the integrity of the text structure. Edge-preserving smoothing weakens interference from minor textures in the image background while fully preserving the details of the text outline edges, reducing blurring of text edges. This effectively enhances the clarity of text outlines and the integrity of strokes, improving the distinction between text and background, thereby improving the image quality and text feature prominence of the image to be recognized, and ensuring the accuracy and stability of subsequent text recognition.

[0223] In other words, the original image is denoised using a multi-threshold denoising algorithm to obtain the image to be recognized. The multi-threshold denoising algorithm does not only use a single grayscale threshold for filtering, but also includes grayscale conversion, adaptive binarization, connected component analysis, morphological denoising, and edge-preserving smoothing.

[0224] In layman's terms, the chat area image is first converted to grayscale, and adaptive binarization is performed based on the local window brightness distribution to eliminate the impact of differences in interface backgrounds and screenshot quality. Then, based on character stroke width, connected component area, aspect ratio, positional distribution, and color layering information, suspected advertising badges, watermarks, decorative icons, emoji fragments, and abnormal noise are initially removed. Next, opening and closing operations are used to remove isolated noise and connect fragmented target characters. Edge-preserving smoothing is employed to retain text outlines, avoiding the loss of stroke information due to excessive smoothing. For the identification of advertising logos and meaningless characters, this invention further combines prior interface regions, character confidence, dictionary matching results, and contextual semantic consistency for joint judgment, thereby reducing the risk of mistakenly deleting target text due to relying solely on pixel thresholds.

[0225] In one embodiment, the intent recognition of key text in this application may include: S401: Input the text into the word segmenter and use the word segmenter to obtain text segments.

[0226] In this embodiment, for example, the user input text could be "What is the price of this product?", and the segmented text could include "CLS marker", "please", "this", "product", "of", "price", "is", "how much", "question mark", and "SEP marker". The CLS marker represents the beginning position marker of the sequence and can be used to form a sequence beginning position vector; the SEP marker represents the end position marker of the sequence.

[0227] S402: Input the text segmentation into the embedding layer to obtain the segmentation vector.

[0228] In this embodiment, it can be converted into a 768-dimensional vector through a basic embedding layer (Token Embedding), a position encoding embedding layer (Position Embedding), and a sentence differentiation embedding layer (Segment Embedding).

[0229] S403: The word segmentation vectors are summed and then input into the semantic analysis model for intent recognition.

[0230] In this embodiment, the semantic analysis model can be composed of 12 layers of Transformer (an encoder structure), where the first layer is used to capture relationships, the second layer is used to perform sublinear transformations, and the third to twelfth layers are used for repeated stacking of deep feature extraction.

[0231] S404: Extracts the sentence-level representation of the beginning position vector of the sequence, passes it through the input fully connected layer, activates the result of the fully connected layer using an activation function, performs regularization, passes it through the input fully connected layer, activates the result of the fully connected layer using an activation function, performs regularization, and then outputs the original value belonging to the preset intention through the output layer.

[0232] S405: Input the original values ​​into the normalization layer to obtain the probability distribution belonging to the preset intent, so as to determine the interaction intent.

[0233] In this embodiment, for example, when the normalization layer outputs "Inquiry intent: 0.92", "Consultation intent: 0.05", "Complaint intent: 0.01", "Order placement intent: 0.01", and "Casual chat intent: 0.01", the interaction intent can be determined to be an inquiry intent, and the probability of the inquiry intent, 0.92, can be used as its confidence level.

[0234] In one embodiment, this application provides a flowchart illustrating an example of emotion recognition of target text.

[0235] In one embodiment, the target text can be input into a sentiment analysis model. The text vector matrix is ​​obtained by passing the word embedding layer and word vector matrix of the sentiment analysis model. The text vector matrix is ​​then input into multiple convolutional layers to capture multiple feature maps. The filter dimensions of the multiple convolutional layers can be different. The multiple feature maps are then input into a max-pooling layer, and the output of the max-pooling layer is input into a concatenation layer to obtain a feature vector.

[0236] Next, the text is passed sequentially through a first fully connected layer, the result of which is then activated using an activation function, and subjected to a first regularization process. It is then passed through a second fully connected layer, the result of which is activated using an activation function, and subjected to a second regularization process to obtain the original values ​​of the target text belonging to each preset emotion. A normalized activation function is then used to normalize the original values ​​belonging to each preset emotion, resulting in a probability distribution for each preset emotion, thus determining the interactive emotion. The interactive emotion can be a single emotion or a combination of multiple emotions.

[0237] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0238] The embodiments of this application also provide a message interaction method, and the message interaction method is described in detail in conjunction with the execution flow of the message interaction method.

[0239] In one embodiment, the message interaction process of this application is as follows: S501: Obtain the user input text formed by the interaction data of the current round with the session object.

[0240] S502: Use content analysis methods to analyze user input text to obtain intent tags and sentiment tags.

[0241] In this embodiment, the content analysis method can be as described in any of the above embodiments, and will not be repeated here.

[0242] S503: Adapt intention tags and emotion tags to generate candidate responses to assist in responding to interaction data.

[0243] Furthermore, in this embodiment, intent tags, sentiment tags, industry keywords in the user input text, confidence scores of the user input text, and time information can be integrated to obtain fused analysis information.

[0244] Update the user profile of the conversation object using fusion analysis information. Specifically, when the current label and / or emotion label of the conversation object contradict the historical label, reduce the weight of the historical label when updating the user profile.

[0245] Generate alternative responses that fit the user profile.

[0246] This application also provides a method for updating user profiles, the specific steps of which are as follows: Step S601: Identify the interaction data between the user and the current round, and obtain the single-round preset words and single-round tags for the current round. The single-round preset words are used to represent the semantic units extracted from the interaction data.

[0247] This involves acquiring real-time chat data between users and staff based on communication platforms, such as social media or instant messaging software. The system can also obtain raw chat logs generated on the platform, i.e., interaction data, which includes text and images. Images can be converted into analyzable text using Optical Character Recognition (OCR). The interaction data from the current round with the user represents the information generated between the user and the trade support tool in this dialogue, including: the content entered by the user, such as text, commands, or selected options; and the content of responses to the user, such as answers, hints, follow-up questions, or guiding statements. This interaction data serves as the foundation for subsequent backend analysis. The specific communication platform can be determined based on the actual usage scenario or user habits.

[0248] The pre-set words for the current round are used to represent the basic semantic units extracted from the interaction data with the user in the current round. They can be the recognition results obtained after recognizing pre-set keywords, fixed feature words, and rule words during the interaction with the user in the current round. The single-round label is used to represent the feature identifier for classifying users. It can be temporary user labels identified based on the current single-round interaction data.

[0249] Specifically, if keywords such as "excavator" and "overseas promotion" appear multiple times in the user's interaction data in the current round, it can be determined that the preset words for the single round include "excavator" and "overseas promotion". If the preset words for the single round (excavator, overseas promotion) have a strong semantic association with the export trade tags of construction machinery products in the tag knowledge graph, then the user's single round tags include the export trade tags of construction machinery products.

[0250] Step S602: Based on the single-round preset words, single-round tags, and historical interaction data with the user, determine the state data of the dialogue state machine. The dialogue state machine is determined based on a finite state machine model, and the state data is used to characterize the state switching logic.

[0251] The user's historical interaction data represents past dialogues or interactions with that user, including historical keywords, historical tags, historical state records, and historical profile data. The dialogue state machine is determined based on a Finite State Machine (FSM) model and includes multiple states, with pre-defined state transition conditions between each state. Specifically, the dialogue state machine can be configured to include an initial state, intermediate states, and a termination state. The initial state represents the state at the beginning of the session; the intermediate states represent the state from the beginning of the session until its end; and the termination state represents the state at the end of the session. Pre-defined single-turn words, single-turn tags, and historical interaction data can be matched with the state transition conditions of the dialogue state machine, and the state switching logic of the dialogue state machine is determined based on the matching results. The state data of the dialogue state machine includes: the current state of the state machine, the historical state transition trajectory, and the state transition trigger conditions.

[0252] In step S602, determining a single-round label solely based on the user's interaction data in the current round is easily affected by user input errors or single-item ambiguities; relying solely on historical interaction data may fail to reflect changes in user intent. The current round's interaction data and historical interaction data can be merged. Based on the merged data, it can be determined whether the single-round label continues the previous dialogue topic, whether the core requirement has changed, or whether previously unspoken information has been supplemented, thus obtaining a judgment result. This judgment result is then matched with the state transition rules of the dialogue state machine to determine the state switching logic corresponding to the current round of dialogue.

[0253] Specifically, the current conversation state can be determined based on pre-set single-turn words, single-turn tags, and historical interaction data with the user. Based on the historical and current conversation states, the state data of the dialogue state machine can then be determined. For example, if a user first asks, "Hello, I'd like to learn about excavator promotions," the state data of the dialogue state machine is determined to be in the initial state. If the user then asks again, "Promotions for a certain excavator," the state data of the dialogue state machine is determined to be in the initial state, transitioning to an intermediate state. If the user asks, "Okay, I'll contact you again if I need anything later," the state data of the dialogue state machine is determined to be in the intermediate state, transitioning to the terminated state.

[0254] Step S603: Identify single-wheel labels with semantic conflicts and / or single-wheel labels that do not conform to the state switching logic represented by the state data, and treat them as abnormal labels.

[0255] Semantic conflict is used to characterize logically mutually exclusive combinations between single-round labels, such as a refund intention label and a satisfaction label, or a high purchase intention label and a abandonment of cooperation label. Single-round labels that do not conform to the state transition logic represented by the state data are used to characterize labels that contradict the state transition logic of the dialogue state machine. Anomaly labels are used to characterize temporary labels within a single round that contain internal semantic contradictions or contradict the state transition logic of the state machine.

[0256] In step S603, it can be determined whether there are semantically conflicting tags, tags that contradict the state transition logic of the dialogue state machine, or tags that are both semantically conflicting and contradict the state transition logic of the dialogue state machine. If there are tags that are semantically conflicting or contradict the state transition logic of the dialogue state machine, these tags are determined to be abnormal tags.

[0257] Specifically, if the user sends "Hello" for the first time, the state data of the dialogue state machine is determined to be the initial state. If there is a session end label in the single-round label of the current round, the session end label does not conform to the state switching logic represented by the state data, and the session end label is regarded as an abnormal label.

[0258] Step S604: Correct the abnormal tags based on historical interaction data to obtain corrected tags, and update the user profile and the state of the dialogue state machine based on the single-round preset words and corrected tags.

[0259] Among them, the corrected label is used to represent the compliant label obtained after adjusting or replacing the confidence level of abnormal labels based on historical interaction data. The user profile is used to represent the user feature model including labels, keywords, and weights.

[0260] In step 604, for abnormal tags, confidence correction, conflicting tag replacement, and invalid tag removal can be performed based on historical interaction data to resolve misjudgments and contradictions in single-round recognition. Based on reliable single-round preset words and corrected tags, the tags, intention weights, and behavioral preferences of the user profile can be iterated synchronously; simultaneously, based on the single-round preset words and corrected tags, the dialogue state machine is driven to update its state, awaiting the next round of interaction recognition.

[0261] The user profile update method provided in this embodiment determines keywords and tags to be determined based on single-round interactions, determines the state constraints of the dialogue state machine based on single-round and historical interaction data, filters abnormal tags based on tag semantic verification and state machine state constraints, corrects abnormal tags based on historical interaction data, and updates the user profile and dialogue state machine state data based on keywords and corrected tags. Using each round of user interaction data as a trigger condition, it identifies single-round preset words and tags in real time, no longer relying on long-term fixed static tags. Each round of user dialogue initiates a completely new round of semantic capture, responding to real-time expressions such as budget adjustments, interest switching, and intent changes, solving the problem of untimely user profile updates. This reduces contradictory tags identified in single-round interactions, lowers intent misjudgment, and improves the accuracy of tag recognition. Simultaneously, based on the state constraints of the dialogue state machine, it ensures that user tags are consistent with the conversation evolution logic, conforming to the real interaction process, and enabling intelligent interaction strategies to dynamically adapt to user needs, thus improving the user experience.

[0262] In some optional implementations, obtaining the single-round preset words and single-round tags for the current round includes: identifying at least one preset word contained in the interaction data between the user and the current round as the single-round preset word; querying all target tags corresponding to the preset words in the tag knowledge graph and linking the preset words with the target tags; extracting a first semantic vector based on the preset words and extracting a second semantic vector based on the target tags, and determining the similarity between the first semantic vector and the second semantic vector; if the similarity is higher than a preset similarity threshold, adding the target tags to the single-round tags, wherein the number of target tags contained in the single-round tags is at least one.

[0263] The tag knowledge graph can be a pre-constructed knowledge system containing hierarchical tags and semantic relationships, used to map identified preset words (keywords) to tags in user profiles. Entities represent semantic objects with clear business meanings corresponding to preset words. Entity links match and bind the identified preset words (keywords) with corresponding standard tag nodes in the tag knowledge graph, unifying diverse colloquial user expressions to semantic entities within the tag knowledge graph and avoiding tag matching errors caused by different meanings of the same word or different words with the same meaning. The first semantic vector represents the vector representation obtained after semantically vectorizing the preset words. The second semantic vector represents the vector representation obtained after semantically vectorizing the corresponding target tag in the tag knowledge graph. Similarity represents the semantic closeness between word vectors and tag vectors. The preset similarity threshold can be a pre-set minimum score for judging whether a preset word matches a tag. The target tag represents the tag in the tag knowledge graph that semantically matches the preset words.

[0264] In this implementation, a tag knowledge graph can be created based on a pre-defined multi-dimensional tag system. User tags can be hierarchically linked according to core tags, sub-tags, associated attributes, and business entities, and the functional semantic edges of synonyms, near-synonyms, hierarchical relationships, causal relationships, and subordinate relationships between user tags can be labeled. Pre-defined words are mapped to the standard tags already defined in the tag knowledge graph, completing the link from the pre-defined words to the tag system. Here, the pre-defined words are keywords, which are the core basis for generating tags, and the tags are the abstraction and classification of the semantic meaning of the keywords. Subsequently, through the repeated occurrence of keywords and semantic association verification, the accurate labeling of user profiles is completed.

[0265] Specifically, if the user's interaction data in the current round is "I want to inquire about the device's delivery time," the identified preset words are "device," "delivery," and "delivery time." The retrieved target tags in the tag knowledge graph are: for "device," "product inquiry" and "goods intention"; for "delivery," "logistics inquiry" and "delivery timeliness inquiry"; and for "delivery time," "timeliness inquiry." The device is then linked to the device entity in the tag knowledge graph; the delivery time is linked to the delivery timeliness entity in the tag knowledge graph.

[0266] Both the preset words and their corresponding target tags are converted into semantic vectors. The preset words are then projected onto tag knowledge graph nodes, and their similarity is calculated to determine whether their semantics are truly consistent. Tag nodes with a semantic relevance higher than a preset similarity threshold are identified as target tags, thus completing the accurate matching between the preset words and existing user tags.

[0267] The interaction data between the user and the current user session can also be input into the intent analysis model to obtain single-round labels. The intent analysis model matches the corresponding category in a multi-dimensional labeling system based on the semantics of the chat text, outputting labels related to the user's current needs, emotions, and behaviors. The intent analysis model can use a Bidirectional Encoder Representations from Transformers (BERT) model, an optimized version of the original BERT model, pre-trained and fine-tuned for specialized vocabulary in trade scenarios (such as overseas promotion and cross-border logistics) and industry terminology to improve the accuracy of intent recognition and keyword extraction. Alternatively, an improved pre-trained language model can be used, such as the Robustly Optimized BERT Pretraining Approach (RoBERTa), or a lightweight BERT model for self-supervised learning of language representations (ALBERT). In this way, by pre-selecting words, linking entities in the tag knowledge graph, and verifying semantic vector similarity, the system can accurately and automatically generate standard user tags from user interaction text. Compared with related technologies that directly map keywords, the user tags are more standardized, more accurate, and more resistant to interference, and can provide a high-quality tag source for dynamic user profiles in real time and stably.

[0268] In some optional implementations, the dialogue state machine includes an initial state, an intermediate state, and a termination state; single-turn labels include intent labels and / or emotion labels. Identifying single-turn labels with semantic conflicts and / or those that do not conform to the state switching logic represented by the state data as abnormal labels includes: if a single-turn label does not conform to the state switching logic represented by the state data, determining that the single-turn label is an abnormal label, wherein the state switching logic includes switching from the initial state to the intermediate state, switching from the intermediate state to the termination state, the initial state being used to represent the state of establishing a conversation with the user for the first time, the intermediate state being used to represent the state from the establishment of the conversation to the end of the conversation, and the termination state being used to represent the state of the end of the conversation; and / or combining the intent labels and emotion labels in the single-turn labels to obtain at least one combination, if the semantic similarity between the intent labels and emotion labels in the target combination is lower than a first similarity threshold, determining that the intent labels and emotion labels in the target combination have semantic conflicts, and identifying the intent labels and emotion labels in the target combination as abnormal labels.

[0269] Specifically, if a conversation with a user has just begun, and the user has not clearly expressed a valid need, nor exhibited a fixed intention or stable emotion, then the dialogue state machine is in the initial state. If the conversation is ongoing, and the user continues to inquire, their intention or emotion may iteratively change, then the dialogue state machine is in an intermediate state. If the conversation ends, such as when a need is confirmed, a request is fulfilled, or communication concludes and the intention no longer changes, then the dialogue state machine is in the terminated state. The state transition logic is used to represent the preset, legal state transition paths.

[0270] In this implementation, the states of the dialogue state machine are defined as an initial state, an intermediate state, and a termination state. The switching path of the dialogue state machine is set: from the start of the interaction process to its end. Based on a specific tag in the current single round, the existing states of the dialogue state machine are compared with the allowed transition logic. If the intent corresponding to that tag does not conform to the content that can occur in the current stage (e.g., a conversation end tag appearing in the initial state), the tag is determined to be an abnormal tag.

[0271] The intent tags and emotion tags identified in this round are paired, and the semantic vectors of the intent tags and emotion tags within each pair are extracted. The semantic correlation between the intent tag vector and the emotion tag vector within the pair is calculated using a cosine similarity algorithm to obtain their semantic similarity values. A first similarity threshold is pre-configured. If the semantic similarity between the intent tag vector and the emotion tag vector in the target pair is lower than this threshold, the intent tag and emotion tag in the target pair are determined to be abnormal tags.

[0272] In this way, abnormal tags with temporal anomalies or logical conflicts can be accurately identified, ensuring that the user profile updated based on tags always matches the user's real and latest needs, which facilitates the execution of subsequent intelligent recommendation and interactive response strategies.

[0273] In some optional implementations, intermediate states may include a main intermediate state and sub-intermediate states. The main intermediate state is used to characterize the global session process state, maintaining a forward flow logic with the initial and final states. Sub-intermediate states can be determined based on business intent. For example, sub-intermediate states may include consultation states, intention states, and decision states; consultation states may be product consultation states, price consultation states, order consultation states, or logistics consultation states; intention states may be order placement intention states or negotiation states; decision states may be order confirmation states, refund request states, or order cancellation states.

[0274] If a single-round label includes multiple labels, the switching or parallel execution of the corresponding sub-intermediate states is triggered based on these multiple labels. Specifically, if a single-round label includes multiple labels, the sub-intermediate states corresponding to these multiple labels can be triggered in parallel. For example, if a single-round label includes a "Consult Excavator Export Price" label and a "Inquire about Refund Policy" label, the "Price Inquiry" sub-state corresponding to the "Consult Excavator Export Price" label and the "Refund Inquiry" sub-state corresponding to the "Inquire about Refund Policy" label can be triggered simultaneously. The aforementioned state switching logic also includes switching from the first sub-intermediate state to the second sub-intermediate state, or from the second sub-intermediate state to the first sub-intermediate state. Sub-intermediate state switching does not affect the main intermediate state. Sub-intermediate states support free switching and do not need to follow a fixed order.

[0275] If the dialogue state machine is in the main intermediate state, and if the single-round label is a normal label, combine the intent label and emotion label in the single-round label. If there is a semantic conflict in the combination result, determine that the intent label and emotion label in the combination result are abnormal labels.

[0276] Specifically, if the main intermediate state of the dialogue state machine is in the engineering machinery interaction, and the sub-intermediate state is the procurement consultation sub-state, the single-round labels include: refund intention label, consultation export customs declaration process label, and concern emotion label; if the refund consultation sub-state corresponding to the refund intention label and the customs declaration consultation sub-state corresponding to the consultation export customs declaration process label are triggered, then the sub-intermediate state of the dialogue state machine will be updated to include: procurement consultation sub-state, refund consultation sub-state, and customs declaration consultation sub-state.

[0277] In this way, by using a hierarchical design of main intermediate states and sub-intermediate states, the rigid constraints of the original single intermediate state are broken, allowing users to express multiple intentions in parallel and switch between intentions freely when the dialogue state machine is in an intermediate state. This aligns with users' real communication habits and reduces the probability of interaction interruption caused by system judgment anomalies.

[0278] In some optional implementations, correcting abnormal labels based on historical interaction data to obtain corrected labels includes: evaluating a set of confidence weights for abnormal labels; wherein the set of confidence weights includes at least one of historical label confidence weights, dialogue round confidence weights, and semantic matching weights; the historical label confidence weights are determined based on the average confidence of labels of the same type as the abnormal labels in the historical interaction data; within the maximum range of the dialogue round confidence weights, the dialogue round confidence weights increase with the increase of the dialogue rounds; the semantic matching weights are determined based on the semantic similarity between the abnormal labels and historical labels; the current confidence of the abnormal labels is determined based on the semantic similarity between the abnormal labels and the single-round preset words corresponding to the abnormal labels; the corrected confidence is obtained by multiplying the weighted sum of the historical label confidence weights, dialogue round confidence weights, and semantic matching weights with the current confidence; and the abnormal labels with corrected confidence are used as corrected labels.

[0279] The current confidence score (ranging from 0 to 1) characterizes the current confidence score of the anomalous label, reflecting the initial reliability of the single-round identification result. It can be determined based on the semantic similarity between the anomalous label and the corresponding pre-defined words in the single round. The confidence weight set is used to adjust the initial confidence score of the anomalous label and calculate the weighted parameters for the corrected confidence score. It can optimize label confidence by combining historical data, ensuring that the corrected result aligns with the user's true intent.

[0280] In this embodiment, the initial confidence level of the abnormal label can be used as a basis, combined with at least one confidence level weight (historical label confidence level weight, dialogue round confidence level weight, semantic matching degree weight), and a preset weighting algorithm can be used to calculate the corrected confidence level by calculating the weighted sum of the corrected confidence level = initial confidence level × confidence level weight, thereby completing the optimization and adjustment of the credibility of the abnormal label.

[0281] Specifically, you can retrieve tags of the same type as the current abnormal tag from the user's historical interaction data and calculate the average confidence score of these historical tags. For example, if the confidence scores of three historical intent tags of the same type are 0.8, 0.75, and 0.85 respectively, and the average is 0.8, this average is the historical tag confidence score weight, which ranges from 0 to 1. The higher the average, the higher the credibility of the user's historical tags of the same type, and the greater the reference value for correcting the current abnormal tag.

[0282] The maximum value of this weight can be preset, such as 0.5. Following the rule of increasing weight with each round, the weight increases as the current dialogue round progresses, but the weight value never exceeds the preset maximum value. In this way, the user's intent becomes clearer as the dialogue round progresses, and the reliability of tag recognition increases.

[0283] The semantic vectorization algorithm can be used to convert abnormal tags and user's historical tags of the same type into semantic vectors respectively, and calculate the semantic similarity between the two. This similarity is the semantic matching weight, with a value range of 0-1. The higher the similarity, the more the abnormal tag matches the user's historical intent and behavioral habits, and the more likely the tag will be retained when making corrections.

[0284] In this way, by using historical tag confidence weights and semantic matching weights, the correction of abnormal tags is deeply bound to users' long-term interaction habits, avoiding correction bias caused by relying solely on single-round recognition results, and ensuring that the corrected tags conform to the user's past behavioral logic. At the same time, the confidence weight of each dialogue round follows the logic that the weight increases as the round progresses, which is consistent with the pattern that user intent gradually becomes clearer as the rounds progress in real interactions, avoiding the miscorrection of tags with clear intent in later rounds, and improving the temporal rationality of the correction results.

[0285] In some optional implementations, the user profile is updated based on a single round of preset words and corrected labels, including: if the corrected confidence level is greater than or equal to a preset confidence threshold, the confidence level of the label corresponding to the corrected confidence level in the user profile is adjusted to the corrected confidence level; if the corrected confidence level is less than the preset confidence threshold, the abnormal label is deleted from the user profile.

[0286] In this embodiment, a preset confidence threshold is used to characterize the preset label confidence judgment standard, such as 0.6. When an abnormal label is corrected and its corrected confidence level reaches or exceeds this threshold, it indicates that the corrected label has high credibility and matches the user's true intention. At this time, based on the corrected confidence level, the corresponding type of label and its weight in the user profile are updated synchronously. In this way, the higher the corrected confidence level, the higher the weight of the corresponding label in the user profile, strengthening the influence of the label on the user profile and achieving accurate iteration of the profile.

[0287] When the corrected confidence level of an anomaly label is lower than the preset confidence threshold, it means that even after correction, the anomaly label still lacks sufficient confidence and cannot be used to update the user profile; the anomaly label can be deleted.

[0288] In this way, by setting a pre-set confidence threshold, the corrected tags are filtered a second time. Only high-confidence tags are used to update the tags in the profile, while low-confidence tags are deleted. This reduces the number of abnormal or low-confidence tags entering the user profile, avoids profile distortion, and ensures that the profile always matches the user's true intentions.

[0289] User profiling in related technologies does not consider the chat time dimension and ignores the impact of the silent period on customer interest, which can lead to inaccurate timing of follow-up.

[0290] In some optional implementations, the aforementioned user profile update method further includes: obtaining the last interaction time with the user, determining the interaction termination duration based on the last interaction time; determining relevant tags based on tags whose tag frequency is greater than or equal to a preset frequency threshold and / or whose tag weight is greater than or equal to a weight threshold in a preset number of rounds prior to the last interaction time; and if the interaction termination duration exceeds a preset feedback cycle threshold, reducing the weight of the relevant tags and / or adding a tag to be contacted for the user.

[0291] In this embodiment, the last valid interaction time with the user recorded in the trade support tool can be obtained, such as the timestamp of the last conversation sent by the user that triggered the interaction operation; then the time difference between the current system time and the last interaction time is calculated, and this time difference is the duration of the user's interaction interruption, which is used to measure the duration of the user's silent interaction.

[0292] The preset rounds are a pre-defined range of historical interaction rounds used to filter relevant tags, such as the five rounds of dialogue before the last interaction. User tag data within this preset round is retrieved, and relevant tags are determined using at least one of the following methods: First, the frequency of each tag is counted; tags with higher frequencies are more relevant to the user's core needs, for example, tags with a frequency greater than or equal to a preset tag threshold. Second, the weight of each tag is considered; tags with higher weights better reflect the user's core intent, for example, tags with a weight greater than or equal to a weight threshold. The tags ultimately selected that are related to the user's core needs or intent are the relevant tags that need adjustment.

[0293] If the interaction pause duration exceeds a preset feedback cycle threshold, the weight of relevant tags is reduced, or a "to be contacted" tag is added to the user, or both are done simultaneously. The preset feedback cycle threshold is a pre-defined critical duration for determining user inactivity, such as 7 days. When a user's interaction pause duration exceeds this threshold, it indicates a decrease in user engagement and a potential change in needs. At this point, at least one of two adjustment operations is performed: first, the weight of relevant tags is reduced to weaken their impact on the user profile, such as lowering the tag weight from 0.8 to 0.4, preventing outdated tags from dominating the user profile; second, a "to be contacted" tag is added to the user, such as a "silent user" tag or a "needs confirmation pending" tag, to mark the user's current status and provide a clear indicator for subsequent interaction strategy adjustments. For example, if a user's inactivity exceeds 48 hours, sales personnel are automatically alerted to the risk of customer churn.

[0294] Specifically, when a customer does not respond to messages for 48 consecutive hours, the system lowers the weight of their high-interest tag based on a silence warning mechanism and adds a "decreased interest, please contact" tag to the customer profile. Upon seeing this tag, sales personnel can resend appropriate follow-up messages. If the customer subsequently replies, the system readjusts the tag weight based on the new intent and sentiment.

[0295] In this way, for scenarios where users have not responded for a long time, by adjusting the weight of relevant tags or adding tags to be contacted, we can avoid the original core tags from maintaining high weight after the user has become silent, which would cause the user profile to become out of touch with the user's current real needs. This makes up for the deficiency in related technologies where user profiles are only updated during interaction, and ensures that the user profile always keeps up with the user's latest status. At the same time, it can predict the possibility of customer churn in advance and provide sales staff with follow-up strategies, which is highly predictable.

[0296] In some optional implementations, if the interaction pause duration exceeds a preset feedback cycle threshold, the weight of the relevant tag is reduced and / or a "to be contacted" tag is added to the user, including: if the interaction pause duration is greater than or equal to a first preset feedback cycle threshold and less than a second preset feedback cycle threshold, the weight of the relevant tag is reduced based on the first tag weight; if the interaction pause duration is greater than or equal to the second preset feedback cycle threshold and less than a third preset feedback cycle threshold, the weight of the relevant tag is reduced based on the second tag weight, wherein the first preset feedback cycle threshold is less than the second preset feedback cycle threshold, the second preset feedback cycle threshold is less than the third preset feedback cycle threshold, and the first tag weight is greater than the second tag weight; if the interaction pause duration is greater than or equal to the third preset feedback cycle threshold, the weight of the relevant tag is reduced based on the third tag weight, wherein the second tag weight is greater than the third tag weight.

[0297] This application also provides a method for issuing warnings about user silence, specifically including: Step S701: Execute a user silence warning task based on a preset time.

[0298] Step S702: Obtain the user's last interaction time. For example, the user's last interaction time can be configured as the last_contact field.

[0299] Step S703: Iterate through the users in the user list.

[0300] Step S704: For the currently traversed user, determine the interaction termination duration. The interaction termination duration, days, can be calculated as follows: days = today - last_contact, where today represents the time spent executing the user silence warning task.

[0301] Step S705: Determine the threshold range of the interaction termination duration. If the interaction termination duration is less than the first preset feedback cycle threshold, proceed to step S706; if the interaction termination duration is greater than or equal to the first preset feedback cycle threshold and less than the second preset feedback cycle threshold, proceed to step S707; if the interaction termination duration is greater than or equal to the second preset feedback cycle threshold and less than the third preset feedback cycle threshold, proceed to step S708; if the interaction termination duration is greater than or equal to the third preset feedback cycle threshold, proceed to step S709.

[0302] Specifically, the first preset feedback period threshold can be configured to seven days, the second preset feedback period threshold can be configured to fourteen days, and the third preset feedback period threshold can be configured to thirty days.

[0303] In step S706, the user corresponding to the interaction suspension time is in a normal state, no warning is needed, the weight of the relevant tags is not adjusted, no tag to be contacted is added, and proceed to step S710.

[0304] Step S707: Issue a reminder and warning to users whose interaction has been interrupted for a certain duration, determine that the risk of churn for these users is low, reduce the weight of related tags or all tags based on the weight of the first tag, add a "to be contacted" tag to the user, suggest that the user be followed, and proceed to step S710. Specifically, the weight of the first tag can be configured to 0.8.

[0305] Step S708: Issue a general warning to users whose interaction has been interrupted for a certain duration, determine that the user's churn risk is medium, reduce the weight of related tags or all tags based on the weight of the second tag, add a "to be contacted" tag to the user, suggest following up with the user, and proceed to step S711. Specifically, the weight of the second tag can be configured to 0.6.

[0306] Step S709: Issue a severe warning to users whose interaction has been interrupted for a certain duration, determining that the user has a high risk of churn. Based on the weight of the third tag, reduce the weight of related tags or all tags, add a "to be contacted" tag to the user, indicating that the user needs urgent follow-up, and proceed to step S712. Specifically, the weight of the second tag can be configured to 0.3.

[0307] Step S710: Log the information and proceed to step S713.

[0308] Step S711: Based on the system message push notification, proceed to step S713.

[0309] Step S712: Based on system messages and email notifications, proceed to step S713.

[0310] Step S713: Update the database, then proceed to step S714. The database can be a Structured Query Language database such as MySQL or PostgreSQL. After the database is updated, the cache (remote dictionary server, or Redis for short) can be updated.

[0311] Step S714: Determine if there are any users who have not been traversed. If they exist, proceed to step S703; otherwise, proceed to step S715.

[0312] Step S715, task complete.

[0313] In this way, different weight reduction strategies are adopted based on the length of user silence. The longer the silence time, the greater the reduction in tag weight. This accurately matches the changing pattern of user needs with the length of silence, avoiding the problem of excessively weakening tags when the silence time is short, or insufficiently weakening tags when the silence time is long. This ensures that the user profile always fits the user's current state. At the same time, the different gradient weight adjustments are tied to the silence time, allowing the system to accurately judge the degree of user silence and then formulate targeted interaction strategies, avoiding the waste of resources and user harassment caused by a uniform strategy.

[0314] In another embodiment, the user profile update method of this application may include the following steps: Step S801: Obtain user information, including: user identification information (customer_id), the company to which the user belongs, the communication medium used by the user, or the time of the user's first contact (first_contact), etc.

[0315] Step S802: Based on user identification information and the communication medium used by the user, obtain the interaction data with the user in the current round. The communication medium used by the user can be WeChat Work or WhatsApp, etc. Matching different communication mediums based on user usage habits can increase the coverage scenarios of this method, ensure that user chat data can be effectively collected, and improve the applicability of this method.

[0316] Step S803: Identify keywords based on the interaction data with users in the current round, input the interaction data into the intent analysis model, and extract tags. Tags include: intent tags, sentiment tags, industry category tags, price sensitivity tags, geographic region tags, and product preference tags. Intent tags can include: inquiry, consultation, complaint, and order placement. Sentiment tags can include: positive, neutral, negative, and urgency.

[0317] Step S804: Input keywords and tags into the tag engine. Based on the tag engine and tag knowledge graph, generate new tags for users, match existing tags, and adjust tag weights, i.e. update the user profile.

[0318] The updated user profile can also be synchronized to the interaction module. Based on the interaction module, personalized responses can be provided to users, and marketing strategies corresponding to users can be executed. It can also integrate basic customer information from the customer relationship management system, store user profile data, and single-round preset words and single-round tags determined based on the current round of interaction data with users, based on the tag engine.

[0319] In some optional implementations, the aforementioned user profile update method further includes: determining the occurrence frequency of preset words and the time interval between two adjacent occurrences; binding the preset words to their corresponding target tags; normalizing the occurrence frequency of the preset words to obtain a first coefficient; exponentially decaying the time interval of the preset words to obtain a second coefficient; weighting and fusing the first coefficient and the second coefficient; and determining the target weight of the target tag based on the fusion result and the initial weight of the target tag.

[0320] In this way, by adjusting the weight of the target tags corresponding to the preset words based on their frequency of occurrence and time intervals, changes in user attention can be reflected.

[0321] The following is an illustrative example of the user profile update method involved in this application. In a communication scenario involving foreign trade in construction machinery, a user repeatedly mentioned keywords such as "excavator" and "overseas promotion" in chats. Based on the tag knowledge graph built above, entity linking, semantic vectorization, and similarity matching were performed on the keywords "excavator" and "overseas promotion," determining that they have a strong semantic association with the "export trade intention of construction machinery products" tag under the "industry category" dimension in the multi-dimensional tag system. Therefore, this user is marked as a "customer with export trade intention of construction machinery products," that is, the corresponding industry tag is added to the customer, not simply the "foreign trade" tag.

[0322] Meanwhile, the tag weight gradually increases as the frequency of occurrence of the keywords "excavator" and "overseas promotion" increases; in addition, the emotion recognition module (combined with dialogue state machine verification) shows that the customer has repeatedly shown excitement, and the system further adds the "high interest" tag under the "emotional characteristics" dimension to the customer profile, thus completing the dynamic update of the customer profile.

[0323] In this way, tags can be generated and updated without human intervention, reducing labor costs, avoiding human error, and achieving a high degree of automation. At the same time, it is applicable to various cross-border trade communication scenarios and can be combined with intelligent reply and recommendation systems to provide users with personalized services.

[0324] In one embodiment, this application can also acquire and analyze session data corresponding to the session object in the target interaction environment to obtain session analysis information; wherein, the session data includes the interaction data of the session object in the current round; acquire the user profile of the session object; update the user profile using the session analysis information and the previous response processing data; generate candidate responses adapted to the updated user profile and session analysis information; wherein, the candidate responses are used to assist in generating interactive responses that respond to the interaction data.

[0325] In this implementation, a session object refers to an object participating in message interaction within the target interaction environment; specifically, a session object can be a user. A user profile refers to user characteristic description information formed based on the session object's historical interaction history, feature information, or preference information. Previous response processing data refers to the processing result data formed before the current round, based on generated, modified, or actually sent responses. Pending responses refer to selectable response content generated based on session analysis information and the updated user profile. Interactive responses refer to the content actually generated and used to respond to the current round's interaction data.

[0326] Specifically, the process involves acquiring and analyzing session data corresponding to the session object within the target interaction environment to obtain session analysis information that reflects the session characteristics embodied in the current round of interaction data. Subsequently, a user profile of the session object is acquired as the foundational information describing its existing characteristics. Combining the currently acquired session analysis information with previous response processing data, the user profile is updated to reflect changes in the session object during continuous interaction. Then, candidate responses are generated based on the updated user profile and session analysis information, and these candidate responses are used to assist in generating interactive responses. This process integrates the current round of interaction content, the existing characteristics of the session object, and the results of previous response processing, allowing the user profile to continuously adjust during interaction, thereby improving its ability to reflect the current needs and interaction characteristics of the session object. Generating candidate responses based on the updated user profile and session analysis information ensures that subsequent interactive responses are more closely aligned with the current round of interaction content and the characteristics of the session object, thus improving the targeting and adaptability of message interaction and enhancing the continuity, targeting, and relevance of subsequent response generation.

[0327] In one embodiment, obtaining and analyzing session data corresponding to the session object in the target interaction environment to obtain session analysis information includes: Extract the interaction data of the current round and the historical interaction data from the session data; The interaction data and historical interaction data are arranged and combined according to the time sequence of the conversation to obtain the content of the conversation to be analyzed; Semantic parsing is performed on the content of the conversation to be analyzed to determine one or more of the intent information, sentiment information, and conversation topic information of the content of the conversation to be analyzed; Based on one or more of the intent information, emotion information, and conversation topic information, determine the corresponding intent information, emotion information, and product keywords, and use them as conversation analysis information.

[0328] Among these, intent information refers to information used to characterize the purpose or need expressed by the conversation participants in the current conversation. Emotional information refers to information used to characterize the emotional state exhibited by the conversation participants in the current conversation. Product keywords refer to keyword information extracted from the conversation content that can characterize the product content that the conversation participants are interested in.

[0329] Specifically, by extracting current and historical interaction data from the conversation data, and then arranging and combining them according to the conversation's chronological order, the conversation content to be analyzed is formed, creating a continuous semantic link between the current expression and the historical context. Subsequently, semantic parsing is performed on the conversation content to identify one or more of the intent, emotion, and conversation topic information. Based on this, the corresponding intent, emotion, and product keywords are further determined and used as conversation analysis information. This process avoids the problem of incomplete information caused by analyzing only a single interaction from the current round. The resulting conversation analysis information not only reflects the current needs and emotions of the conversation participants but also accurately identifies the conversation topic and focus by combining historical interaction content. Furthermore, extracting product keywords after identifying the conversation topic information helps make the conversation analysis information more relevant to the current communication content, thereby improving the completeness of conversation understanding, the accuracy of semantic recognition, and the targeted nature of subsequent message processing.

[0330] In one embodiment, generating candidate responses that adapt and update the user profile and conversation analysis information includes: Based on intent information, emotional information, and product keywords, determine the style of the response template, the composition of the response, and the organization of the information for the current round; Based on the style of the response template and the information organization method, at least two matching response expression structures are determined from the preset response expression structures; Obtain the product keywords corresponding to the information that constitutes the response, extract the content elements corresponding to the product keywords from each conversation analysis information, and organize and fill the content elements according to at least two determined response expression structures to generate at least two candidate responses. Among them, at least two candidate responses differ in one or more aspects such as response length, semantic focus, and guiding expression.

[0331] Specifically, based on intent information, sentiment information, and product keywords, the style of the response template, the structure of the response, and the organization of information for the current round are determined to clarify the expressive characteristics, key elements, and organizational logic of the response in this round. Then, based on the response template style and information organization, at least two matching response expression structures are determined from the preset response expression structures to provide different expression frameworks for generating candidate responses. On this basis, product keywords corresponding to the response structure information are obtained, and content elements corresponding to the product keywords are extracted from the conversation analysis information. These content elements are then organized and filled according to the determined at least two response expression structures to generate at least two candidate responses. These candidate responses differ in one or more aspects, such as response length, semantic focus, and guiding expression. Through this process, multiple candidate responses with differentiated expressive characteristics can be generated based on the intent information, sentiment information, and product keywords corresponding to the current round. This avoids the problem of insufficient adaptation caused by generating only a single form of response, making the candidate responses more aligned with the current conversation analysis information in terms of expression and semantic presentation, and improving the relevance, flexibility, and selectivity of response generation.

[0332] In one embodiment, the candidate responses used to assist in generating response interaction data include: If there are multiple candidate responses, select one of them as the target candidate response. In response to the modification operation of the target candidate response, record the target candidate response, the modified response after modification, and the modification content; In response to the completion of sending the target candidate response or modified response, the actual target candidate response or modified response sent is recorded as an interactive response. Generate response processing data for the current round based on one or more of the target candidate responses, modified content, and interactive responses.

[0333] Here, "target candidate response" refers to the selected response from multiple candidate responses. "Modified response" refers to the response content formed after the target candidate response has been modified. "Modified content" refers to the content changes that have occurred relative to the target candidate response. "Response processing data" refers to the data generated during the selection, modification, and transmission of responses in the current round.

[0334] Specifically, when using candidate responses to assist in generating interactive response data, if there are multiple candidate responses, a target candidate response is first selected. When modifying the target candidate response, the target candidate response, the modified response, and the modified content are recorded. After the target candidate response or modified response is sent, the actually sent target candidate response or modified response is recorded as an interactive response. Based on one or more of the target candidate response, modified content, and interactive responses, the response processing data for the current round is generated. This system can correlate and record the selection, modification, and actual sending of responses in the current round, forming a complete data link in the response processing process. This provides a basis for subsequent analysis of the adoption, modification, and final output of responses in the current round, improving the traceability and data integrity of the response processing process, and facilitating more accurate data support for subsequent user profile updates or response optimization.

[0335] In one embodiment, updating the user profile using session analysis information and previous response processing data includes: Get the conversation analysis information for the current round, and get the previous response processing data corresponding to the conversation object; Based on the object identifier and session identifier of the session object, the session analysis information of the current round is associated with the previous response processing data to obtain profile update data; Based on the profile update data, update at least one of the following in the user profile: user intent preference, emotional tendency, and product attention preference.

[0336] Among these, object identifier refers to information used to identify the identity of a conversation object. Conversation identifier refers to information used to identify the current conversation. Profile update data refers to data used to update the user profile after associating the current round of conversation analysis information with the previous response processing data. User intent preference refers to information in the user profile reflecting the relatively stable or continuous intent tendencies of the conversation object during the interaction. Emotional tendency refers to information in the user profile reflecting the emotional expression trends exhibited by the conversation object during the interaction. Product attention preference refers to information in the user profile reflecting the degree or direction of attention the conversation object pays to different product content.

[0337] Specifically, the process involves acquiring conversation analysis information for the current round and obtaining previous response processing data for the corresponding conversation object. Then, based on the object identifier and conversation identifier of the conversation object, the conversation analysis information for the current round is correlated with the previous response processing data to obtain profile update data. Based on this, at least one of the user intent preferences, emotional tendencies, and product attention preferences in the user profile is updated according to the profile update data. This allows for the mapping of conversation characteristics reflected in the current round with the previous response processing, enabling targeted adjustments to the user profile based on existing response processing, thereby improving the user profile's ability to reflect changes in the interaction characteristics of the conversation object. By updating at least one of the user intent preferences, emotional tendencies, and product attention preferences, the user profile can more closely reflect the actual performance of the conversation object in continuous interaction, improving the accuracy and dynamic adaptability of the user profile.

[0338] In one embodiment, after generating candidate responses that adapt and update the user profile and conversation analysis information, the method further includes: Extract one or more of the user preference tags, communication style tags, and product interest tags from the updated user profile that correspond to the current round of conversation analysis information; Based on one or more of the user preference tags, communication style tags, and product focus tags, determine the filtering criteria for multiple candidate responses. The filtering criteria include one or more of the following: response length, tone and style, product information presentation order, and guidance expression method. The multiple candidate responses are matched with the filtering criteria to obtain the matching degree of each candidate response; At least one candidate response that meets the preset matching criteria is selected as the recommended candidate response.

[0339] Among them, user preference tags refer to label information used to characterize the preferred characteristics of conversation participants in message interaction. Communication style tags refer to label information used to characterize the preferred communication methods or expression methods of conversation participants. Product interest tags refer to label information used to characterize the focus of conversation participants on different product content. Filtering conditions refer to the conditions used to determine the degree of fit between multiple candidate responses and the user characteristics of the current round. Matching degree refers to the degree of conformity between the candidate responses and the filtering conditions. Recommended candidate responses refer to the candidate responses that are more suitable for use in the current round after filtering from multiple candidate responses.

[0340] Specifically, after generating multiple candidate responses, the system first extracts user preference tags, communication style tags, and product interest tags corresponding to the current round from the updated user profile, and uses these to form filtering conditions. This allows the selection of candidate responses to be combined with the current user characteristics, thereby improving the targeting of the filtering direction. Then, each candidate response is matched with the filtering conditions to distinguish the degree of suitability of each candidate response to the current round. This helps to identify more suitable responses from multiple results. Finally, candidate responses that meet the preset matching conditions are determined as recommended candidate responses. This ensures that the final recommendation results not only come from the response generation process but also further align with the updated user profile, thereby improving the accuracy and suitability of the recommended candidate responses.

[0341] In one embodiment, before acquiring session data in the target interactive environment, the method further includes: Obtain platform characteristic information of the target interaction environment; The platform feature information is matched with the preset platform feature template, and the platform adaptation parameters corresponding to the target interaction environment are determined based on the matching results. Based on platform adaptation parameters, the system controls the reading of session data, input of reply content, and control of message sending in the target interactive environment.

[0342] Among them, platform feature information refers to information used to characterize the characteristics of the target interaction environment in terms of session data structure, interaction method, interface form or message control rules; platform feature template refers to pre-set template information used to describe the corresponding feature patterns of different types of interaction environments; platform adaptation parameters refer to parameters such as data reading rules, content input rules and message control rules determined according to the matching results of platform feature information and platform feature template, used to adapt to the target interaction environment. Specifically, before acquiring and analyzing session data, the platform characteristic information of the target interaction environment is first obtained and matched with a preset platform characteristic template to determine the platform adaptation parameters corresponding to the target interaction environment. This ensures that subsequent processing is based on compatibility with the current platform. Then, based on the platform adaptation parameters, session data reading, reply content input, and message sending control are executed, enabling the session processing to adapt to the interaction methods of different target interaction environments. This improves the adaptability of session data acquisition and message interaction control. Before entering session analysis, platform-side adaptation of the target interaction environment is completed, which helps improve the accuracy and stability of subsequent session processing.

[0343] In one embodiment, obtaining the user profile of the session object includes: In response to a user profile that does not have a session object, retrieve the historical interaction data of the session object; In response to the existence of historical interaction data, an initial user profile of the session object is generated based on the historical interaction data and the preset profile initialization template, and the initial user profile is used as the user profile. In response to the absence of historical interaction data, an initial user profile of the session object is generated based on the interaction data of the current round and the preset profile initialization template, and the initial user profile is used as the user profile.

[0344] The profile initialization template refers to the pre-set template information used to generate the initial user profile. The initial user profile refers to the basic user profile generated when the session object does not yet have a corresponding user profile.

[0345] Specifically, when acquiring user profiles for conversation objects, if no user profile exists, the system first checks for historical interaction data. If historical interaction data exists, an initial user profile is generated based on this data and a pre-defined profile initialization template. This ensures the generated user profile reflects the conversation object's past interaction characteristics more effectively, improving the completeness of the user profile initialization result. If historical interaction data is unavailable, an initial user profile is generated based on the interaction data of the current round and the pre-defined profile initialization template. This allows the system to complete user profile initialization even when historical data is lacking, ensuring the continuity of the user profile generation process. Through this approach, the appropriate initialization path can be selected based on different data foundations, enabling user profiles to be established in various scenarios and improving the flexibility and applicability of user profile initialization.

[0346] In one embodiment, for example, the system employs a combination of a unified adaptation interface specification and a plug-in extension architecture to achieve compatible integration with WhatsApp (an instant messaging platform). The system predefines a unified adaptation interface specification, which includes message reading interfaces, message sending interfaces, interface element location interfaces, event listening interfaces, and exception feedback interfaces. The WhatsApp plugin is developed according to the unified adaptation interface specification and encapsulates the platform's corresponding message reading logic, input invocation logic, sending trigger logic, and exception handling logic. After system startup, the plugin registration information is loaded, and the WhatsApp plugin is initialized, making it callable.

[0347] During the adaptation process, the system first acquires features from the WhatsApp Web page, including the conversation list area, message display area, input editing area, send icon, and page event response characteristics. These page features are then matched against preset platform feature templates. After matching, a platform adaptation configuration corresponding to WhatsApp is generated. This configuration includes DOM (Document Object Model) element positioning parameters, message extraction rules, input call parameters, send control parameters, and exception fallback parameters. The WhatsApp plugin then uses this platform adaptation configuration to read messages, locate interfaces, call input, and control send, thus adapting the message interaction process.

[0348] When a WhatsApp Web page version update is detected, causing existing element paths to become invalid, the system re-extracts page structure features and updates the corresponding parameter mapping relationships to regenerate the platform adaptation configuration. This allows plugins to regain their adaptability without rewriting the overall logic. The system can identify, match, and generate adaptation configurations for the target interaction environment under a unified interface specification, enabling upper-layer session processing logic to call the corresponding plugins to complete message interactions. This improves platform access efficiency and the stability of the adaptation process.

[0349] In the communication scenario of foreign trade in the construction machinery industry, users communicate with customers via WeChat or WhatsApp. The platform adaptation module loads the corresponding plugins according to the current interaction environment and completes the adaptation of conversation reading, reply input, and message sending based on the platform interface features. The data acquisition module acquires chat content, organizes and filters it, and sends the processing results to the intent analysis module. The intent analysis module performs semantic analysis on the conversation text to identify the customer's current purchasing needs and emotional tendencies. The first reply generation module calls the knowledge base in the construction machinery field based on the analysis results to generate candidate replies that match the current communication content. After selecting a candidate reply, the user can edit and send it according to the actual communication needs. The profile management module updates the customer profile by combining keyword information, reply processing data, and subsequent feedback content. The updated customer profile continues to participate in subsequent rounds of intent analysis and reply generation to improve the recognition accuracy and reply matching effect in subsequent communications.

[0350] In one embodiment, within a financial services scenario, users communicate with customers through a target interactive environment. The platform adaptation module acquires current platform characteristics and loads corresponding plugins, completing message reading, content input, and sending control adaptation. The data acquisition module acquires the chat content sent by the customer, cleans and structures the conversation data, and then sends the processing results to the intent analysis module. The intent analysis module analyzes the conversation content, identifying the types of financial products the customer is interested in, their risk preferences, and their current consultation focus. Based on the analysis results, the first response generation module extracts corresponding information from the financial product database and preset response templates, generating candidate responses that match the customer's needs; users can edit these responses before sending. The profile management module dynamically updates the customer profile based on keyword information and feedback from multiple rounds of communication. The updated user profile participates in subsequent rounds of intent recognition and response generation, enabling the system to continuously adapt to changes in customer needs and improve the relevance and continuity of financial service communication.

[0351] In one embodiment, the system receives conversation data from WeChat Work, WhatsApp (an instant messaging platform), and other interactive environments, and first enters the platform access layer. The platform access layer performs platform identification, anomaly monitoring, plugin loading, protocol translation, field mapping, interface positioning, and sending control on the target platform, enabling message reading, input calls, and sending operations from different platforms to be converted into a unified processing form. The data processed by the platform access layer enters the standardization interface layer, which organizes data and control information from different sources into a unified event structure, a unified control command structure, a unified anomaly feedback structure, and a unified message structure. After standardization, the data enters the data acquisition and preprocessing layer, where behavior acquisition, text acquisition, and voice acquisition units acquire corresponding types of data, and combine this with time series processing, encoding standardization, round-context concatenation, and structured message generation to form analyzable structured conversation content. Subsequently, the structured conversation content enters the intelligent analysis layer, where text recognition, intent extraction, topic recognition, emotion recognition, customer stage judgment, and risk signal recognition units complete the analysis and processing. The analysis results are transmitted to the knowledge and generation layer, where units such as knowledge base retrieval, terminology constraints, multi-style generation, candidate response sorting, and response result output generate potential answers. Simultaneously, they are transmitted to the profiling and feedback layer, where processing units such as preference change detection, silence time analysis, profiling tag updating, response strategy correction, and identification strategy correction update customer profiling and feedback optimization. The generated potential answers are finally output to the interactive display layer, where units such as response suggestion display, user editing, user selection and sending, and result recording complete the human-computer interaction, thus forming a complete closed-loop processing chain covering platform access, data analysis, response generation, profiling updates, and feedback optimization.

[0352] In one embodiment, after the system initiates the platform adaptation process, it first receives the platform type selected by the user and loads the corresponding platform recognition mechanism. Subsequently, the system collects environmental information of the target platform, including window features, window orientation features, message area layout features, input area position features, control hierarchy features, message extraction method features, interaction response features, and resolution and scaling ratio features. Based on the collected environmental information, the system forms a target platform feature dataset and matches it with pre-saved platform templates. Upon successful matching, the system generates a platform recognition result and further generates a platform adaptation configuration. The platform adaptation configuration includes field mapping rules, chat area positioning parameters, contact area positioning parameters, input box positioning parameters, send control trigger parameters, exception fallback parameters, and version compatibility parameters. Based on the platform adaptation configuration, the system establishes a message reading module, a send control module, an interface positioning module, and an input call module, and obtains the contact area recognition result, send control area recognition result, chat message area recognition result, and input box area recognition result to form a comprehensive platform adaptation result. During operation, the system continues to monitor changes in the platform interface. When it detects control malfunction, field malfunction, resolution change, version change, or layout change, it triggers an exception rollback and re-identification process. This process re-acquires platform feature data, updates platform adaptation configuration, restores the control positioning and message reading structure, and continues to perform adaptation operations. Through this process, compatible integration across different platforms, versions, interface layouts, and resolutions can be achieved without rewriting the overall plugin logic.

[0353] In one embodiment, after the system activates the data acquisition module, it triggers a data acquisition task according to a preset cycle to capture raw data in the chat area. The raw data includes text data, voice data, behavioral data, timestamp data, and session switching records. After acquisition, the system performs data preprocessing, including noise reduction, invalid segment filtering, encoding standardization, message segmentation, multi-turn context concatenation, and temporal alignment. The preprocessed data enters the text recognition and structured conversion stage. The system performs speech-to-text processing on the voice content, standardization processing on the text content, and further completes message role recognition, session object recognition, and structured message generation. Afterward, the system loads an industry corpus fine-tuning model and performs intent analysis and sentiment recognition on the structured messages. Intent analysis includes identifying inquiry intent, logistics consultation intent, after-sales communication intent, general consultation intent, and purchasing intent; sentiment recognition includes identifying positive, neutral, urgent, hesitant, and negative emotional states. Simultaneously, the system also performs keyword and topic extraction and customer stage judgment, and summarizes the various recognition results to form a comprehensive analysis result. The comprehensive analysis results further generate intent information, sentiment information, topic tags, and stage tags, which are then output to the response generation module and the profile management module, respectively. After each round of analysis, the system records the analysis results; when the initial data collection and analysis is completed, subsequent analysis processes are automatically triggered, thereby achieving continuous analysis and dynamic tracking of conversation content.

[0354] In one embodiment, after receiving the analysis results, the system extracts sentiment information, customer stage tags, intent information, and topic tags. These are then combined with industry preference tags, historical response preferences, historical interest tags, and initiative frequency tags from the customer profile, as well as silent time records, to construct response generation conditions. Based on these conditions, the system accesses resources such as the consultation knowledge base, product parameter retrieval, business terminology retrieval, scenario-based dialogue retrieval, and frequently asked questions retrieval. It then generates candidate responses by combining friendly style parameters, length control parameters, risk constraint parameters, and professional style parameters. Candidate responses can include friendly style responses, concise style responses, in-depth explanation style responses, and professional style responses. After generating candidate responses, the system sorts them, considering style matching scores, user consistency scores, business constraint verification, and relevance scores. The sorting results are then output to the interactive interface. Users can browse candidate responses in the interactive interface, edit them, or directly select a response. The system then sends the response and records the sending result. After sending, the system updates the customer profile, including updated topics of interest, industry preferences, activity level, risk status, and response preferences. After the profile is updated, the system generates further warning results, including warnings of communication stagnation, weakened intent, and decreased interest. Simultaneously, the system generates feedback information, including identification correction information, strategy adjustment rules, response style adjustment parameters, and knowledge base retrieval priority adjustment information. Part of this feedback is sent to the intent analysis module, and the other part is sent to the response generation module, thus initiating the next round of closed-loop interaction to continuously optimize subsequent conversation analysis and response generation.

[0355] In one embodiment, outputting candidate responses includes: determining response preference features corresponding to the conversation object based on response processing data; calculating the matching degree of at least two generated candidate responses based on the response preference features; sorting the at least two candidate responses based on the matching degree calculation results; and outputting the at least two candidate responses according to the sorting results.

[0356] Among them, response preference features refer to the feature information extracted from historical response processing to characterize the conversation object's preference for response style, expression, content structure, or response tendency; matching degree calculation refers to the process of analyzing the correspondence between each candidate response and the response preference features to determine the degree of fit between each candidate response and the response preference features; ranking result refers to the order result formed according to the matching degree of each candidate response.

[0357] Specifically, by analyzing response processing data, response preference features corresponding to the conversation partner can be extracted from the actual response selection, modification, and sending. This allows response preferences to move beyond preset levels and establish a correspondence with the actual communication process. After obtaining the response preference features, the matching degree of multiple candidate responses is calculated separately, and the results are sorted. This ensures that the candidate responses output at the top are closer to the communication characteristics and usage needs of the conversation partner. This processing method can improve the targeting of candidate responses, reduce the cost for users to filter and adjust among multiple responses, and also improve the adaptability of candidate responses to the actual communication scenario.

[0358] In one embodiment, updating the user profile corresponding to the session object based on interaction samples includes: extracting expression adjustment information for the target candidate response content from the modified content; generating expression correction rules corresponding to the session object based on the expression adjustment information; associating the expression correction rules with the user profile; and adjusting the response expression structure based on the expression correction rules when generating candidate responses or new candidate responses in the future.

[0359] Among them, expression adjustment information refers to information that reflects changes in expression when users modify the content of the target candidate response, including changes in wording, tone, content additions or deletions, or structural adjustments; expression correction rules refer to rule information summarized based on expression adjustment information, used to guide the adjustment of subsequent response expression; response expression structure refers to the structured expression form of the response content in terms of word choice, tone organization, sentence arrangement, content hierarchy, or expression order.

[0360] Specifically, by extracting expression adjustment information from the modified content, the user's expression habits and revision tendencies during the actual editing process can be preserved, enabling the user's modification behavior of the candidate response to be transformed into usable data. Based on this, expression correction rules are generated and linked to the user profile, allowing the user profile to not only reflect the needs of the conversation partner, but also to further reflect the user's modification habits in response expression. When subsequent candidate responses or new candidate responses are generated, the response expression structure is adjusted based on the expression correction rules, making the generated results closer to the user's actual expression style and reducing repeated modifications.

[0361] In some embodiments, the business scenario can be understood as the industry. Users can pre-select their industry and communication platform type on the login or initialization interface. The system automatically matches the corresponding intelligent interaction strategy based on the dual-dimensional configuration rules of "industry dimension + platform dimension". The industry can include at least foreign trade, cross-border e-commerce, recruitment, corporate office, customer service, or logistics. The communication platform can include at least heterogeneous platforms such as WeChat Work and WhatsApp. Specifically, the system can load the corresponding platform plugin based on the user's selection, and further load the exclusive prompt template, domain rule library, and terminology constraint set corresponding to the industry. At the same time, it can call the fine-tuning model branch or model adaptation parameters corresponding to the industry, so that the subsequent message understanding and response generation process has both platform adaptation capability and industry adaptation capability. Preferably, in the generation stage, a collaborative reasoning mechanism can be executed according to a preset priority: "strong industry constraint rules first, platform format rules second, and general generation logic supplemented".

[0362] In some embodiments, in foreign trade business scenarios, the system can call upon a foreign trade scenario training corpus constructed based on historical foreign trade chat records, inquiry and quotation corpora, product information, logistics and customs declaration information, payment terms text, multilingual communication corpora, customer order tracking records, and industry terminology dictionaries. This corpus is processed through data cleaning, noise reduction, anonymization, semantic segmentation, tagging, terminology normalization, multilingual alignment, and scenario classification. The system then performs efficient parameter fine-tuning or phased domain-specific enhancement training on a basic pre-trained model to form specialized generation and understanding capabilities for foreign trade communication scenarios. Preferably, the specialized generation and understanding capabilities include at least: cross-border trade terminology recognition, inquiry and quotation intent recognition, logistics and customs clearance intent recognition, long-cycle order tracking context maintenance, multilingual business expression generation, and customer-style adapted response generation.

[0363] In some embodiments, after the platform adaptation is completed for the first time, the system can also save the platform type, coordinate information, plugin configuration and related adaptation parameters to the local storage area; when the user logs in again, the saved adaptation configuration can be directly called, thereby reducing repeated initialization and repeated adaptation operations; preferably, when a platform version update, window layout change or historical adaptation configuration failure is detected, a new round of adaptation process is triggered to update the adaptation configuration.

[0364] In one embodiment, a message interaction method is provided, which can be implemented by a computer program, which may be an artificial intelligence assistant, including the following steps: Step 901: Based on the message acquisition rules corresponding to the target interaction environment, acquire the original message data in the target interaction environment, and convert the original message data into standard message data; Step 902: Determine the message interaction operation mapping relationship based on the interface area features and interaction operation positioning features of the target interaction environment; Step 903: Obtain the business scenario corresponding to the standard message data, determine the message generation branch corresponding to the business scenario in the pre-trained message generation agent, and generate reply message data corresponding to the standard message data through the message generation branch; Step 904: Generate an interactive response adapted to the target interactive environment based on the reply message data, and send the interactive response to the target interactive environment based on the message interaction operation mapping relationship.

[0365] The aforementioned message interaction method unifies the conversion and processing of message content in different message interaction environments, enabling message data from different sources and with varying formats to enter a more suitable processing flow, reducing the impact of environmental differences on message recognition and processing. Furthermore, by combining the interface state and interaction position relationships of the target interaction environment, the output position and interaction path of the reply message are adapted, ensuring that the reply content can be accurately sent in the corresponding environment. Additionally, by generating corresponding reply content based on the business scenario to which the message belongs, the matching degree between the reply result and the actual message semantics and application requirements is improved. This achieves the technical effects of enhancing cross-environment message processing compatibility, improving reply sending accuracy and interaction execution stability, and enhancing the relevance and accuracy of reply content, thereby solving the problems of poor cross-environment compatibility, high adaptation costs, and insufficient interaction stability in existing technologies.

[0366] In one embodiment, before acquiring the original message data in the target interactive environment, the method further includes: in response to receiving an interactive environment selection instruction, determining the interactive environment corresponding to the interactive environment selection instruction as the target interactive environment from a plurality of pre-stored interactive environments.

[0367] In one embodiment, the message acquisition module is used to acquire raw message data in the target interaction environment based on message acquisition rules corresponding to the target interaction environment, including: Based on the environment type, data interface open status, and message access permissions of the target interaction environment, determine the message acquisition rules corresponding to the target interaction environment; The target interaction environment can refer to the application interface, web page, embedded session page, message window in remote desktop, message module in enterprise office system, or other interactive environment that can display and input messages, which carries out the message sending and receiving process; the environment type can include local application environment, web application environment, hybrid application environment, virtualization runtime environment, or remote mapping environment, etc.; the data interface open status can be used to characterize whether the target interaction environment provides callable data interfaces, cache interfaces, system auxiliary interfaces, page object interfaces, or underlying storage access interfaces; message access permissions can refer to whether the current device, current user account, or current auxiliary program has the authorized ability to read message content, session records, cached data, or interface information; Based on the message retrieval rules, determine the available message retrieval methods corresponding to the target interaction environment; The message acquisition rules can be understood as a set of acquisition constraints and execution strategies pre-configured or dynamically determined for the target interaction environment. Preferably, the message acquisition rules can include at least: acquisition priority, accessible data source type, access path, field reading method, exception rollback method, and interface recognition method. The message acquisition rules can be pre-stored in a rule configuration table or rule base and determined by indexing based on environment type, application identifier, application version number, operating system type, and permission status. For example, for desktop applications that provide local database access capabilities, the storage area reading method can be used first; for web chat pages that do not expose the underlying data interface, the interface image recognition method can be used first. The available message acquisition methods may include one or more of the following: acquiring by calling a data interface, acquiring by accessing a local database, acquiring by accessing a cache file, acquiring by accessing a log file, acquiring by accessing a page object model, acquiring by acquiring system auxiliary function tree information, and acquiring by image recognition through an interactive interface. Preferably, the available message acquisition methods can be determined by cross-judging the allowed acquisition methods in the message acquisition rules with the actual accessibility of the current environment. Specifically, it can be first detected whether there is an accessible data interface or storage area in the target environment. If so, it can be further verified whether the current permission meets the reading conditions. If it does, the corresponding data reading method is determined as the available message acquisition method. If it does not, the interface image recognition method is determined as the available message acquisition method. In response to the available message acquisition method indication that access to the data storage area is permitted, the data storage area corresponding to the target interaction environment is accessed, the interaction message-related data is read, and the original message data is generated based on the read message-related data; The data storage area may include a local database, cache directory, message log file, browser local storage area, session cache area, message node set in page object model, or other data carriers used to store message content, corresponding to the target interactive environment. Message-related data may include, but is not limited to: message identifier, session identifier, sender identifier, receiver identifier, message body, timestamp, attachment identifier, message status, session sequence number, and reference message relationship. Preferably, when generating original message data based on the read message-related data, multiple read message fields can be assembled into an original message data structure corresponding to a single message or multiple message records according to a preset field combination method. For example, "sender account", "message text", "sending time", "message type" and "session number" can be combined into an original message record. In response to an indication that access to the data storage area is not permitted by the available message acquisition method, the interactive interface image of the target interactive environment is acquired, interactive message-related data is identified based on the interactive interface image, and raw message data is generated based on the identified interactive message-related data. The interactive interface image can be obtained by capturing the current display window of the target interactive environment, capturing a specified session area, obtaining a screenshot of the current interface of the mobile terminal, or collecting the content of the graphic display buffer. Preferably, the interactive interface image can be a static single-frame image or a continuous multi-frame interface image. The recognition result obtained by recognizing the interactive interface image can include the text recognition result, component detection result, region segmentation result, and layout relationship recognition result. Specifically, when recognizing the interactive interface image, the message bubble area, sender identifier area, time display area, and message body area can be identified first. Then, based on the vertical position relationship, left-right belonging relationship, or time proximity relationship between the areas, information belonging to the same message can be aggregated to generate the original message data. Preferably, for continuous multi-frame interface images, duplicate messages in adjacent frames can also be deduplicated to reduce redundant data caused by repeated recognition. The raw message data may also include text actively entered by the user.

[0368] Specifically, in this embodiment, by selecting a suitable message acquisition method based on the environment type, data interface openness, and message access permissions of different target interaction environments, the message data acquisition process can be adjusted according to the actual openness and access conditions of the target environment. When data access conditions are available, the original message data can be directly constructed based on the underlying message-related data; when data access conditions are not available, the original message data can be obtained by recognizing the interactive interface image. Therefore, message data acquisition can be achieved in message interaction environments with different levels of openness and access conditions, improving the applicability and environmental compatibility of the message acquisition process, thereby solving the technical problem in the prior art where message data is difficult to acquire stably due to platform interface differences and access restrictions.

[0369] It is worth noting that, in scenarios where access to the data storage area is not permitted in response to an available message acquisition method, and the original message data is obtained through interactive interface image recognition, the acquired interactive interface image, in addition to containing the target message content, may also contain contact names, account identifiers, historical dialogue fragments, time information, business data, window title information, and other interface content unrelated to the current message to be replied to. If such interface images or the plaintext message content directly identified by them are directly input into the subsequent intelligent processing chain, it is easy for privacy information unrelated to the target message to be processed as well, thereby increasing the risk of sensitive information exposure. Especially when existing solutions already include OCR (Optical Character Recognition), interface element localization, standardized structured output, and subsequent reply generation processing, if a privacy protection mechanism is not further introduced into the image acquisition branch, although message recognition and automatic reply can be achieved, there is still a possibility of excessive exposure of plaintext messages, truly sensitive fields, or real location information during the processes involving partial screen capture, text recognition, and write-back localization.

[0370] In a further embodiment, the message acquisition module is further configured to set a local privacy protection domain between the message agent and the target interaction environment; in response to an indication by an available message acquisition method that access to the data storage area is not permitted, the module acquires an interactive interface image of the target interaction environment and generates raw message data based on the recognition result of the interactive interface image; the module also includes: By using a local privacy protection domain, local cropping and image recognition are performed on the target message area in the interactive interface image to obtain the recognized content corresponding to the target message. The local privacy protection domain refers to a local processing area set up locally on the terminal device for performing sensitive information isolation processing; preferably, the local privacy protection domain is used to perform local image cropping, sensitive field desensitization, mapping relationship saving, reply frame backfilling, and message writing back; Based on preset local privacy protection rules, sensitive fields in the identified content are de-identified and replaced to generate de-identified content, and a local mapping relationship between sensitive fields and corresponding placeholders is established. The target message area can refer to a local area in the interactive interface image that corresponds to the message to be processed. Preferably, the target message area can be the message area selected by the user, the latest message area in the current session, or the candidate message area determined after the message bubble is identified. By only capturing the target message area, irrelevant interface information can be reduced from being processed together. Among them, local privacy protection rules can refer to a set of local rules used to identify sensitive fields, perform de-identification and replacement, and control the scope of mapping relationship storage; preferably, local privacy protection rules can be pre-configured in the local rule base and called according to business scenarios. For example, in foreign trade business scenarios, local privacy protection rules can prioritize identifying customer name, company name, product model, quotation amount, and delivery date information. The local mapping relationship can refer to the correspondence between placeholder markers and the original sensitive field content; preferably, the local mapping relationship is bound to the current session and is stored only in the local privacy protection domain. Semantic skeleton information is extracted based on the de-identified content, and the semantic skeleton information is written into the de-identified semantic field corresponding to the standard message data; Sensitive fields may include one or more of the following: name, company name, contact information, product model, price information, delivery date information, or order information; desensitization and replacement may refer to replacing sensitive fields with placeholders that do not contain real content; preferably, placeholders may be generated in the form of "field category + serial number", such as [name1], [product1], [amount1]; The semantic skeleton information refers to the information that can still represent the core semantics of the target message after removing the real sensitive field content. Preferably, the semantic skeleton information includes at least the interaction intent, logical relationship and key business slot. For example, after desensitizing "Mr. Li, please confirm whether the ZX300 price of 480,000 includes shipping and how long the delivery time is", it can be extracted as "Confirm / Consult - Product Price - Whether Shipping Includes - Inquire about Delivery Time". The desensitized semantic field can refer to the field in the standard message data used to store the desensitized semantic content. The message content of the intelligent agent generated by the subsequent input message is the content in the desensitized semantic field, rather than the original plaintext field content. Standard message data containing semantic skeleton information is input into a pre-trained message generation agent, so that the message generation agent can determine the corresponding message generation branch based on the business scenario corresponding to the standard message data, and generate response framework information through the message generation branch. The response framework information can refer to the response skeleton, response template, or response candidate content generated by the message generation branch that has not yet been filled with the actual sensitive field content; preferably, the response framework information retains placeholder markers corresponding to the local mapping relationship so that local filling can be performed later. In response to receiving the reply framework information, placeholder backfilling is performed on the reply framework information based on the local mapping relationship to generate reply message data; Based on locally saved input area positioning rules or focus anchoring rules, the reply message data is written to the input area corresponding to the target interaction environment; Among them, the input area positioning rule can refer to the local rule used to determine the location of the input area in the target interactive environment; preferably, the input area positioning rule can be generated through the initial calibration operation, or it can be determined through the existing interface recognition and OCR anchor point positioning process; the focus anchoring rule can refer to the write-back rule that performs content writing based on the current input focus. After the write operation is completed, the local mapping relationship corresponding to this session is deleted, destroyed, or invalidated. Among them, deletion, destruction or invalidation processing can refer to the processing that makes the local mapping relationship corresponding to this session unusable after the reply message data is written. Preferably, the processing can be triggered after the user sends the message, after the session ends, or after the preset timeout period is reached.

[0371] Specifically, in this embodiment, by setting a local privacy protection domain between the message generating agent and the target interaction environment, the processing of partial cropping of the interactive interface image, image recognition, sensitive field desensitization, semantic skeleton extraction, placeholder mapping establishment, reply framework backfilling, and write-back positioning is preferably completed locally. Only the desensitized semantic content is included in the standard message data and input into the message generating agent. On the one hand, this allows the original interactive interface image, original plaintext message, sensitive field mapping relationship, and real input positioning information to be preferably retained locally, reducing the exposure range of sensitive data in the processing chain. On the other hand, it can continue to reuse the unified processing framework of standard message data, business scenario identification, message generation branch selection, and reply generation in the existing solution. This ensures the accuracy of reply generation and cross-platform adaptability while improving data security, privacy protection capabilities, and system practicality in message acquisition scenarios based on image recognition.

[0372] In one embodiment, the message acquisition module is further configured to convert the raw message data into standard message data, including: Parse the preset general message format to obtain standard fields and extended fields, and determine the standardized processing rules corresponding to the original message data. The standardized processing rules include at least: field extraction rules, standard field mapping rules, and extended field encapsulation rules. The general message format can refer to a data organization template used to uniformly describe message data from different sources. Preferably, the general message format can be represented in the form of structured objects, such as key-value pairs, table records, or object instance structures. Standard fields are used to carry fields that are common in different message interaction environments and provide basic support for subsequent processing. Extended fields are used to carry additional fields that are unique to different platforms but may participate in subsequent analysis. Preferably, standard fields can include one or more of the following: message identifier, session identifier, sender identifier, receiver identifier, message text content, message type, sending time, attachment information, context identifier, and reference relationship. Extended fields can include platform-specific fields such as emoji codes, platform-specific status codes, interface display style tags, original component attributes, and business tags. The standardized processing rules can be pre-configured based on the source type, field naming conventions, data hierarchy, and known message templates of the target interaction environment, or they can be automatically generated after statistical analysis of historical sample data. Preferably, the standardized processing rules can be stored in a rule mapping table and indexed by environment type, application identifier, message data version number, or field pattern characteristics. Field extraction rules are used to indicate the path, location, or parsing method for extracting message fields from the original message data. Standard field mapping rules are used to indicate the mapping relationship between candidate message fields and standard fields. Extended field encapsulation rules are used to indicate how the remaining fields not mapped to standard fields are saved in the form of extended fields. Based on field extraction rules, field parsing is performed on the original message data to obtain multiple candidate message fields; The field extraction rules can include field name matching rules, hierarchical path extraction rules, regular expression extraction rules, page node attribute extraction rules, or field recognition rules based on semantic annotation. Preferably, when the original message data is structured data, it can be extracted directly through field path or field name; when the original message data is semi-structured data, it can be extracted through key-value pattern matching and regular expression parsing; when the original message data is the result of image recognition conversion, it can be extracted through region labels, text block categories, and positional relationships. Multiple candidate message fields can be understood as a set of fields that may correspond to semantics such as message content, sender, time, and status, which are initially identified from the original message data. Based on the standard field mapping rules, determine whether the candidate message field matches the standard field. If so, map the candidate message field to the corresponding field position of the standard field. Otherwise, according to the extended field encapsulation rules, encapsulate the candidate message field to the field position of the extended field. The standard field mapping rules can be determined through one or more of the following methods: field name matching, field data type matching, field value pattern matching, and field semantic similarity matching. Specifically, it can first be determined whether the candidate message field name matches or is similar to the standard field name. If they do not match, it can be further determined whether the data type, value characteristics, and contextual semantics of the candidate message field match the expected characteristics of a certain standard field. If they match successfully, the candidate message field is mapped to the corresponding standard field. Preferably, for candidate message fields that cannot be matched to standard fields but have retention value, they can be written into the corresponding field position of the extended field in the form of key-value pairs, sub-objects, or field sets according to the extended field encapsulation rules. Based on the candidate message fields mapped to the corresponding field bits of the standard fields and / or the candidate message fields encapsulated to the corresponding field bits of the extended fields, standard message data corresponding to the original message data is generated.

[0373] Specifically, when generating standard message data based on candidate message fields mapped to the corresponding field positions of standard fields and / or candidate message fields encapsulated to the corresponding field positions of extended fields, a standard message data template can be constructed first, and then the mapped candidate message fields can be written into the corresponding standard field positions. Unmapped but retained candidate message fields can be uniformly written into the extended field positions, thereby forming standard message data with a unified structure. Preferably, for field positions that were not successfully extracted but belong to the required standard fields, null values, default values, or pending completion indicators can be filled in to maintain the integrity of the standard message data structure. For example, default values ​​can include empty strings, empty arrays, empty objects, system default timestamps, or preset default indicators.

[0374] Specifically, in this embodiment, a pre-defined general message format is used, and based on corresponding field extraction, field mapping, and extended encapsulation mechanisms, raw message data from different sources and with different structures are uniformly organized. This enables heterogeneous message content in different message interaction environments to be converted into standard message data with a matching organizational form. This reduces the impact of differences in field naming, data structure, and content organization of raw message data on subsequent processing, improves the matching and reusability of message data processing, and thus solves the technical problem in existing technologies where message data from different sources is difficult to parse uniformly and cannot be directly entered into the same processing flow.

[0375] In one embodiment, the location mapping module is further configured to determine the message interaction operation mapping relationship based on the interface area features and interaction operation location features of the target interaction environment, including: Obtain environmental feature data of the target interactive environment. The environmental feature data includes window display information, interface layout information, interface text information, and interface component information. Among them, the interface component information includes various components and component layout information used to describe the layout relationship of each component. Based on environmental feature data, determine the interface area features and interactive operation positioning features of the target interactive environment; Based on the characteristics of the interface area and the positioning characteristics of the interactive operation, a correspondence is established between the standard message operation type and the corresponding target operation location and / or target operation range to obtain the message interaction operation mapping relationship.

[0376] The environmental feature data can be obtained through one or more of the following methods: calling the operating system window management interface to obtain window information; calling the accessibility interface or accessibility interface to obtain interface control tree information; reading the page object model to obtain page layout and component attributes; obtaining the current interface image and performing image recognition; or combining the above methods for fusion analysis; window display information can include window size, window position, window hierarchy, whether the window is active, and scaling ratio; interface layout information can include area distribution, control arrangement direction, column structure, container nesting relationship, and scroll area position; interface text information can include interface label text, button text, placeholder text, title text, and conversation content text; interface component information can include input boxes, buttons, send controls, attachment controls, emoticon controls, list containers, and their attribute information.

[0377] In one embodiment, the location mapping module is further configured to determine the interface area features and interactive operation location features of the target interactive environment based on environmental feature data, including: Based on the window display information, determine the display range and coordinate reference corresponding to the target interactive environment; The display range can refer to the visible area of ​​the target interactive environment in the current device display coordinate system, and can preferably be represented as a rectangular boundary or a polygonal boundary; the coordinate reference can refer to the reference coordinate system used to uniformly describe the position of each interface element; preferably, the coordinates of the upper left corner of the target window can be determined as the coordinate origin, or the coordinates of the upper left corner of the entire display screen can be determined as the coordinate origin; in some embodiments, a normalized coordinate method can also be used, with the window width and height as the normalization reference; Based on the display range, coordinate reference and interface layout information, multiple interface message areas in the target interactive environment are initially located to obtain multiple initial area positions. The initial positioning of multiple interface message areas can be obtained through a coarse positioning method based on layout priors. Specifically, it can be determined whether the page adopts a layout form of vertical partitioning, horizontal column splitting, or list plus editing area based on the interface layout information. Then, based on the common regional distribution patterns of message interfaces in various layouts, the message display area, message input area, and message operation area are initially defined. For example, in common chat interfaces, the message display area is usually located in the middle or upper continuous scrolling area, the message input area is usually located in the area where the bottom input controls are located, and the message operation area is usually located near the input area or in the toolbar position of the message display area. Based on the interface text information, extract multiple text anchors related to message interaction and multiple anchor positions that correspond one-to-one with the text anchors. Here, text anchors can refer to key text identifiers used to assist in identifying functional areas of the message interface. Preferably, text anchors can include words such as "send," "enter message," "reply," "chat history," "search," "emoticon," "attachment," and "new message," or text with equivalent semantics; the anchor position can be obtained through the coordinates of the corresponding text box after text recognition; preferably, each text anchor and its position can be obtained by performing text recognition, keyword retrieval, and text region positioning on the interface text information; Based on multiple initial area positions, multiple anchor point positions, and component layout information, the positions of multiple interface message areas are calibrated to determine multiple target areas and their corresponding target area positions. The target areas include at least one or more of the following: message display area, message input area, and message operation area. Among them, component layout relationships can refer to the relative spatial relationships, containment relationships, alignment relationships, adjacency relationships, and hierarchical relationships between interface components. Specifically, when calibrating the positions of multiple interface message areas based on multiple initial area positions, multiple anchor point positions, and component layout information, the initial area positions can be used as candidate areas first, and then the semantics of the areas can be verified based on the text anchor points. For example, if an area is adjacent to the "send" text button and the input box component, the confidence of the area being identified as a message input area or a message operation area can be increased. Then, the area boundaries can be fine-tuned by combining the component layout information. For example, the input box component and its adjacent send button can be included in the message input related area, and finally, multiple target areas and their target area positions can be determined. Generate interface region features based on the region categories and boundaries corresponding to the locations of multiple target regions; Among them, the region category is used to characterize the functional attributes of the target region, such as message display area, message input area or message operation area; the region boundary is used to characterize the spatial range of the target region, which can preferably be represented by the coordinates of the upper left corner, the coordinates of the lower right corner, width and height parameters, or a set of vertices; the interface region features can include at least the region categories, region boundaries, relative positional relationships and hierarchical relationships of multiple target regions; Based on the characteristics of the interface area and the information of the interface components, interactive objects in multiple target areas are identified, and the interactive operation items and the interaction range of each interactive object are determined. Interactive objects refer to interface objects on which users or the system can perform operations such as clicking, inputting, long-pressing, pasting, dragging, and confirming. Preferably, these include input boxes, send buttons, confirm buttons, conversation entry points, message card operation buttons, attachment buttons, and quick reply entry points. Interactive operation items refer to the operation types corresponding to interactive objects, such as clicking, inputting text, pasting content, triggering sending, or switching conversations. The object interaction range refers to the interface range within which valid operations are allowed to be performed on a particular interactive object. Preferably, this range can be directly determined by the component boundaries, or it can be obtained by adding a preset safety margin outside the component boundaries. The preset safety margin can be set according to the control size, for example, it can be set to 2% to 10% of the control's width and height. Based on the object interaction range, target area location, and coordinate reference, determine the object operation position corresponding to each interactive object; The object operation position can be understood as the preferred target position for performing the interactive operation within the object's interaction range. Specifically, the object operation position can be obtained in the following ways: first, determine the geometric center position of the object's interaction range; if the interactive object has a hot spot area offset, for example, the send icon is located on the right side of the button, then the center of the hot spot area is taken as the object operation position; if the interactive object is an input box, then a safe input point inside the input box that avoids the boundary can be selected as the object operation position. Based on the interactive operation items, operation positions, and interaction ranges of each interactive object, generate interactive operation positioning features to at least characterize the operation position and / or operation range corresponding to the message interaction operation executed in the target interactive environment. Based on the characteristics of the interface area and the positioning characteristics of the interactive operation, a correspondence is established between the standard message operation type and the corresponding target operation location and / or target operation range to obtain the message interaction operation mapping relationship.

[0378] The interactive operation location features can include at least: interactive object identifier, interactive operation item, object operation location, object interaction range, area affiliation relationship, and execution order information; standard message operation type can refer to a unified operation semantic that is independent of the platform, such as "locating message input area", "writing reply content", "triggering sending operation", "expanding additional operation bar", etc.; after establishing a correspondence between interface area features and interactive operation location features, a message interactive operation mapping relationship can be obtained; preferably, the message interactive operation mapping relationship can be stored in the form of a mapping table, rule object, or operation script, wherein each standard message operation type corresponds to one or more target operation locations, target operation ranges, and necessary execution conditions.

[0379] Specifically, in this embodiment, by comprehensively analyzing the window display, interface layout, text information, and component information in the target interactive environment, the actual positional relationship between message-related areas and interactive objects is determined. Furthermore, a correspondence is established between standard message operation types and target operation positions and / or target operation ranges. This allows message interaction operations to no longer rely on fixed interface coordinates or a single operation entry point, but can adaptively position themselves based on the current environment's interface structure. Therefore, the positioning accuracy and execution stability of message input, sending, and other interactive operations under different interface layouts can be improved, thereby solving the technical problem in the prior art where positioning deviations and execution failures easily occur during message interaction due to differences in interface structure, layout changes, or component position adjustments.

[0380] In some embodiments, environmental feature data may also include display topology information, screen resolution information, and interface scaling information corresponding to the target application window; when the target interactive environment is in a multi-screen or cross-screen display state, the coordinates of the chat window, contact area, message display area, reply input area, and send control area can be uniformly converted by combining the window handle tracking results, display topology relationship, and resolution recognition results, so as to improve the positioning accuracy in cross-screen scenarios.

[0381] In some embodiments, a relocation mechanism can be automatically triggered when one of the following occurs on the interface: the window position shifts; the resolution or scaling changes; the chat window is displayed across screens; the platform interface version is updated; the confidence level of OCR anchor point recognition is lower than a preset threshold; or the deviation between the coordinates of the reply box and the expected area exceeds a preset threshold. After relocation is triggered, the system can re-execute the automated process of "window detection - region division - OCR anchor point recognition - feature point calibration - coordinate refresh" to achieve automatic re-identification and automatic relocation of the reply box, message area, and contact area, thereby avoiding positioning failure, accidental clicks, or inability to send messages due to interface changes.

[0382] In one embodiment, when the target interaction environment is the WeChat platform, acquiring and parsing the environmental feature data of the target interaction environment to determine the message interaction operation mapping relationship can employ a three-layer progressive automatic detection and localization strategy, including: By using window handle retrieval, window title recognition, border feature extraction, and active window filtering mechanisms, the boundaries of the main window of WeChat for Enterprise are determined, and interference from other foreground applications or obscuring windows is eliminated. Based on the pre-built interface template of WeChat Work, the layout of the main window is analyzed to determine the relative positions of the contact list area, the current chat area, the message display area, the reply input area, and the toolbar area, thereby achieving coarse-grained division of the core area. By combining OCR anchor point recognition, edge contour extraction, feature point matching, and local coordinate regression algorithms, the system can accurately locate key controls such as reply boxes, send buttons, and message containers, and output the corresponding coordinate results.

[0383] Preferably, a quick re-verification can be performed on the target control before each reply is sent; when window offset, input box deviation, abnormal interface scaling, or decreased confidence of OCR anchor point recognition is detected, a new round of coordinate recalibration process is automatically triggered to ensure that the target control is always in an operable state.

[0384] In one embodiment, when the target interaction environment is the WhatsApp platform and the business scenario is a foreign trade business scenario, a two-stage collaborative recognition architecture can be used to enhance the recognition of standard message data, including: The basic semantic recognition model is invoked to perform general semantic parsing on standard message data, and outputs basic intent labels, keyword sets, sentiment tendencies and language recognition results. The foreign trade domain enhancement model is invoked to perform domain enhancement recognition on the basic semantic recognition results, original message content, historical context and industry dictionary matching results, and output industry term labels, business scenario labels and response constraints. According to the preset fusion rules, the output results of the basic semantic recognition model and the foreign trade field enhancement model are fused to obtain the enhanced scene recognition results. Among them, for foreign trade business scenarios, the output weight of the foreign trade field enhancement model can be appropriately increased to improve the accuracy of professional recognition.

[0385] In one embodiment, the location mapping module is further configured to, before sending the interaction response to the target interaction environment based on the message interaction operation mapping relationship, include the following method: The interface area features and interaction operation positioning features determined when establishing the message interaction operation mapping relationship are respectively determined as the baseline interface area features and the baseline interaction operation positioning features. Obtain the current interface area features and current interaction operation location features of the target interaction environment; Among them, the baseline interface area features and the baseline interactive operation positioning features can be understood as the set of reference features used when establishing the mapping relationship of the current effective message interactive operation; the current interface area features and the current interactive operation positioning features can be re-acquired in the same or equivalent way as when establishing the baseline features, so as to ensure that the comparison results are comparable. Preferably, the current features can be collected in real time before the sending action is executed, so as to reflect the latest interface state of the target interactive environment. The current interface region features are compared with the baseline interface region features to determine at least whether the region categories of multiple target regions match and whether the deviation of the region boundaries of multiple target regions exceeds the preset boundary threshold. The deviation of the region boundary is used to characterize the degree of difference between the current target region and the reference target region in terms of spatial position and size. Specifically, the deviation can be obtained in the following way: for the current region boundary and the reference region boundary corresponding to the same region category, calculate the left boundary coordinate difference, the upper boundary coordinate difference, the width difference, and the height difference respectively, and normalize each difference according to the width and height of the display range. Then, the normalized differences are weighted and summed or averaged to obtain the region boundary deviation of the target region. Preferably, the deviation can also be characterized by the inverse of the region overlap, the normalized value of the center point distance, or the degree of change of the boundary box intersection-union ratio. If the region category of multiple target regions is matched and the deviation of the region boundaries of multiple target regions is less than the preset boundary threshold, then the current interface region feature is determined to match the baseline interface region feature. The preset boundary threshold can be set based on historical interface change samples, regional drift under different application versions, or validation set test results. Preferably, the preset boundary threshold can be set to a normalized value between 0.05 and 0.20, and more preferably, it can be set to 0.08, 0.10, or 0.12. When the threshold is smaller, the mapping relationship verification is more stringent; when the threshold is larger, the tolerance for slight interface changes is higher. In practical applications, the threshold can be adjusted according to the stability of the target interaction environment. If the region category of at least one target region does not match, or the deviation of the region boundary of at least one target region is greater than or equal to a preset boundary threshold, the message interaction operation mapping relationship is determined to be invalid. When determining whether the region categories of multiple target regions match, the category labels of each target region in the current interface region features can be compared one by one with the corresponding category labels in the baseline interface region features. If a region that should have been identified as a message input region is identified as another region in the current state, the region category mismatch can be directly determined. When determining whether the region boundary deviation exceeds the threshold, each region can be compared, and if any region exceeds the threshold, the baseline interface region features and the current interface region features can be determined to be mismatched. In response to the matching of the current interface area features with the baseline interface area features, the current interactive operation location features are compared with the baseline interactive operation location features to at least determine whether there are any new interactive objects and / or interactive operation items related to the message interactive operation in the target interactive environment, and whether the operation position and / or operation range corresponding to the message interactive operation are matched. When comparing the current interactive operation positioning features with the baseline interactive operation positioning features, the following aspects can be considered: First, compare whether the set of interactive objects has changed, such as whether a button has been added or whether the sending entry has been hidden; second, compare whether the set of interactive operation items has changed, such as whether the original "click to send" operation has been changed to "click to confirm and then send"; third, compare whether the object operation position and object interaction range corresponding to the same operation item have changed. Specifically, whether the operation position matches can be determined by calculating the normalized distance between the current operation position and the baseline operation position; whether the object interaction range matches can be determined by comparing their boundary deviation or overlap. Preferably, the position normalized distance threshold can be set to 1% to 10% of the display range width or height. If a new interactive object and / or interactive operation item related to a message interaction operation is added to the target interactive environment, or if the operation position and / or operation range corresponding to the message interaction operation do not match, the message interaction operation mapping relationship is determined to be invalid. If the message interaction operation mapping relationship is invalid, the message interaction operation mapping relationship is updated according to the comparison deviation between the current interface area features and the reference interface area features, and / or the message interaction operation mapping relationship is updated according to the comparison deviation between the current interaction operation positioning features and the reference interaction operation positioning features. The comparison deviation item can refer to the specific difference item that causes the current feature to mismatch with the benchmark feature, such as region boundary offset, region category change, missing interactive object, addition of operation entry, object operation position offset, or change of interaction range. In response to the invalid message interaction operation mapping relationship, region identification and operation positioning can be re-executed only for the local region where the deviation occurred to update the message interaction operation mapping relationship; alternatively, complete environmental feature data can be re-acquired and the message interaction operation mapping relationship can be reconstructed. Preferably, when the deviation item only involves a slight change in the boundary of a single region, a local update can be performed; when the deviation item involves a change in region category or a change in the core sending entry, a full update can be performed. Based on the updated message interaction operation mapping relationship, the interaction response is sent to the target interaction environment.

[0386] Specifically, in this embodiment, before sending a message, the current interface features are compared with the baseline features used when the pre-established mapping relationship was established. This determines whether the current target interaction environment still meets the applicable conditions of the original message interaction operation mapping relationship. When the mapping relationship is determined to be invalid, it is updated based on the detected deviation, enabling the message sending process to dynamically correct itself according to real-time changes in the target environment. This allows for timely detection of mapping mismatch problems caused by changes in interface areas, interactive objects, or operation positions, improving the timeliness and reliability of the message interaction operation mapping relationship. This solves the technical problem in the prior art where the original operation path becomes invalid after an interface update, leading to message sending errors or failures.

[0387] In one embodiment, the message generation module is further configured to determine the corresponding message generation branch in the pre-trained message generation agent based on the business scenario corresponding to the standard message data, including: Extract scene recognition features corresponding to standard message data. Scene recognition features include at least one or more of the following: keyword features, semantic features, intent features, and context features. The keyword features can include industry terms, business entity words, action words, and high-frequency phrases extracted from standard message data. Preferably, keyword features can be obtained through word segmentation statistics, keyword extraction, named entity recognition, industry dictionary matching, or terminology rule matching. For example, in foreign trade business scenarios, words such as "MOQ," "FOB," "quotation," "leadtime," "sample," and "shipment" can serve as strong industry identification clues. Semantic features can refer to vectorized features representing the overall meaning of the message. Preferably, they can be obtained by encoding the message text in the standard message data through text embedding models, pre-trained language models, or semantic coding models. Intent features can refer to the main interactive intent expressed in the current message, such as consultation, confirmation, urging, reply, negotiation, refusal, or thanks. Intent features can be obtained based on intent information, which can also include awareness tags obtained from the input text and / or intent text contained within the input text, without limitation. Context features can include information such as historical dialogue content, current round position, the role relationship between the sender and receiver, conversation topic, time context, and citation relationships. Based on keyword features and semantic features, scene classification features corresponding to standard message data are generated, and based on intent features and context features, context discrimination features corresponding to standard message data are generated. Among them, the context discrimination features can be further generated by combining emotional tendencies. Emotional tendencies can be obtained based on emotional information, which may include emotional tags obtained from the input text and / or emotional text contained in the input text, without limitation here. Among them, the scenario classification feature is used to characterize the business scenario characteristics to which the standard message data belongs, that is, the business scenario; the context discrimination feature is used to characterize the specific communication context characteristics to which the standard message data belongs in the business scenario; specifically, the scenario classification feature can be obtained by fusing keyword features and semantic features, for example, by concatenating or weighting the industry keyword hit rate with the message semantic vector to form an industry identification feature; the context discrimination feature can be obtained by fusing intent features and context features to form a representation of the current communication stage and interaction purpose; preferably, for business scenario identification, the weight of industry terms in keyword features and semantic features can be increased; for context scenario identification, the weight of round relationship, role relationship and previous message dependency in intent features and context features can be increased; Based on multiple business scenario features in a pre-defined scenario matching corpus, the feature similarity between scenario classification features and multiple business scenario features is determined, so as to determine the business scenario matching degree between standard message data and multiple business scenario features. The pre-defined scenario matching corpus can be constructed by pre-collecting and labeling historical message samples under different business scenarios. Preferably, sample sets can be established for multiple industries such as foreign trade, recruitment, office, and customer service, and each sample can be labeled with its business scenario and corresponding contextual scenario. Based on the sample sets, business scenario features corresponding to each business scenario and contextual scenario features corresponding to different contextual scenarios under each business scenario can be further extracted. Preferably, the business scenario features can be pre-converted into corresponding business scenario feature vectors. Preferably, the contextual scenario features can be pre-converted into corresponding contextual scenario feature vectors. Multiple business scenario features with a business scenario matching degree greater than or equal to a preset business scenario matching degree threshold are identified as candidate business scenarios, and the candidate business scenario with the highest business scenario matching degree is identified as the target business scenario. Multiple contextual scenarios corresponding to the target business scenario are identified as candidate contextual scenarios; Based on the context scene features corresponding to multiple candidate context scenes, the feature similarity between the context discrimination feature and the multiple context scene features is determined, so as to determine the context scene matching degree between the standard message data and the multiple candidate context scenes. Feature similarity can be obtained through one or more of the following methods: cosine similarity, vector distance conversion value, or probability output by the classification model. Furthermore, contextual scene matching degree can be obtained by directly using feature similarity, or by modifying it based on feature similarity, combined with conversation turn stability, context continuation probability, or role relationship matching. Preferably, the preset contextual scene matching degree threshold can be set between 0.55 and 0.90, and more preferably, it can be set to 0.65 or 0.70. One or more candidate context scenes with a context scene matching degree greater than or equal to a preset context scene matching threshold are identified as reference context scenes; Based on the target business scenario and one or more reference context scenarios, determine the corresponding message generation branch in the message generation agent; The message generation agent can refer to an intelligent processing module used to generate reply messages based on business scenarios and specific contexts. Preferably, the message generation agent can include a scenario recognition module, an industry routing module, a context discrimination module, a rule constraint module, and a text generation module. The message generation branch can refer to the generation path, reply template set, constraint parameter set, prompt word set, or sub-model call chain within the message generation agent that corresponds to a specific business scenario and a specific context scenario under that business scenario. In this process, determining the corresponding message generation branch based on the target business scenario and one or more reference context scenarios can make the response generation process more in line with the expression requirements of the industry and the actual needs of the current communication stage. For example, firstly, the main branch of business scenario generation in the message generation agent is determined according to the target business scenario, and then the context generation sub-branch under the main branch of business scenario generation is determined according to one or more reference context scenarios, thereby obtaining the target message generation branch used to generate response message data.

[0388] It is worth noting that in this embodiment, the business scenario can refer to the business scenario or industry business scenario to which the message belongs; in other words, the business scenario does not only refer to general communication purposes, but is used to characterize the industry background to which the current message is attached; preferably, the business scenario can include one or more of the following: foreign trade business scenario, cross-border e-commerce business scenario, domestic e-commerce business scenario, recruitment business scenario, corporate office business scenario, customer service business scenario, logistics business scenario, etc.; the terminology system, response focus and expression habits under different business scenarios are usually different, so it is necessary to determine the business scenario to which the message belongs before generating the subsequent response; Similarly, a contextual scenario can refer to a specific communication situation further subdivided within a particular business scenario. Preferably, in a foreign trade business scenario, a contextual scenario can include inquiry responses, product introductions, quotation communication, sample confirmation, order follow-up, payment collection, delivery date confirmation, logistics notifications, and after-sales processing; in a recruitment business scenario, a contextual scenario can include job inquiries, resume invitations, interview confirmations, onboarding notifications, and candidate follow-ups; in a corporate office business scenario, a contextual scenario can include task assignment, progress feedback, meeting notifications, approval reminders, and result confirmation. In other words, a business scenario is used to represent industry affiliation, while a contextual scenario is used to represent the specific communication state within that business scenario. Based on the above, multiple contextual scenarios corresponding to the target business scenario are identified as candidate contextual scenarios. This can be understood as follows: after the business scenario has been identified, the specific communication contexts are further filtered within that business scenario. For example, after the foreign trade business scenario is identified, the candidate contextual scenarios are no longer selected across industries, but are judged from multiple contextual scenarios such as inquiry response, quotation communication, order confirmation, delivery confirmation, and logistics follow-up in the foreign trade industry.

[0389] Specifically, in this embodiment, by extracting keywords, semantics, intent, and context information from standard message data, the business scenario to which the message belongs and its corresponding context are identified hierarchically. Based on the identification results, a matching message generation branch is determined in the pre-trained message generation agent, enabling the response generation process to be tailored to the specific business scenario and context of the message. This improves the matching degree between the message generation strategy and actual message needs, enhances the scenario identification and context adaptation capabilities of the response generation process, and solves the technical problems of existing response generation processes lacking scenario differentiation and difficulty in effectively adapting to different semantic environments.

[0390] In one embodiment, the message generation module is further configured to generate reply message data corresponding to the standard message data through a message generation branch, including: Based on the target business scenario corresponding to the message generation branch, determine the corresponding business scenario reply rules in the preset scenario reply rule library; The pre-defined scenario response rule library can be understood as a set of response rules pre-established for different business scenarios and their sub-contextual scenarios. Preferably, the pre-defined scenario response rule library can be constructed in one or more of the following ways: manually configured by business experts according to industry communication standards; extracted from historical high-quality response samples from various industries; generated based on industry knowledge bases, terminology databases, and standard dialogue databases; or jointly constructed through rule templates and machine learning statistical methods. The pre-defined scenario response rule library can organize response rules according to a two-level structure of "business scenario - contextual scenario". For example, in the foreign trade business scenario, pre-defined rules can be set for inquiry response, quotation communication, delivery confirmation, and logistics notification; in the recruitment business scenario, pre-defined rules can be set for invitation communication, interview confirmation, and onboarding notification. Among them, the business scenario response rules are used to characterize the industry-wide requirements that the response content should meet in a certain business scenario. Preferably, in the foreign trade business scenario, the business scenario response rules may require the response content to conform to international trade communication habits, prioritize the inclusion of product information or transaction elements, maintain a professional and polite expression, and use common industry terminology as much as possible; in the recruitment business scenario, the business scenario response rules may require the response content to highlight job information, interview arrangements, process nodes, and polite invitations; in the corporate office business scenario, the business scenario response rules may require the response content to highlight task information, time nodes, and execution matters. Based on one or more reference context scenarios corresponding to the message generation branch, determine the corresponding context scenario reply rules in the preset scenario reply rule base; Among them, contextual scenario response rules are used to characterize detailed response requirements under specific communication situations within a business scenario. For example, in the "inquiry response" context of foreign trade business, priority can be given to responding to product parameters, price ranges, minimum order quantities, and sample availability that customers are concerned about; in the "delivery confirmation" context, priority can be given to explaining the expected delivery time, production progress, and possible influencing factors; in the "logistics follow-up" context, priority can be given to explaining the shipping status, tracking number, and expected arrival time. Based on business scenario reply rules and context scenario reply rules, message generation constraint information corresponding to standard message data is generated. The message generation constraint information includes at least one or more of the following: reply intent, reply content elements, reply expression method, and reply output format. Among them, message generation constraints can be understood as the combined result of industry constraints and contextual constraints imposed on the current response generation process; response intent can refer to the main communication purpose of this response, such as answering inquiries, promoting transactions, confirming arrangements, following up on progress, reassuring or explaining, or ending communication; response content elements can refer to the key information items that should be included in the response. Preferably, in foreign trade business scenarios, response content elements may include product name, specifications, price terms, minimum order quantity, sample information, payment method, delivery date, and transportation method; response expression style can refer to the language style that the response should adopt, such as formal, business-like, polite, concise, professional, reassuring, or progressive expression; response output format can refer to the organizational form of the response text, such as single paragraph text, bullet point listing, tabular field output, or templated structure output; Based on message generation constraint information, semantic organization and text generation are performed to obtain candidate content for reply messages; Semantic organization and text generation can be achieved through pre-trained large language models or multi-stage text generation models. Specifically, the response framework can be determined first based on message generation constraints. The response framework can include a salutation or opening response, a core business response, and a closing guidance. Then, key information and industry-related content from standard message data are filled into the response framework, and the text generation model is called to generate candidate response messages. Preferably, in foreign trade business scenarios, the response framework can include customer salutation, response to needs, quotation or parameter description, and guidance for subsequent actions. The candidate content for the reply message can be one or more candidate reply texts. Preferably, when generating multiple candidate reply texts, the multiple candidate contents can be sorted based on industry matching degree, contextual compliance degree, key information completeness, language fluency, and length suitability, and the one or more with the highest scores can be selected as subsequent optimization targets. Specifically, industry matching degree can be used to characterize whether the candidate reply conforms to the terminology and expression style of the target business scenario; contextual compliance degree can be used to characterize whether the candidate reply conforms to the current specific communication context; and key information completeness can be used to characterize whether the candidate reply covers the reply content elements required by the message generation constraint information. Semantic adaptation and text optimization are performed on candidate response messages to generate response message data that corresponds to standard message data. Semantic adaptation and text optimization may include one or more of the following processes: industry terminology adaptation, filtering of sensitive or inappropriate expressions, deletion of redundant expressions, grammatical error correction, length control, format standardization, style unification, and context matching verification. Preferably, industry terminology adaptation is used to convert general expressions into more commonly used terms in the target industry. For example, in foreign trade business scenarios, the general expression of "price" is optimized into "quotation," "price terms," ​​or related trade terms that are more in line with trade communication habits. Context matching verification is used to determine whether the candidate response matches the customer's needs, confirmed matters, or commitments made in the preceding dialogue. Length control can be used to make the response text conform to a preset word count range, such as 20 to 300 words.

[0391] Specifically, when generating message generation constraint information based on business scenario response rules and context scenario response rules, the general constraints corresponding to the business scenario can be extracted first, and the detailed constraints corresponding to the context scenario can be extracted. The two types of constraints are then merged. Preferably, when the two types of constraints act on the same generation dimension at the same time, they can be processed according to the principle that context scenario response rules take precedence over business scenario response rules, or conflicts can be resolved according to a preset priority table. For example, in the foreign trade business scenario, the business scenario response rules require that "the expression should be professional, business-like and polite," while in the context scenario of "quotation communication," it is further required that "the quotation content should clearly list the price terms, quantity conditions and validity period." The final message generation constraint information includes both the industry-wide business expression requirements and the key element requirements in the quotation context.

[0392] Specifically, in this embodiment, by combining the business scenario response rules corresponding to the target business scenario and the context scenario response rules corresponding to the reference context scenario, constraints are imposed on the generation conditions such as response intent, content elements, expression methods, and output formats. Based on this, semantic organization, text generation, and subsequent optimization processing are completed, ensuring that the generated response content not only meets the business requirements of the corresponding scenario but also maintains a high degree of matching with the current context. This improves the performance of response messages in terms of content completeness, expression accuracy, and output standardization, enhancing the relevance and usability of the generated results, thereby solving the technical problems of high generalization of automatic response content, insufficient semantic fit, and unstable output format in existing technologies.

[0393] In one embodiment, upon receiving a selection instruction, the target interaction environment is first determined, and the message acquisition link and response delivery link are executed sequentially based on the target interaction environment. Specifically, in the message acquisition link, the corresponding information acquisition rules are determined, and it is determined whether access to the data storage area is permitted. If permitted, the data storage area is accessed to obtain the original message data; if not permitted, the interactive interface image is acquired, and the original message data is extracted based on the image recognition results. Subsequently, the original message data is standardized to generate standard message data, and the corresponding business scenario is determined based on the standard message data. This determines the message generation branch corresponding to the message generation agent, thereby generating an interactive response. In the response delivery link, the interface area features and interactive operation positioning features of the target interaction environment are acquired, and the message interaction operation mapping relationship is determined. Finally, based on the message interaction operation mapping relationship, the interactive response is sent to the target interaction environment, thereby achieving message extraction, standardized understanding, scenario-based response generation, and automatic response sending for different interaction environments.

[0394] This application first detects the selected communication platform, loads the corresponding platform plugin based on the detection results, determines the corresponding message interaction operation mapping relationship based on the detection results, processes the standard message data, generates an interactive response, and returns it. Specifically, taking the detection of the WeChat platform as an example, the three-layer detection and positioning logic for the graphical interface is explained. It establishes the message interaction operation mapping relationship of WeChat through a three-layer progressive detection and positioning process. The three-layer progressive detection and positioning process includes determining the main window boundary, coarsely dividing the core area based on the preset interface template, and finely positioning key controls such as the reply box, send button, and message container, so as to form a scene recognition result 2 by combining the standard message data, and further generate an interactive response 2. Specifically, taking the WhatsApp platform as an example, the scene recognition enhancement logic for business scenarios is explained. It inputs the standard message data 1 into a two-stage collaborative enhancement recognition process. The two-stage collaborative enhancement recognition process includes general semantic parsing, enhanced recognition combined with foreign trade domain knowledge, and result fusion, so as to form a scene recognition result 1, and further generate an interactive response 1.

[0395] In one embodiment, this application also provides a message interaction method applied to the interaction environment side deployed in instant messaging software, comprising the following steps: acquiring raw message data; sending the raw message data to a message interaction device as described above based on the message acquisition rules corresponding to the instant messaging software; acquiring the interaction response generated by the message interaction device in response to the raw message data, and outputting the interaction response. It is worth noting that, when applied to the exchange environment side, the message interaction method further includes: determining the message acquisition rules corresponding to the current interaction environment within the instant messaging software; in response to the message acquisition rules indicating that reading the data interface is allowed, reading the interaction message-related data in the data interface corresponding to the current interaction environment, and generating raw message data based on the interaction message-related data; sending the raw message data to the message interaction device as described above, so that the message interaction device can convert the raw message data into standard message data and generate an interaction response based on the standard message data; receiving the interaction response returned by the message interaction device, and outputting the interaction response in the current interaction environment.

[0396] The instant messaging software can be desktop instant messaging software, mobile instant messaging software, web-based instant messaging pages, or a conversation module integrated into a business system; the current interaction environment can be the currently active one-on-one chat interface, group chat interface, customer communication interface, or other interfaces used for message display and input; message retrieval rules can be used to characterize whether the current interaction environment allows the retrieval of message-related data through a data interface. Preferably, the message retrieval rules can at least include the data interface open status, interface access permissions, message field reading paths, and exception handling strategies.

[0397] Specifically, in this embodiment, the instant messaging software is primarily responsible for obtaining message-related data from the data interface corresponding to the current interaction environment when the interface reading conditions are met, and then forming raw message data based on this data before sending it to the message interaction device. The generation of standard message data, business scenario identification, message generation branch determination, and interactive response generation are all performed by the message interaction device. Correspondingly, after receiving the interactive response from the message interaction device, the instant messaging software can display the interactive response in the input area, candidate response area, or other response display area of ​​the current interaction interface for the user to view, confirm, or send.

[0398] Furthermore, when the instant messaging software and the messaging device are deployed on the same terminal device, the instant messaging software can send raw message data and receive interactive responses through a local interface, inter-process communication mechanism, or shared memory. When the instant messaging software and the messaging device are deployed separately, the instant messaging software can also send raw message data to the messaging device through a network link and receive interactive responses returned by the messaging device.

[0399] Optionally, outputting an interactive response may include one or more of the following methods: displaying the interactive response in the response input box; displaying the interactive response as candidate response content; or displaying the interactive response in a preview area for user confirmation before proceeding with subsequent sending operations. Preferably, the instant messaging software is only responsible for receiving and outputting interactive responses to the interface, and does not participate in the generation and processing of interactive responses.

[0400] It should be understood that, although Figures 1-2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1 - At least some of the steps in Figure 2 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0401] In one embodiment, such as Figure 4 As shown, a response generation device is provided, comprising: an analysis module 20, a determination module 21, and a generation module 22, wherein: Analysis module 20 is used to acquire and analyze user input text to obtain intent information, sentiment information and product keywords; The determination module 21 is used to retrieve response composition information from a preset knowledge base based on intent information and product keywords; determine the information organization method of response composition information based on the matching results of product keywords and preset product information base; obtain user preferences, and determine the response template style based on emotion information and user preferences; The generation module 22 is used to generate multiple candidate responses to the user's input text according to the response composition information, information organization method, and response template style, and select at least one candidate response as the interactive response.

[0402] Specific limitations regarding the response generation device can be found in the limitations regarding the response generation method described above, and will not be repeated here. Each module in the aforementioned response generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0403] In one embodiment, this application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer is able to execute the response generation method provided by the above methods.

[0404] In one embodiment, the response generation device is disposed in a computer device, which may be a server, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores data used in the response generation method. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a response generation method.

[0405] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the method of this application and does not constitute a limitation on the computer device to which the method of this application is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0406] In one embodiment, a response generation apparatus is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps: Step 101: Obtain and analyze user input text to obtain intent information, sentiment information, and product keywords.

[0407] Step 102: Retrieve response composition information from a preset knowledge base based on intent information and product keywords.

[0408] Step 103: Determine the information organization method of the response based on the matching results of product keywords and the preset product information database.

[0409] Step 104: Obtain user preferences and determine the response template style based on sentiment information and user preferences.

[0410] Step 105: Generate multiple candidate responses for the user's input text according to the response composition information, information organization method, and response template style, and select at least one candidate response as the interactive response. ...

Claims

1. A response generation method, characterized in that, include: Acquire and analyze user input text to obtain intent information, sentiment information, and product keywords; Based on the intent information and product keywords, the system retrieves response information from a preset knowledge base; The information organization method of the response is determined based on the matching results between the product keywords and the preset product information database; Obtain user preferences and determine the response template style based on sentiment information and user preferences; Multiple candidate responses are generated based on the response composition information, information organization method, and response template style, and at least one of the candidate responses is selected as the interactive response.

2. The method according to claim 1, characterized in that, The process of acquiring and analyzing user input text to obtain intent information, sentiment information, and product keywords includes: Obtain user input text, input the user input text into a language model, and use the language model to determine product keywords and intent information; The user input text is fed into a convolutional neural network, which then performs emotion recognition to obtain emotion information.

3. The method according to claim 2, characterized in that, The language model includes an embedding layer, an encoding layer, a classification layer, and a sequence labeling layer. The process of inputting user-supplied text into the language model and determining product keywords and intent information through the language model includes: The user input text is segmented by an embedding layer. Each segmented word is converted into a word embedding vector, and a corresponding position embedding vector and segment embedding vector are added to each word to generate an input vector. The input vector is fed into the encoding layer and encoded by a multi-layer encoder to output a context semantic representation vector; the context semantic representation vector is used to characterize the semantic dependencies between words. Extract the vector corresponding to the classification label from the context semantic representation vector. The vector corresponding to the classification label aggregates the semantic information corresponding to the entire input vector. Input the vector corresponding to the classification label into the classification layer. The classification layer outputs the probability distribution of each intent based on the vector corresponding to the classification label, and selects the intent with the highest probability as the intent information; The context semantic representation vector is input to the sequence labeling layer, which outputs a label for each word position in the input sequence. The label is used to identify whether the word is a component of the product keyword. Continuously labeled entity words are extracted as product keywords.

4. The method according to claim 2, characterized in that, The convolutional neural network includes a word embedding layer, a convolutional layer, a pooling layer, and a fully connected layer. The user input text is fed into the convolutional neural network, and emotion recognition is performed through the convolutional neural network to obtain emotion information, including: The user-input text is segmented into words to obtain a word sequence; Each word in the word sequence is mapped to a word vector through a word embedding layer to form an input matrix. The input matrix is ​​then fed into a convolutional layer, where multiple convolutional kernels of different sizes are used to perform convolution operations. This extracts local semantic features of continuous word sequences of different lengths in the input matrix, resulting in multiple feature maps. Each feature map is used to represent a local expression pattern related to emotion. The multiple feature maps are input into the pooling layer, and max pooling is performed on each feature map. The maximum value in each feature map is extracted as the most significant emotion feature corresponding to that feature map. The maximum values ​​are concatenated to form a feature vector representing the global emotion. The feature vector is input into a fully connected layer, and the activation function maps the feature vector to a preset emotion category space, outputting the probability of each emotion category; Emotion categories with a probability higher than a preset threshold are selected as emotion information.

5. The method according to claim 1, characterized in that, The method further includes: Determine if a user profile exists in the cache; If a user profile exists in the cache, load the user profile from the cache; If a user profile is not found in the cache, load the user profile from the database and write it to the cache. Determine a response strategy that matches the user profile.

6. The method according to claim 5, characterized in that, The strategy for determining a response that matches the user profile includes: In response to the user profile including historical intents, the activity level and dispersion of various historical intents are determined. Based on the activity level of historical intents, the tone tendency of the response is determined. Based on the dispersion of historical intents, the guidance method of the response is determined. The tone tendency and guidance method are incorporated into the response strategy; and / or, In response to the user profile including product preferences, the system determines the preferred product types based on the distribution characteristics of the product preferences and incorporates the preferred product types into the response strategy. In response to the user profile including language preferences, the language style of the response is determined based on the type of language preference, and the language style is incorporated into the response strategy; and / or, In response to the user profile including interaction frequency, the guidance strength and information density of the response are determined based on an index of the interaction frequency, and the guidance strength and information density are incorporated into the response strategy; and / or, In response to the user profile including user level, the priority of the response generation method is determined based on the user level, and the priority of the generation method is incorporated into the response strategy. The priority of the generation method is the order in which different generation methods are selected when generating a response.

7. The method according to claim 1, characterized in that, The information retrieved from the preset knowledge base based on the intent information and product keywords includes: Obtain a preset mapping relationship table, and select a preset knowledge base that matches the intent information as the target knowledge base according to the preset mapping relationship table. The preset mapping relationship table stores the mapping relationship between intent information and preset knowledge base types. The preset knowledge base includes at least one of product information base, industry knowledge base, and common questions base. Retrieve response composition information from the target knowledge base based on the product keywords.

8. The method according to claim 7, characterized in that, The information retrieved from the target knowledge base based on the product keywords includes: In response to the preset knowledge base including a product information database, at least one of the following is retrieved from the product information database: basic product information, product specifications, product price information, and product status information, as part of the response information; and / or, In response to the preset knowledge base including an industry knowledge base, at least one of the following related information—trade terms, payment methods, quality standards, technological processes, and after-sales services—is retrieved from the industry knowledge base as part of the response information; and / or, In response to the preset knowledge base including a common questions database, at least one of the following is retrieved from the common questions database: question identifiers matching the user's input text, standard answers to the questions, and related products associated with the questions, as answer composition information.

9. The method according to claim 1, characterized in that, The method of organizing information to determine the response based on the matching results of the product keywords and the preset product information database includes: Determine whether the product keywords match product records in the preset product information database; In response to the matching of product keywords with product records in a preset product information database, the information organization method is determined to include filling the response composition information into the response template.

10. The method according to claim 9, characterized in that, The step of determining whether product keywords match product records in a preset product information database also includes: In response to a mismatch between product keywords and product records in a preset product information database, it is determined that the information organization method includes calling a preset general script to generate a guiding response, which is used to guide the user to supplement product requirement information.

11. The method according to claim 1, characterized in that, The process of obtaining user preferences and determining the response template style based on sentiment information and user preferences includes: Analyze the user's historical chat history and identify at least one of product preference, language preference, and communication preference in the historical chat history as the user preference; The emotional type of the response is determined based on the emotional information; wherein the emotional type is used to characterize the category of emotional expression used in the response, and the emotional expression category includes at least one of reassuring, enthusiastic, efficient, professional, or exploratory. Based on the user preferences, determine the preferred way of expressing the response; Based on the stated emotion type and expression preference, determine the style of the response template.

12. The method according to claim 1 or 5, characterized in that, The generation of multiple candidate responses to user input text based on response composition information, information organization method, and response template style includes: The response strategy, response composition information, information organization method, and response template style are used as preset dimensions; Multiple preset generation methods are obtained, and the candidate responses are generated according to the different preset generation methods; wherein the preset dimensions selected when generating the candidate responses by different preset generation methods are different.

13. The method according to claim 12, characterized in that, The candidate responses are generated according to different preset generation methods, including: Based on the response strategy and response template style, a target response template is determined. This template is then parsed according to the information organization method. Variable placeholders within the target response template are identified. Fields with the same names as the variable placeholders are extracted from the response structure information and used as fill content. The fill content is then used to replace the variable placeholders, generating a first candidate response; and / or, The context information of the user input text is obtained, and the context information, intent information, sentiment information, response strategy, response template style, and response composition information are filled into a preset prompt word template to generate the model user input text. This model user input text is used as the initial sequence, and the target model predicts the next word word by word based on the initial sequence. After each word is generated, it is appended to the end of the sequence. The next word is generated based on the updated initial sequence until a termination condition is met. All generated words are combined into a second candidate response and output. The context information includes at least the user input text from at least one round prior to the current user input text round and the corresponding response; and / or, Based on the information organization method, key information is extracted from the information constituting the response to construct a template skeleton. Under the semantic constraints of the template skeleton, the target model generates an extended language that has a contextual semantic relationship with the template skeleton. The template skeleton and the extended language are combined to generate a third candidate response. The template skeleton is a structured text framework that contains key information but does not contain a complete expression.

14. The method according to claim 1 or 5, characterized in that, Selecting at least one of the candidate responses as an interactive response includes: A relevance score is determined based on the semantic similarity between the candidate responses and the user's input text; An emotion matching score is determined based on the degree of match between the candidate responses and the style of the response template. Based on the intent information and language preferences in the user profile, a target length range is determined. By calculating the deviation of the length of the candidate response text from the target length range, a moderate length score is determined. The professionalism score is determined by examining the completeness of professional information and the standardization of terminology in the candidate responses. The relevance score, sentiment matching score, appropriate length score, and professionalism score are weighted and fused to obtain the comprehensive score of each candidate response. The multiple candidate responses are sorted according to their overall scores, and at least one candidate response with the highest overall score is selected as the interactive response for display.

15. A response generation apparatus, characterized in that, The apparatus includes a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the method according to any one of claims 1 to 14.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 14.