An attack defense method and device for e-commerce intelligent customer service large model

By implementing a multi-layer defense strategy in the e-commerce intelligent customer service model and utilizing a dynamically updated rule base and natural language understanding technology to identify and defend against complex attack methods, the problem of defense failure in traditional technologies is solved, achieving higher security and reliability.

CN120470582BActive Publication Date: 2025-09-19FUZHOU GAOLING DATA TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510937281.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-08
Publication Date
2025-09-19
Estimated Expiration
2045-07-08

AI Technical Summary

Technical Problem

Traditional technologies have limitations in defending against attacks on large e-commerce intelligent customer service models. They find it difficult to identify and defend against complex attack methods such as semantic induction and emotional coercion, resulting in defense failure.

Method used

A multi-layered defense strategy is adopted. Through a dynamically updated multi-domain sensitive word detection rule base and special symbol matching rule set, combined with natural language understanding and sentiment analysis, it identifies and processes sensitive words, special characters and potential injection markers in the input text, generates an overall risk level and performs corresponding security processing.

Benefits of technology

Effectively defend against various attacks, improve the security of e-commerce intelligent customer service, ensure user data and system security, and prevent sensitive information leakage and malicious operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120470582B_ABST
    Figure CN120470582B_ABST
Patent Text Reader

Abstract

The present invention provides an attack defense method and device for a large-scale e-commerce intelligent customer service model, relating to the field of artificial intelligence security technology. The method comprises: Step 1: real-time monitoring of the interactive data stream between users and the intelligent customer service, identifying abnormal interactive behavior, and activating a multi-layer defense strategy when abnormal behavior is detected; Step 2: Based on the multi-layer defense strategy, sensitive words, special character sequences, and potential injection markers in the input text are identified and processed using a dynamically updated multi-domain sensitive word detection rule base and a special symbol matching rule set to generate a preliminary filtered text. The present invention effectively resists various malicious attacks against the large-scale e-commerce intelligent customer service model, maintains user information security, and improves customer service quality and e-commerce operational reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence security technology, and in particular to an attack defense method and device for an e-commerce intelligent customer service large model. Background Art

[0002] Traditional technologies have limitations in attack defense against large models of e-commerce intelligent customer service. In e-commerce customer service, when users inquire about product information, traditional technologies often rely on sensitive word filters to block malicious words. For example, if an attacker replaces the word "illegal" with a synonym like "illegal" to create semantic manipulation, attempting to trick customer service into recommending prohibited products, static sensitive word filters are likely unable to detect this variant, rendering defense ineffective.

[0003] Furthermore, when processing user requests for after-sales refunds, traditional technology may only use the keywords "refund" and "complaint" to assess risk. If a user makes a threatening request, such as "This product has serious quality issues. I demand an immediate refund, or I will take legal action," traditional technology may not fully understand the emotional coercion and potential risks involved. Alternatively, if an attacker uses irony, such as "This product is so good, I'm tempted to file a complaint," traditional technology, lacking the ability to analyze the interaction between semantics and emotions, struggles to identify such subtle attack intent, leading to misjudgment of risk. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide an attack defense method and device for the large model of e-commerce intelligent customer service. Through multi-level text analysis and dynamic risk assessment mechanism, it can effectively defend against various attacks and improve the security of e-commerce intelligent customer service.

[0005] In order to solve the above technical problems, the technical solutions of the present invention are as follows:

[0006] In a first aspect, a method for defending against attacks on a large e-commerce intelligent customer service model is provided, the method comprising:

[0007] Step 1: Monitor the interaction data flow between users and intelligent customer service in real time to identify abnormal interaction behaviors. When abnormal behaviors are detected, activate the multi-layer defense strategy.

[0008] Step 2: Based on a multi-layered defense strategy, a dynamically updated multi-domain sensitive word detection rule base and special symbol matching rule set are used to identify and process sensitive words, special character sequences, and potential injection markers in the input text, generating a preliminary filtered text.

[0009] Step 3: For the initially filtered text, natural language understanding and sentiment analysis are used to identify semantic intent, sentiment, and the risk of interaction between the two to obtain a comprehensive analysis result. Based on the preset text comprehension ability, the overall logical fluency and local structure comprehension difficulty scores are calculated to generate a text structure assessment result, determine whether the input text is within the preset range, mark irrelevant content, and generate a domain relevance determination result.

[0010] Step 4: Integrate the filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results to obtain the overall risk level of the input text;

[0011] Step 5: Based on the overall risk level, the original input text is directly intercepted and the content is rewritten. An isolation identifier and mandatory security instruction text are added under the security encapsulation to generate a securely encapsulated input.

[0012] In step 6, the securely encapsulated input is sent to the e-commerce intelligent customer service core to generate the original response, and the original response is filtered for sensitive information, harmful content detection, and domain consistency review to generate the final security response result.

[0013] Furthermore, the interaction data stream between users and intelligent customer service is monitored in real time to identify abnormal interaction behaviors. When abnormal behaviors are detected, a multi-layer defense strategy is activated, including:

[0014] A legitimate intent baseline is constructed based on the user session, and the intent matching degree of the current input text is calculated. When the intent deviates from the baseline, a first intermediate text is obtained after semantic isolation processing.

[0015] The first intermediate text is scanned for multilingual instructions using a cross-language attack signature library, and malicious multilingual instructions detected are intercepted in real time to obtain a second intermediate text filtered from the malicious instructions;

[0016] Performing a logical consistency check on the second intermediate text to identify the characteristics of the jump attack path, blocking any illegal jump request when it is detected, and obtaining a third intermediate text that has been logically verified;

[0017] Implement bidirectional desensitization on the third intermediate text, and perform dynamic masking on sensitive fields such as payment information and logistics order number; generate a multi-layer defense strategy.

[0018] Furthermore, based on a multi-layered defense strategy, through a dynamically updated multi-domain sensitive word detection rule base and special symbol matching rule set, sensitive words, special character sequences, and potential injection markers in the input text are identified and processed to generate preliminary filtered text, including:

[0019] Using a dynamically updated multi-domain sensitive word detection rule library, we perform word-by-word matching detection on the input original text. When a matching sensitive word is detected, it replaces the sensitive word with a preset safe placeholder to generate a sensitive word filtered text.

[0020] Using the special symbol matching rule set, scan the text after sensitive word filtering, identify and delete the special character sequences and potential injection markers that meet the rules in the text, and generate the text after special symbol and injection marker filtering;

[0021] The basic grammatical structure of the text after filtering out special symbols and injection marks is analyzed, and it is verified that the replacement and deletion operations do not destroy the integrity of the basic grammatical structure, so as to generate a preliminary filtered text.

[0022] Furthermore, for the initially filtered text, natural language understanding and sentiment analysis are used to identify semantic intent, sentiment, and the risk of interaction between the two, to obtain comprehensive analysis results. Based on the preset text comprehension capabilities, the overall logical fluency and local structure difficulty scores are calculated to generate text structure assessment results, determine whether the input text is within the preset range, mark irrelevant content, and generate domain relevance determination results, including:

[0023] Perform natural language understanding processing on the initially filtered text to identify semantic intent and sentiment;

[0024] Based on semantic intent and emotional tendency, the correlation between the two is analyzed and the interaction risk level is evaluated to generate comprehensive analysis results;

[0025] Conduct an overall logical coherence analysis on the initially filtered text and generate a logical fluency score using a pre-set text comprehension ability calculation rule system;

[0026] Based on the logical fluency score and the complexity characteristics of the local structure of the text, the comprehension difficulty score is calculated to generate the text structure evaluation results;

[0027] Match the initially filtered text with the preset e-commerce domain knowledge base to determine whether the text content is within the preset range and obtain a judgment result;

[0028] Based on the determination results, irrelevant content that exceeds the preset range is marked to generate a domain relevance determination result.

[0029] Furthermore, the filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results are integrated to obtain the overall risk level of the input text, including:

[0030] Input the filtering results, comprehensive analysis results, text structure assessment results and domain relevance determination results into the preset rule judgment mechanism to obtain the risk factor conversion unit and weight configuration unit;

[0031] Based on the risk factor conversion unit, the sensitive word processing status, semantic intent classification results, attack risk probability, logical fluency score, comprehension difficulty score, and irrelevant content marking information are mapped into risk factors with preset numerical ranges.

[0032] Based on the weight configuration unit, a dynamic coefficient is set for each risk factor, and the coefficient size is adjusted according to the actual application scenario of e-commerce intelligent customer service;

[0033] A sum operation is performed on all risk factors to generate a total score, and a judgment is made based on the preset risk range of the total score. If the total score is lower than the first threshold, it is judged as a low risk level; if the total score is between the first and second thresholds, it is judged as a medium risk level; if the total score is greater than the second threshold, it is judged as a high risk level, and the overall risk level of the input text is obtained.

[0034] Furthermore, based on the overall risk level, the original input text is directly intercepted and the content is rewritten. An isolation identifier and mandatory security instruction text are added under the security encapsulation to generate the securely encapsulated input, including:

[0035] Based on the overall risk level, risk response decisions are made. When the overall risk level is low, no interception is performed; when the overall risk level is medium, only partial interception is performed; when the overall risk level is high, full text interception is performed; content rewriting is performed on the original input text that is not intercepted, including semantic reconstruction and term replacement;

[0036] Semantic reconstruction converts potentially offensive statements into neutral expressions based on the semantic intent classification results from the comprehensive analysis results. Term replacement uses the core terminology library in the e-commerce field to replace non-standard expressions with safe terms.

[0037] During the security encapsulation process, an isolation identifier is added to the rewritten text. At the same time, security instruction text is forcibly added at the beginning of the text, including predefined statements that prohibit the execution of external commands and enforce semantic constraints, to obtain the input result after security encapsulation.

[0038] Furthermore, the securely encapsulated input is transmitted to the e-commerce intelligent customer service core to generate the original response. The original response is then filtered for sensitive information, harmful content detected, and domain consistency reviewed to generate the final security response result, including:

[0039] The securely encapsulated input text is used as input to the e-commerce intelligent customer service core, where semantic reasoning and task processing are performed to generate the original response text.

[0040] Perform sensitive information filtering on the original response text, replace the sensitive keywords found with safe placeholders, and verify that the replacement operation does not damage the integrity of the response semantics to obtain the filtered text;

[0041] The filtered text is then checked for harmful content and the semantic intent classification results of the original input text are compared using the intent matching function. If emotional conflicts and intention deviations are detected, the harmful parts are deleted to obtain the purified text.

[0042] Perform a domain consistency review on the cleansed text to verify whether the text is consistent with the core e-commerce business process; if there is any inconsistency, trigger the rewrite function to align with the business specifications, obtain the reviewed text, and generate the final security response result.

[0043] Second, an attack defense device for a large e-commerce intelligent customer service model includes:

[0044] Anomaly detection module, which monitors the interaction data stream between users and intelligent customer service in real time, identifies abnormal interaction behaviors, and activates multi-layer defense strategies when abnormal behaviors are detected;

[0045] The text filtering module is used to identify and process sensitive words, special character sequences, and potential injection markers in the input text based on a multi-layered defense strategy, using a dynamically updated multi-domain sensitive word detection rule base and special symbol matching rule set to generate preliminary filtered text;

[0046] The semantic assessment module is used to perform natural language understanding and sentiment analysis on the initially filtered text, identify semantic intent and sentiment, and their interaction risks, and calculate the overall logical fluency and local structure difficulty scores based on the preset text comprehension capabilities to generate text structure assessment results.

[0047] The domain determination module is used to determine whether the input text is within a preset range based on the text structure evaluation results, mark irrelevant content, and generate a domain relevance determination result;

[0048] The risk control module is used to integrate the filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results to obtain the overall risk level of the input text. It then performs direct interception and content rewriting based on the level, adds isolation identifiers and mandatory security instruction text under the security package, and generates a securely encapsulated input.

[0049] The security control module is used to transmit the securely encapsulated input to the e-commerce intelligent customer service core to generate the original response, and to filter the original response for sensitive information, detect harmful content, and conduct domain consistency review to generate the final security response result.

[0050] According to a third aspect, a computing device includes:

[0051] one or more processors;

[0052] The storage device is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method.

[0053] In a fourth aspect, a computer-readable storage medium stores a program, which implements the method when executed by a processor.

[0054] The above solution of the present invention includes at least the following beneficial effects:

[0055] A dynamically updated multi-domain sensitive word detection rule library and special symbol matching rule set enable real-time capture and processing of sensitive words, special character sequences, and potential injection markers in input text. Compared to traditional static rules, this dynamic update mechanism rapidly adapts to e-commerce business changes and emerging attack vectors, such as malicious order injection and fake review manipulation during promotional activities. This improves the accuracy and timeliness of sensitive information filtering, effectively reducing the risk of data leakage and command injection attacks. Leveraging natural language understanding and sentiment analysis technologies, it not only identifies user semantic intent and sentiment but also identifies the interaction risks between them. Furthermore, by calculating the logical fluency and structural complexity of text, it can detect attackers deliberately obfuscating logic or hiding malicious commands. A domain deviation detection mechanism, based on the e-commerce domain knowledge graph, can quickly locate content unrelated to the core business, ensuring that customer service interactions remain centered around core e-commerce processes, safeguarding platform operations and user rights.

[0056] By integrating multi-dimensional detection results, the input text is divided into low, medium, and high risk levels, and differentiated processing strategies are implemented. For low-risk text, semantic reconstruction and term replacement are performed while ensuring security to maintain the fluency of the conversation; for medium- and high-risk text, attacks are promptly blocked through interception or partial interception, balancing security protection and user experience. Adding isolation identifiers and security instructions on the input side can enforce semantic constraints and prevent malicious instructions from breaking through boundaries; the output filters sensitive information, detects harmful content, and conducts domain consistency review on the original response to ensure that the returned results comply with business specifications and do not contain sensitive data. This two-way protection mechanism builds an end-to-end security closed loop, improving the security and reliability of e-commerce intelligent customer service systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 This is a flowchart of an attack defense method for an e-commerce intelligent customer service large model provided by an embodiment of the present invention.

[0058] Figure 2 This is a schematic diagram of an attack defense device for an e-commerce intelligent customer service large model provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0059] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0060] like Figure 1 As shown, an embodiment of the present invention proposes an attack defense method for an e-commerce intelligent customer service large model, the method comprising the following steps:

[0061] Step 1: Monitor the interaction data flow between users and intelligent customer service in real time to identify abnormal interaction behaviors. When abnormal behaviors are detected, activate the multi-layer defense strategy.

[0062] Step 2: Based on a multi-layered defense strategy, a dynamically updated multi-domain sensitive word detection rule base and special symbol matching rule set are used to identify and process sensitive words, special character sequences, and potential injection markers in the input text, generating a preliminary filtered text.

[0063] Step 3: For the initially filtered text, natural language understanding and sentiment analysis are used to identify semantic intent, sentiment, and the risk of interaction between the two to obtain a comprehensive analysis result. Based on the preset text comprehension ability, the overall logical fluency and local structure comprehension difficulty scores are calculated to generate a text structure assessment result, determine whether the input text is within the preset range, mark irrelevant content, and generate a domain relevance determination result.

[0064] Step 4: Integrate the filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results to obtain the overall risk level of the input text;

[0065] Step 5: Based on the overall risk level, the original input text is directly intercepted and the content is rewritten. An isolation identifier and mandatory security instruction text are added under the security encapsulation to generate a securely encapsulated input.

[0066] In step 6, the securely encapsulated input is sent to the e-commerce intelligent customer service core to generate the original response, and the original response is filtered for sensitive information, harmful content detection, and domain consistency review to generate the final security response result.

[0067] In this embodiment of the present invention, real-time monitoring of the interactive data stream between users and intelligent customer service can immediately detect any abnormal interactions and enhance awareness of potential threats. Once abnormal behavior is detected, a multi-layered defense strategy is activated, preventing the spread and further escalation of the threat. This securely establishes a solid first line of defense, effectively ensuring stable operation and user data security, and reducing losses caused by malicious attacks or illegal operations. Based on a dynamically updated multi-domain sensitive word detection rule base and a special symbol matching rule set, sensitive words, special character sequences, and potential injection markers in input text are identified and processed. This dynamically updated rule base can promptly adapt to evolving security threats, ensuring effective interception of new sensitive information and attack methods. By accurately identifying and processing these dangerous elements, a preliminary filtered text is generated, eliminating security risks caused by sensitive word leakage and malicious code injection at the source, and purifying the input text environment. Leveraging natural language understanding and sentiment analysis, the semantic intent, sentiment, and interaction risks of the input text are deeply explored. This allows the user's true intention and emotional attitude to be understood, avoiding misinterpretations of user intent that could lead to incorrect responses or adverse consequences. By calculating the overall logical fluency and the difficulty of understanding the local structure, the system generates a text structure assessment result. It also determines whether the input text falls within a preset range, flags irrelevant content, and generates a domain relevance determination result. This system comprehensively evaluates the input text not only from a semantic and emotional perspective, but also from the perspectives of text structure and domain relevance, accurately locating unreasonable or irrelevant content, thereby improving the accuracy of input text understanding and processing efficiency.

[0068] The filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results are integrated to determine the overall risk level of the input text. This multi-dimensional integrated assessment approach overcomes the limitations of single-metric assessments and comprehensively considers the risks of the input text from multiple perspectives. By integrating information from various dimensions, the security risk level of the text can be more accurately determined, ensuring appropriate handling of texts of varying risk levels. Based on the overall risk level, the original input text is directly intercepted and rewritten, and an isolation identifier and mandatory security instructions are added under a secure encapsulation. High-risk text is directly intercepted to prevent harm; text that poses a certain risk but is manageable is rewritten to meet security requirements. The addition of isolation identifiers and security instructions further enhances the security and controllability of the text, effectively isolating potential risks and ensuring the security and stability of data exchange within the intelligent customer service system. The securely encapsulated input is transmitted to the e-commerce intelligent customer service core to generate the original response. This original response is then filtered for sensitive information, checked for harmful content, and reviewed for domain consistency to produce the final security response. This step ensures that the response content output to the user not only undergoes strict security processing during the input stage, but also undergoes a comprehensive security check again after the response is generated. This prevents problems such as sensitive information leakage and harmful content output that may occur during the response generation process, and ensures the security, accuracy and domain consistency of the response results.

[0069] In a preferred embodiment of the present invention, the above step 1 monitors the interactive data flow between the user and the intelligent customer service in real time, identifies abnormal interactive behavior, and activates a multi-layer defense strategy when abnormal behavior is detected, which may include:

[0070] Step 110: construct a legitimate intent baseline based on the user session and calculate the intent matching degree of the current input text; when it is detected that the intent deviates from the baseline, obtain a first intermediate text that has undergone semantic isolation processing;

[0071] Step 111: Scan the first intermediate text for multilingual instructions using a cross-language attack signature library, intercept the detected malicious multilingual instructions in real time, and obtain a second intermediate text filtered for malicious instructions.

[0072] Step 112: Perform a logic consistency check on the second intermediate text to identify the characteristics of the jump attack path. When an illegal jump request is detected, it is blocked to obtain a third intermediate text that has been logically verified.

[0073] Step 113: Perform bidirectional desensitization processing on the third intermediate text, and perform dynamic masking on sensitive fields such as payment information and logistics order number; and generate a multi-layer defense strategy.

[0074] In this embodiment of the present invention, a large amount of normal interactive conversation data between users and intelligent customer service is collected. Through manual annotation or integration with existing knowledge graphs, the user intent in these conversations is classified and summarized to form a set of legitimate intents for different business scenarios (such as product inquiry, order inquiry, and after-sales service). Taking the product inquiry scenario as an example, legitimate intents may include inquiries about product price, material, and size. Based on this, statistical analysis methods are used to calculate the frequency of each legitimate intent in historical conversations and contextual features, thereby constructing a legitimate intent baseline for that scenario. For the current input text, natural language processing techniques such as word segmentation, part-of-speech tagging, and named entity recognition are first used to extract key information and semantic features from the text. These features are then compared one by one with each legitimate intent in the legitimate intent baseline. During the comparison process, different weights are assigned based on feature similarity and frequency of occurrence, and a matching score is calculated for the current input text and each legitimate intent. For example, if the input text contains "What is the processor model of this phone?", it will have a higher matching score with the intent "Inquiring about product specifications." When the matching scores of an input text with all legitimate intents are all below a preset threshold, the intent is determined to have deviated from the baseline. Once a deviation from the baseline is detected, the input text is split into semantic units, such as multiple segments based on punctuation, sentence structure, etc. Semantic analysis is then performed on each segment to identify any sensitive or abnormal semantic information that may exist. These abnormal semantic segments are processed by replacement, deletion, or marking to isolate them from the normal semantic parts, thereby obtaining the first intermediate text that has undergone semantic isolation.

[0075] Extensively collect known malicious attack instructions, statement patterns and features in various language environments, including but not limited to the expressions of SQL injection and XSS attacks in different languages. Classify and organize these attack features and establish a detailed cross-language attack feature library. Each feature record includes the attack type, the language involved, typical statement examples, and feature keyword information. For the first intermediate text, first use language recognition technology to determine the language type used in the text. Then, for different languages, extract the corresponding attack features and keywords from the cross-language attack feature library, and scan the text word by word and sentence by sentence. When a malicious instruction that matches the cross-language attack feature library is detected during the scanning process, the text fragment containing the instruction is immediately deleted or replaced, and it is removed from the first intermediate text, thereby obtaining a second intermediate text filtered by malicious instructions.

[0076] Analyze the logical relationships between statements in the second intermediate text and construct a logical relationship diagram for the text. Specifically, by identifying logical connectives (such as "because," "so," "if," and "then"), referential relationships (such as the objects referred to by pronouns), and the logical sequence of business processes (such as the order placement, payment, and delivery steps in the order process), the logical sequence and dependencies of each statement are determined. The logical relationship diagram is then checked for logical contradictions, unreasonable jumps, or missing links. For example, in an order query scenario, if a user directly requests to view order logistics information without entering an order number, this constitutes a logical inconsistency. Common redirect attack methods and patterns are studied, and corresponding attack path characteristics are summarized, such as abnormal page redirect links and redirect operations that do not conform to business processes. During the logical analysis of the second intermediate text, these redirect attack path characteristics are also checked. Once an illegal redirect request is detected in the text—that is, a redirect operation that does not conform to normal business logic and security standards—the redirect behavior is immediately blocked and the relevant text content is marked or deleted, resulting in a logically verified third intermediate text.

[0077] For the third intermediate text, on the one hand, scan from the beginning to the end of the text to identify sensitive information that may be contained therein, such as user name, ID number, contact information, etc., and replace it with specific characters (such as " " replace some characters) or anonymize them; on the other hand, scan again from the end of the text to the beginning and repeat the above desensitization operation to ensure that sensitive information is fully processed and avoid omissions. For specific sensitive fields such as payment information and logistics order numbers, formulate corresponding dynamic masking strategies according to their formats and business rules. For example, for the bank card number in the payment information, retain the first 6 digits and the last 4 digits, and use " "Replace"; for logistics order numbers, mask some numbers or letters according to the order number formats of different logistics companies. Through these operations, a multi-layer defense strategy is generated.

[0078] Establishing a legitimate intent baseline and calculating intent matching accurately identifies legitimate user interaction intent, effectively distinguishing between legitimate inquiries and malicious probing. Semantic isolation is performed when intent deviations are detected, promptly separating potentially dangerous semantics from legitimate content. This prevents malicious semantics from interfering with the intelligent customer service team's judgment and system operations, protecting user data security and system business logic. This also improves the accuracy of the intelligent customer service team's understanding of legitimate user intent and the effectiveness of its responses. A cross-language attack signature library and multilingual command scanning provide defense against malicious attacks in multilingual environments. In global e-commerce scenarios, this system effectively intercepts malicious commands written in different languages, preventing the exploitation of security vulnerabilities caused by language differences. This ensures security and stability in multilingual interaction environments, prevents user data leaks and system attacks, and provides secure and reliable interactive services for users worldwide. Logical consistency checks and identification of jump attack path signatures ensure the legitimacy and security of interactions at the business logic level. By checking textual logical relationships and blocking illegal redirect requests, attackers can be prevented from exploiting logical vulnerabilities to conduct malicious operations, such as illegally obtaining user information and tampering with business processes. This maintains the normal order of e-commerce business processes, ensures that user interactions comply with established rules, and enhances user trust and user experience in the intelligent customer service system. Bidirectional desensitization and dynamic masking provide dual protection for user sensitive information, reducing the risk of sensitive information leakage. Whether it is general sensitive information or key sensitive fields such as payment and logistics, they are all properly handled, protecting user privacy and financial security. Furthermore, the resulting multi-layered defense strategy provides more comprehensive security for subsequent interactions.

[0079] In a preferred embodiment of the present invention, step 2 above, based on a multi-layered defense strategy, uses a dynamically updated multi-domain sensitive word detection rule base and special symbol matching rule set to identify and process sensitive words, special character sequences, and potential injection markers in the input text to generate a preliminary filtered text, which may include:

[0080] Step 220: Using the dynamically updated multi-domain sensitive word detection rule library, perform word-by-word matching detection on the input original text; when a matching sensitive word is detected, replace the sensitive word with a preset safe placeholder to generate a sensitive word filtered text;

[0081] Step 221: Scan the text after sensitive word filtering using the special symbol matching rule set, identify and delete special character sequences and potential injection markers that meet the rules in the text, and generate a special symbol and injection marker filtered text;

[0082] Step 222 , analyzing the basic grammatical structure of the text after filtering out special symbols and injection marks, and verifying that the replacement and deletion operations do not destroy the integrity of the basic grammatical structure, so as to generate a preliminary filtered text.

[0083] In an embodiment of the present invention, a professional team is assembled to collect all types of sensitive information involved in the entire e-commerce business process, including but not limited to user privacy data (such as ID numbers and bank card numbers), prohibited product names (such as controlled knives and drug-related terms), and illegal marketing vocabulary (such as "national-level" and "best discount"). Simultaneously, the team monitors industry trends and changes in policies and regulations, and regularly updates the rule base. For example, when new regulations on banned words in product promotions are issued, the newly added words are promptly entered into the rule base. These sensitive words are categorized and organized by business domain to form a multi-domain sensitive word detection rule base. Each record contains information about the sensitive word, its domain, and its sensitivity level. After receiving the raw input text, word segmentation techniques used in natural language processing are used to break the text into individual words. Once a sensitive word matching the rule base is detected, it is replaced with a corresponding pre-set safe placeholder based on its sensitivity level. Highly sensitive words, such as ID numbers, may be replaced with "Highly sensitive information blocked." Generally sensitive words, such as illegal marketing vocabulary, are replaced with "Sensitive words processed," thus generating a sensitive word-filtered text.

[0084] Study common attack methods, such as special symbol combinations and markup patterns commonly used in SQL injection and XSS attacks. Collect these special symbol combinations, markup patterns, and their usage patterns in different attack scenarios, and organize them into a special symbol matching rule set. The rule set clearly defines the characteristics of each special symbol sequence or mark, the type of attack that may be triggered, the matching priority, and other information. For the text after sensitive word filtering, check word by word from the beginning to the end of the text to see whether there are special character sequences and potential injection marks that meet the special symbol matching rule set. When special character sequences and potential injection marks that meet the rules are identified, the text fragments containing these contents are immediately deleted from the text after sensitive word filtering to ensure that there are no dangerous symbols and marks that may trigger attacks in the text, and generate the text after special symbol and injection mark filtering.

[0085] Using natural language processing (NLP) grammatical analysis techniques, the text is processed after filtering for special symbols and injected markers. It identifies sentence components within the text, such as subject, predicate, object, attributive, and adverbial, and determines basic sentence structures, such as subject-verb-object and subject-copula-list. It also analyzes grammatical elements such as tense, voice, and referential relationships within the text to construct the basic grammatical structure of the text. It then checks whether the previous sensitive word replacement and special symbol removal operations have damaged the basic grammatical structure of the text. Specifically, it checks for missing sentence components, disorganized sentence structure, and ambiguous referential relationships. For example, if replacing sensitive words results in a missing subject, or if removing special symbols renders the sentence semantically incoherent, this indicates that the integrity of the basic grammatical structure has been compromised. If verification passes, meaning the basic grammatical structure remains intact, a preliminary filtered text is generated. If not, appropriate repairs and adjustments are made to the text until it meets the grammatical structure integrity requirements, and then a preliminary filtered text is generated.

[0086] A dynamically updated multi-domain sensitive word detection rule library and a per-word matching and replacement mechanism comprehensively cover all types of sensitive information in e-commerce businesses. Timely rule library updates adapt to evolving business needs and security threats, accurately identifying and addressing sensitive words. By replacing sensitive words with safe placeholders, we prevent sensitive information leaks, protect user privacy and platform compliance, and mitigate legal risks and reputational damage caused by sensitive words, ensuring that content used by intelligent customer service interactions complies with industry standards and legal regulations. A special symbol matching rule set and scanning and removal operations effectively defend against malicious attacks based on special symbols and markup. Basic grammatical structure analysis and verification ensures text readability and semantic coherence while ensuring secure processing. Without grammatical structure verification after sensitive word replacement and special symbol removal, incoherent sentences and confusing semantics may occur, hindering intelligent customer service's understanding of the text and subsequent responses. Verification and repair ensure that the initially filtered text effectively eliminates security risks while maintaining proper grammatical structure and clear semantic expression, enabling intelligent customer service to accurately understand user intent, provide appropriate and effective responses, and enhance the user interaction experience.

[0087] In a preferred embodiment of the present invention, the above step 3 utilizes natural language understanding and sentiment analysis to identify semantic intent, sentiment, and the risk of interaction between the two for the initially filtered text, thereby obtaining a comprehensive analysis result. Based on a preset text comprehension capability, the overall logical fluency and local structure comprehension difficulty scores are calculated to generate a text structure assessment result, determine whether the input text is within a preset range, mark irrelevant content, and generate a domain relevance determination result, which may include:

[0088] Step 330 , performing natural language understanding processing on the initially filtered text to identify semantic intent and sentiment tendency;

[0089] Step 331 , based on semantic intent and sentiment tendency, analyze the correlation between the two and evaluate the interaction risk level to generate a comprehensive analysis result;

[0090] Step 332 , performing an overall logical coherence analysis on the initially filtered text, and generating a logical fluency score using a preset text comprehension ability calculation rule system;

[0091] Step 333 , based on the logical fluency score and the complexity characteristics of the local structure of the text, a comprehension difficulty score is calculated to generate a text structure evaluation result;

[0092] Step 334: Match the initially filtered text with a preset e-commerce domain knowledge base to determine whether the text content is within a preset range and obtain a determination result;

[0093] Step 335 : Based on the determination result, irrelevant content that exceeds a preset range is marked to generate a domain relevance determination result.

[0094] In an embodiment of the present invention, the initially filtered text is segmented into multiple text segments, each of which is considered a "nest" in the cuckoo algorithm. The "eggs" in each nest represent different semantic units or sentimental features. The cuckoo is configured to determine the "fitness" generated by information such as vocabulary and grammatical structure in the text segment when searching for the final nest (i.e., accurate semantic intent and sentimental tendency). The fitness calculation combines the association weights of words in the semantic network and the sentiment scores of words in the sentiment lexicon. For example, for a text segment describing a product review, the negative score of "poor" in the sentiment lexicon, "poor quality," and the association weight of "quality" in the product semantic network jointly influence the fitness of the "nest." The cuckoo uses the Levy flight strategy to continuously explore new "nests" in the solution space formed by the text segments, retaining "nests" with high fitness, and ultimately determining the semantic intent and sentimental tendency.

[0095] Using semantic intent and sentiment as two dimensions, a two-dimensional "bird's nest" space is constructed. Each semantic intent-sentence combination constitutes a "bird's nest," with the "eggs" representing the associations between them. When calculating associations, the process of evaluating different "bird's nests" is simulated, mimicking the cuckoo's process of evaluating the quality of different "bird's nests." The fitness of a "bird's nest" is determined by calculating metrics such as semantic similarity and sentiment conflict between semantic intent and sentiment. For example, the semantic intent of "good value for money" (positive sentiment) and "reasonable price" (positive sentiment) have high semantic similarity and consistent sentiment, resulting in a high fitness nest. On the other hand, the combination of "poor product quality (negative sentiment)" and "good service attitude (positive sentiment)" has high sentiment conflict and low fitness. Based on the fitness level, the interaction risk level is categorized as low, medium, or high, generating a comprehensive analysis.

[0096] The initially filtered text is considered a "bird's nest cluster" consisting of multiple sentences, with each sentence being a "nest." Cuckoo calculates the "connection strength" between each "nest" and its adjacent "nests" by analyzing factors such as cohesive words, referential relationships, and thematic coherence between sentences. This connection strength is calculated based on cosine similarity between sentence vectors and knowledge-based semantic association. For example, the connection strength between the sentences "This phone takes clear photos" and "Its camera has high pixels" is determined by the referential relationship between "it" and the semantic association between photos and camera pixels. The weighted sum of the connection strengths between all "nests" is then combined with a pre-defined logical fluency calculation rule system to generate an overall logical fluency score. Based on the logical fluency score, the text is further subdivided into smaller local structures, such as paragraphs and clauses, with each local structure being considered a new "nest." When calculating the comprehension difficulty score, each "nest" is assigned a "difficulty coefficient" by factoring in the complexity of the local structure, such as sentence length, the depth of grammatical nesting, and the number of specialized terms. Cuckoo calculates the comprehension difficulty score by comparing the difficulty coefficients of different "bird's nests" and combining them with the logical fluency score, taking a weighted average. For example, a text with a high logical fluency score but containing complex and long sentences will have its difficulty coefficient increased, ultimately lowering the overall comprehension difficulty score, thereby generating an accurate text structure assessment.

[0097] Knowledge units in the pre-set e-commerce domain knowledge base are considered "high-quality nests," and the initially filtered text segments are considered "nests to be evaluated." Cuckoo determines whether the "nests to be evaluated" are close to "high-quality nests" by calculating semantic match and topic relevance between the text segments and the knowledge units in the knowledge base. This match is calculated using a deep learning-based semantic embedding mechanism, mapping the text segments and knowledge units in the knowledge base into the same vector space and calculating the distance between the vectors. When the distance is less than a preset threshold, the text content is considered within the preset range, resulting in a positive judgment; otherwise, a negative judgment is obtained. Based on the judgment result in step 334, text segments outside the preset range are considered "low-fitness nests." Cuckoo marks these "low-fitness nests" to identify irrelevant content. Simultaneously, the percentage of marked irrelevant content in the overall text is calculated and, combined with a preset domain relevance threshold, a domain relevance judgment result is generated. For example, if the proportion of irrelevant content exceeds 20%, the text is judged to have low domain relevance; otherwise, the text is considered to have high relevance.

[0098] The Cuckoo algorithm's Levy flight strategy and survival of the fittest mechanism enable the text analysis process to quickly locate key information within large amounts of text data, avoiding being trapped in localized solutions. Compared to traditional methods, it significantly improves accuracy in semantic intent identification and sentiment analysis, more precisely capturing the core semantic and emotional characteristics of a text. When analyzing the correlation and interaction risks between semantic intent and sentiment, the evaluation relationships constructed using the Cuckoo algorithm comprehensively consider multiple factors, enabling a more detailed grading of potential risks. This provides strong support for e-commerce platforms to promptly identify conflicting information and potential disputes in user feedback, helping them to proactively mitigate risks. Applying the Cuckoo algorithm to assess the logical fluency and comprehension difficulty of text breaks through the limitations of traditional single-metric evaluation. By simulating the cuckoo's evaluation of different "nests," it comprehensively considers the overall logic and local structural features of a text, enabling a more accurate assessment of text quality, providing valuable insights for scenarios such as e-commerce copywriting optimization and user review analysis. In the process of matching with the e-commerce knowledge base and marking irrelevant content, the Cuckoo algorithm can dynamically adjust the search strategy, quickly locate the degree of matching between the text and the knowledge base, accurately identify irrelevant content, and effectively filter out information irrelevant to the e-commerce field, making the field relevance determination results more reliable and providing purer and more effective data support for e-commerce data analysis, precision marketing and other businesses.

[0099] In a preferred embodiment of the present invention, the above step 4 integrates the filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results to obtain the overall risk level of the input text, which may include:

[0100] Step 440: Input the filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results into a preset rule judgment mechanism to obtain a risk factor conversion unit and a weight configuration unit;

[0101] Step 441: Based on the risk factor conversion unit, the sensitive word processing status, semantic intent classification results, attack risk probability, logical fluency score, comprehension difficulty score, and irrelevant content marking information are mapped into risk factors within a preset numerical range.

[0102] Step 442: Based on the weight configuration unit, a dynamic coefficient is set for each risk factor, and the coefficient size is adjusted according to the actual application scenario of the e-commerce intelligent customer service;

[0103] In step 443, a sum operation is performed on all risk factors to generate a total score, and a judgment is made based on the preset risk range of the total score. If the total score is lower than the first threshold, it is judged as a low risk level; if the total score is between the first threshold and the second threshold, it is judged as a medium risk level; if the total score is greater than the second threshold, it is judged as a high risk level, thereby obtaining the overall risk level of the input text.

[0104] In this embodiment of the present invention, the filtering results from step 2 (including sensitive word processing status and special symbol interception records) are first collected, along with the comprehensive analysis results from step 3 (semantic intent classification and sentiment interaction risk score), text structure assessment results (logical fluency score, comprehension difficulty score), and domain relevance determination results (irrelevant content marker, domain matching tag). For example, the filtering results for a given input text indicate "two sensitive words detected and replaced," the comprehensive analysis result indicates "complaint intent + angry emotion (high risk)," the text structure assessment score is "logical fluency 2, comprehension difficulty 14.5," and the domain relevance determination is "partially relevant (including irrelevant content marker)." This integrated data is then input into a pre-set rule-based judgment mechanism. This mechanism includes a risk mapping rule library trained on attack data. For example, "number of sensitive words ≥ 2" corresponds to an elevated risk rule, while "complaint intent + angry emotion" triggers a high-risk association rule. The rule-based mechanism retrieves matching relationships between data features and the rule library to output a risk factor conversion unit (which defines the numerical mapping rules for each indicator) and a weight configuration unit (which defines the weight coefficient range for each indicator).

[0105] Set the mapping rules for sensitive word processing status: no sensitive words → risk factor 0; 1 sensitive word → risk factor 3; 2 or more sensitive words → risk factor 7. For example, if two sensitive words are detected in a text, the mapping is to risk factor 7.

[0106] Semantic intent classification mapping: Mapped by intent risk level: "Product consultation" → 2 points, "After-sales service" → 4 points, "Complaint" → 7 points, "Potential attack intent" → 10 points. If the text intent is "Complaint", the mapping is 7 points.

[0107] Attack risk probability mapping: The attack risk probability (0-1) obtained from the comprehensive analysis is linearly mapped to a range of 0-10. For example, a risk probability of 0.8 is mapped to 8 points.

[0108] Logical Fluency Score Mapping: Reverse mapping the fluency score (out of 10 points) to the risk factor, with a fluency score of 10 → 0 (low risk) and a fluency score of 2 → 8 (high risk).

[0109] Understanding the difficulty score mapping: Forward mapping the difficulty score (out of 20 points) to the risk factor, difficulty 0 points → 0 points, 14.5 points → 14.5 × 0.5 = 7.25 points (converted at a 50% ratio).

[0110] Irrelevant content mark mapping: Mapping by the number of marks: no mark → 0 points, 1 mark → 5 points, multiple marks → 10 points. For example, if a text has 1 irrelevant content mark, it is mapped to 5 points.

[0111] The weighting unit adjusts the weights of various risk factors based on e-commerce application scenarios (such as promotional periods, daily customer service, and peak after-sales service). For example, during promotional periods, the weight of "sensitive word processing" is increased from 0.2 to 0.3 (due to the increased risk of malicious marketing during promotional periods), while the weight of "domain relevance" is reduced from 0.15 to 0.1 (due to the increase in inquiries, which leads to an increase in non-core domain issues). A basic weighting matrix is ​​set: sensitive word processing (0.2), semantic intent (0.25), attack risk (0.2), logical fluency (0.15), difficulty of understanding (0.1), and irrelevant content (0.1). Based on real-time scenario parameters (for example, if the current business line is "luxury customer service," the weight of "sensitive word processing" is increased), the basic weights are dynamically adjusted by ±30%.

[0112] Integrating risk data from multiple sources can avoid misjudgments based on a single metric. For example, combining the number of sensitive words and semantic intent risk can prevent attackers from using covert attacks using a combination of a small number of sensitive words and high-risk intent. The rule mechanism dynamically adjusts based on data to adapt to new attack vectors. For example, when a combination of low-sensitivity words and high emotional coercion is detected, the rule library automatically strengthens the risk mapping rules for this combination. Unified numerical mapping allows for quantifiable comparison of risks across different dimensions. For example, converting "semantic intent" and "logical fluency" to the same numerical range avoids assessment bias due to differences in metric scale. Dynamic mapping rules highlight key risks, such as linearly scaling "attack risk probability" to identify high-probability attack behaviors. Scenario-based weighting adjustments precisely match business needs. For example, during promotional events, focus on preventing and controlling marketing sensitive words, while luxury customer service prioritizes protecting privacy information. Real-time weighting updates can respond to unexpected security incidents. For example, if a certain type of attack surges during a certain period, the corresponding risk factor weighting will be automatically increased. Multi-threshold grading provides refined protection. Low-risk text is quickly released (improving customer service efficiency), medium-risk text triggers a secondary review (balancing security and user experience), and high-risk text is directly blocked (blocking major threats).

[0113] In a preferred embodiment of the present invention, step 5, based on the overall risk level, directly intercepts and rewrites the original input text, and adds an isolation identifier and mandatory security instruction text under a security package to generate a securely packaged input, may include:

[0114] Step 550: Based on the overall risk level, a risk response decision is made. If the overall risk level is low, no interception is performed; if the overall risk level is medium, only partial interception is performed; if the overall risk level is high, full text interception is performed; and content rewriting is performed on the original input text that has not been intercepted, including semantic reconstruction and term replacement.

[0115] Step 551: Semantic reconstruction converts suspected offensive statements into neutral expressions based on the semantic intent classification results in the comprehensive analysis results. Term replacement replaces non-standard expressions with safe terms based on the core terminology library in the e-commerce field.

[0116] Step 552, during the security encapsulation process, an isolation identifier is added to the rewritten text. At the same time, security instruction text is forcibly added at the beginning of the text, including predefined statements that prohibit the execution of external commands and enforce semantic constraints, to obtain the input result after security encapsulation.

[0117] In this embodiment of the present invention, the overall risk level (low / medium / high) output from step 4 is read. If the risk is low (total score < 3), interception is skipped. If the risk is medium (3 ≤ total score ≤ 7), only high-risk segments (such as irrelevant content and sensitive words) in the text are intercepted. If the risk is high (total score > 7), the entire input text is intercepted and not passed to the LLM. For example, if a text is medium risk, the system will delete the sensitive word segment "internal discount code" while retaining the valid content "Help me check my order." Semantic reconstruction and term replacement are performed on text that is not intercepted. During semantic reconstruction, offensive expressions in the text are analyzed. For example, "This crappy phone is terrible!" is identified as offensive and, using a sentiment polarity conversion algorithm, is rewritten as "The user experience of this phone needs improvement." Term replacement, based on a core e-commerce terminology library, replaces non-standard expressions such as "a certain treasure" with "platform" and "courier brother" with "logistics personnel" to ensure that expressions comply with industry standards.

[0118] Based on semantic intent classifications (e.g., "complaint" and "consultation") from comprehensive analysis results, we identify emotionally coercive or offensive passages in the text. Using sentiment dictionary matching technology, we identify negative terms such as "junk" and "scam," and reduce the intensity of sentiment through synonym replacement and sentence structure transformation. The core e-commerce terminology library includes standard terms such as "order" and "after-sales" and their non-standard equivalents. Using keyword matching technology, we scan the text for non-standard terms. If "I want to return an order" is found, it is replaced with the standard term "I want to apply for a refund," ensuring terminology consistency and security.

[0119] A unique isolation identifier is added to the beginning and end of the rewritten text. This identifier is generated using asymmetric encryption and is unique. It is used to mark the text boundary to prevent attackers from tampering with the context by injecting instructions. Predefined security instruction text is inserted at the beginning of the text, including:

[0120] Role: "[SYSTEM] You are a professional e-commerce customer service representative, answering only questions related to products, orders, and logistics."

[0121] Prohibited behavior: "[PROHIBITION] Disclosing user privacy, performing order modifications, etc. is strictly prohibited."

[0122] Semantic constraint: "[CONSTRAINT] All responses must comply with platform policies and use standard terminology." This directive uses a high-priority format to ensure that LLM prioritizes system commands over potentially malicious content in user input.

[0123] Low-risk texts are passed directly, improving customer service response speed; medium-risk texts accurately intercept dangerous segments to retain valid consultations; high-risk texts are completely blocked to prevent malicious attacks. Content rewriting eliminates emotional coercion and non-standard expressions in the text. For example, it converts offensive complaints into neutral consultations, which not only protects user emotions but also prevents the model from being induced to generate inappropriate responses. Semantic reconstruction effectively reduces the offensiveness and inducement of the text, avoiding misjudgment of the model due to emotional coercion. Terminology replacement unifies expression standards, prevents misunderstandings caused by non-standard terminology, and blocks covert attacks by attackers using special terminology. Isolation identifiers clarify text boundaries, preventing attackers from injecting malicious instructions by splicing multiple rounds of conversations. Mandatory security instructions establish an unalterable behavioral framework for LLM.

[0124] In a preferred embodiment of the present invention, step 6 above, wherein the securely encapsulated input is delivered to the e-commerce intelligent customer service core to generate an original response, and the original response is filtered for sensitive information, detected for harmful content, and reviewed for domain consistency to generate a final security response result, may include:

[0125] Step 660: Use the securely encapsulated input text as input to the e-commerce intelligent customer service core, perform semantic reasoning and task processing in the core processing, and generate the original response text;

[0126] Step 661: Perform a sensitive information filtering operation on the original response text, replace the discovered sensitive keywords with safe placeholders, and verify that the replacement operation does not destroy the integrity of the response semantics, thereby obtaining the filtered text;

[0127] Step 662: Perform a harmful content detection operation on the filtered text and compare the semantic intent classification results of the original input text using the intent matching function; if emotional conflict and intention deviation are detected, delete the harmful part to obtain a purified text;

[0128] Step 663: Perform a domain consistency review on the cleansed text to verify whether the text is consistent with the core e-commerce business process; if there is any inconsistency, trigger the rewrite function to align with the business specifications, obtain the reviewed text, and generate the final security response result.

[0129] In an embodiment of the present invention, the input text (including the isolation identifier and security instructions) after secure encapsulation in step 5 is delivered to the e-commerce intelligent customer service core module through the API interface. The intelligent customer service core parses the input text based on a large language model, first processing the system instructions (such as "only answer logistics questions"), and then extracting the user intention ("query order logistics"). The historical conversation context (if any) is associated through the attention mechanism to generate a semantically coherent response framework, such as "Your order [order number] has been shipped and the logistics status is [status]". Combined with the order database query function, specific logistics information is obtained (such as the logistics status of order number 12345 is "in transit"), filled into the response framework, and the original response text is generated.

[0130] Use a dynamically updated sensitive word library (including user privacy, internal data, etc.) to scan the original response text word by word. For example, if the response contains "user mobile number 138XXXX1234", "mobile number" and the specific number will be identified as sensitive words. Replace the scanned sensitive words, and replace highly sensitive information (such as mobile number) with "[privacy information has been blocked]", and general sensitive words (such as internal order status code) with "[security status]". For example, the original response "User mobile number 138XXXX1234 verified" will be rewritten as "User [privacy information has been blocked] verified". Use a syntactic analysis tool to check whether the replaced text has grammatical errors or semantic breaks. For example, verify whether "Your order [order number] status is [security status]" retains the core information. If the replacement causes the sentence to be incoherent (such as "Your [order number] status is in transit"), adjust the replacement strategy to partial blocking (such as "Your order 12 45 status is in transit").

[0131] Based on rules and machine learning, the filtered text is checked for content that violates regulations, such as insults, false information, and misleading actions. The semantic intent of the response text is compared with the intent classification results of the original input. The response's sentiment is also analyzed to ensure consistency with the input. For example, if the input is neutral and the response is "We're sorry to have kept you waiting! The logistics are indeed very slow," a sentiment conflict is detected (neutral input → negative response). If harmful content or conflict is detected, the specific fragment (such as "The logistics are indeed very slow") is located and deleted, retaining the valid information. For example, the cleansed text might be "Hello, your order 12345 has been shipped and is expected to arrive in two days." Based on the e-commerce knowledge graph (which defines standard processes such as order inquiries and refunds), the cleansed text is checked for compliance with business regulations. If any inconsistencies are found, a rewrite mechanism is triggered, with the rewrite logic adhering to the principle of "preserving the core intent while adhering to business regulations." Approved text is stripped of security encapsulation markers (such as isolation identifiers) and converted into natural language representation to generate the final safe response, such as "Hello, your order 12345 is in transit and is expected to arrive in two days. If you have any further questions, please feel free to contact us!"

[0132] Securely encapsulating input ensures that LLM prioritizes system instructions, preventing user input tampering (such as misleading users into answering non-e-commerce questions). Semantic reasoning and task processing combine to ensure responses are both consistent with business logic and natural language fluency. For example, when querying logistics, order data is automatically linked, improving response accuracy and efficiency. Dynamic sensitive word filtering prevents the leakage of user privacy (such as mobile phone numbers and order amounts) and internal data, complying with data security regulations. Semantic integrity verification ensures that filtering operations do not affect response readability. For example, partially blocking order numbers protects privacy while retaining essential information, balancing security and user experience. A dual detection mechanism (harmful content + intent and sentiment comparison) effectively intercepts offensive and misleading responses, preventing the generation of inappropriate content (such as user abuse and the spread of false information). For example, emotional conflict detection can identify negative emotions in customer service responses to avoid escalating user conflicts. Knowledge graph-based review ensures that responses strictly adhere to e-commerce business processes, preventing unauthorized operations (such as prompting payment before placing an order) or illegal instructions (such as external links). A rewrite function automatically corrects domain conflicts to ensure that all outputs comply with platform specifications.

[0133] like Figure 2 As shown, an embodiment of the present invention further provides an attack defense device for an e-commerce intelligent customer service large model, comprising:

[0134] Anomaly detection module, which monitors the interaction data stream between users and intelligent customer service in real time, identifies abnormal interaction behaviors, and activates multi-layer defense strategies when abnormal behaviors are detected;

[0135] The text filtering module is used to identify and process sensitive words, special character sequences, and potential injection markers in the input text based on a multi-layered defense strategy, using a dynamically updated multi-domain sensitive word detection rule base and special symbol matching rule set to generate preliminary filtered text;

[0136] The semantic assessment module is used to perform natural language understanding and sentiment analysis on the initially filtered text, identify semantic intent and sentiment, and their interaction risks, and calculate the overall logical fluency and local structure difficulty scores based on the preset text comprehension capabilities to generate text structure assessment results.

[0137] The domain determination module is used to determine whether the input text is within a preset range based on the text structure evaluation results, mark irrelevant content, and generate a domain relevance determination result;

[0138] The risk control module is used to integrate the filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results to obtain the overall risk level of the input text. It then performs direct interception and content rewriting based on the level, adds isolation identifiers and mandatory security instruction text under the security package, and generates a securely encapsulated input.

[0139] The security control module is used to transmit the securely encapsulated input to the e-commerce intelligent customer service core to generate the original response, and to filter the original response for sensitive information, detect harmful content, and conduct domain consistency review to generate the final security response result.

[0140] It should be noted that this device is a device corresponding to the above method, and all implementation methods in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.

[0141] An embodiment of the present invention further provides a computing device comprising: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the above-described method. All implementations in the above-described method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0142] The embodiment of the present invention further provides a computer-readable storage medium storing instructions, which, when executed on a computer, causes the computer to execute the above-described method. All implementations in the above-described method embodiment are applicable to this embodiment and can achieve the same technical effects.

[0143] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. A method for attack defense against large e-commerce intelligent customer service models, characterized in that: The method comprises: Step 1: Monitor the interaction data flow between users and intelligent customer service in real time to identify abnormal interaction behaviors. When abnormal behaviors are detected, activate the multi-layer defense strategy. Step 2: Based on a multi-layered defense strategy, a dynamically updated multi-domain sensitive word detection rule base and special symbol matching rule set are used to identify and process sensitive words, special character sequences, and potential injection markers in the input text, generating a preliminary filtered text. Step 3: For the preliminarily filtered text, natural language understanding and sentiment tendency analysis are used to identify semantic intent, sentiment tendency and the interaction risk between the two to obtain a comprehensive analysis result, and based on the preset text comprehension ability, the overall logical fluency and the local structure comprehension difficulty score are calculated to generate a text structure evaluation result, determine whether the input text is within the preset range, mark irrelevant content, and generate a domain relevance determination result, specifically including: performing natural language understanding processing on the preliminarily filtered text to identify semantic intent and sentiment tendency; based on semantic intent and sentiment tendency, analyzing the correlation between the two and evaluating the interaction risk level to generate a comprehensive analysis result; performing overall logical coherence analysis on the preliminarily filtered text, and generating a logical fluency score through a preset text comprehension ability calculation rule system; based on the logical fluency score, combined with the complexity characteristics of the local structure of the text, calculating the comprehension difficulty score to generate a text structure evaluation result; matching the preliminarily filtered text with the preset e-commerce domain knowledge base to determine whether the text content is within the preset range to obtain a determination result; based on the determination result, marking irrelevant content that exceeds the preset range to generate a domain relevance determination result; Step 4: Integrate the filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results to obtain the overall risk level of the input text; Step 5: Based on the overall risk level, the original input text is directly intercepted and the content is rewritten. An isolation identifier and mandatory security instruction text are added under the security encapsulation to generate a securely encapsulated input. In step 6, the securely encapsulated input is sent to the e-commerce intelligent customer service core to generate the original response, and the original response is filtered for sensitive information, harmful content detection, and domain consistency review to generate the final security response result.

2. The attack defense method for the e-commerce intelligent customer service large model according to claim 1 is characterized in that: Monitor the interaction data flow between users and intelligent customer service in real time to identify abnormal interaction behaviors. When abnormal behaviors are detected, activate a multi-layer defense strategy, including: A legitimate intent baseline is constructed based on the user session, and the intent matching degree of the current input text is calculated. When the intent deviates from the baseline, a first intermediate text is obtained after semantic isolation processing. The first intermediate text is scanned for multilingual instructions using a cross-language attack signature library, and malicious multilingual instructions detected are intercepted in real time to obtain a second intermediate text filtered from the malicious instructions; Performing a logical consistency check on the second intermediate text to identify the characteristics of the jump attack path, blocking any illegal jump request when it is detected, and obtaining a third intermediate text that has been logically verified; Implement bidirectional desensitization on the third intermediate text, and perform dynamic masking on sensitive fields such as payment information and logistics order number; generate a multi-layer defense strategy.

3. The attack defense method for the e-commerce intelligent customer service large model according to claim 2 is characterized in that: Based on a multi-layered defense strategy, the system uses a dynamically updated multi-domain sensitive word detection rule base and special symbol matching rule set to identify and process sensitive words, special character sequences, and potential injection markers in the input text, generating preliminary filtered text, including: Using a dynamically updated multi-domain sensitive word detection rule library, we perform word-by-word matching detection on the input original text. When a matching sensitive word is detected, it replaces the sensitive word with a preset safe placeholder to generate a sensitive word filtered text. Using the special symbol matching rule set, scan the text after sensitive word filtering, identify and delete the special character sequences and potential injection markers that meet the rules in the text, and generate the text after special symbol and injection marker filtering; The basic grammatical structure of the text after filtering out special symbols and injection marks is analyzed, and it is verified that the replacement and deletion operations do not destroy the integrity of the basic grammatical structure, so as to generate a preliminary filtered text.

4. The attack defense method for the e-commerce intelligent customer service large model according to claim 3 is characterized in that: Integrate the filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results to obtain the overall risk level of the input text, including: Input the filtering results, comprehensive analysis results, text structure assessment results and domain relevance determination results into the preset rule judgment mechanism to obtain the risk factor conversion unit and weight configuration unit; Based on the risk factor conversion unit, the sensitive word processing status, semantic intent classification results, attack risk probability, logical fluency score, comprehension difficulty score, and irrelevant content marking information are mapped into risk factors with preset numerical ranges. Based on the weight configuration unit, a dynamic coefficient is set for each risk factor, and the coefficient size is adjusted according to the actual application scenario of e-commerce intelligent customer service; A sum operation is performed on all risk factors to generate a total score, and a judgment is made based on the preset risk range of the total score. If the total score is lower than the first threshold, it is judged as a low risk level; if the total score is between the first and second thresholds, it is judged as a medium risk level; if the total score is greater than the second threshold, it is judged as a high risk level, and the overall risk level of the input text is obtained.

5. The attack defense method for the e-commerce intelligent customer service large model according to claim 4 is characterized in that: Based on the overall risk level, the original input text is directly intercepted and the content is rewritten. An isolation identifier and mandatory security instruction text are added under the security encapsulation to generate the securely encapsulated input, including: Based on the overall risk level, risk response decisions are made. When the overall risk level is low, no interception is performed; when the overall risk level is medium, only partial interception is performed; when the overall risk level is high, full text interception is performed; content rewriting is performed on the original input text that is not intercepted, including semantic reconstruction and term replacement; Semantic reconstruction converts potentially offensive statements into neutral expressions based on the semantic intent classification results from the comprehensive analysis results. Term replacement uses the core terminology library in the e-commerce field to replace non-standard expressions with safe terms. During the security encapsulation process, an isolation identifier is added to the rewritten text. At the same time, security instruction text is forcibly added at the beginning of the text, including predefined statements that prohibit the execution of external commands and enforce semantic constraints, to obtain the input result after security encapsulation.

6. The attack defense method for the e-commerce intelligent customer service large model according to claim 5 is characterized in that: The securely encapsulated input is delivered to the e-commerce intelligent customer service core to generate the original response. The original response is then filtered for sensitive information, harmful content detected, and domain consistency reviewed to generate the final security response result, including: The securely encapsulated input text is used as input to the e-commerce intelligent customer service core, where semantic reasoning and task processing are performed to generate the original response text. Perform sensitive information filtering on the original response text, replace the sensitive keywords found with safe placeholders, and verify that the replacement operation does not damage the integrity of the response semantics to obtain the filtered text; The filtered text is then checked for harmful content and the semantic intent classification results of the original input text are compared using the intent matching function. If emotional conflicts and intention deviations are detected, the harmful parts are deleted to obtain the purified text. Perform a domain consistency review on the cleansed text to verify whether the text is consistent with the core e-commerce business process; if there is any inconsistency, trigger the rewrite function to align with the business specifications, obtain the reviewed text, and generate the final security response result.

7. An attack defense device for an e-commerce intelligent customer service large model, the device implementing the method according to any one of claims 1 to 6, characterized in that: include: Anomaly detection module, which monitors the interaction data stream between users and intelligent customer service in real time, identifies abnormal interaction behaviors, and activates multi-layer defense strategies when abnormal behaviors are detected; The text filtering module is used to identify and process sensitive words, special character sequences, and potential injection markers in the input text based on a multi-layered defense strategy, using a dynamically updated multi-domain sensitive word detection rule base and special symbol matching rule set to generate preliminary filtered text; The semantic assessment module is used to perform natural language understanding and sentiment analysis on the initially filtered text, identify semantic intent and sentiment, and their interaction risks, and calculate the overall logical fluency and local structure difficulty scores based on the preset text comprehension capabilities to generate text structure assessment results. The domain determination module is used to determine whether the input text is within a preset range based on the text structure evaluation results, mark irrelevant content, and generate a domain relevance determination result; The risk control module is used to integrate the filtering results, comprehensive analysis results, text structure assessment results, and domain relevance determination results to obtain the overall risk level of the input text. It then performs direct interception and content rewriting based on the level, adds isolation identifiers and mandatory security instruction text under the security package, and generates a securely encapsulated input. The security control module is used to transmit the securely encapsulated input to the e-commerce intelligent customer service core to generate the original response, and to filter the original response for sensitive information, detect harmful content, and conduct domain consistency review to generate the final security response result.

8. A computing device, characterized in that include: one or more processors; A storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Automated classification of emotio-cogniton

    CA3207044A1

  • Stock public opinion monitoring and risk control system based on algorithm, big data and artificial intelligence

    CN114612239A