A method and system for managing an AI-powered intelligent middleware platform based on WeChat Mini Programs

By building an AI intelligent platform in the mini-program and using methods such as sensitive information identification and multi-objective AI model selection, the problems of long response time and high cost of large LLM models in the mini-program environment are solved, and a safe, controllable and efficient question-answering experience is achieved.

CN122133180APending Publication Date: 2026-06-02HAINAN JIUMUBEN INFORMATION TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HAINAN JIUMUBEN INFORMATION TECHNOLOGY CO LTD
Filing Date
2026-02-06
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Large LLM models are difficult to deploy in a mini-program environment, resulting in long response times and high costs, and traditional keyword filtering cannot meet content security requirements.

Method used

By adopting an AI-powered intelligent platform management method based on mini-programs, sensitive information identification, structured feature extraction, and multi-objective AI model selection are combined with retrieval enhancement and verification processes to achieve content security and efficient question answering.

Benefits of technology

In the mini-program environment, a secure, controllable, and fast-responding intelligent question-and-answer system was implemented, optimizing the balance between cost and service quality and providing users with a real-time and smooth interactive experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122133180A_ABST
    Figure CN122133180A_ABST
Patent Text Reader

Abstract

This application relates to the field of information management technology, specifically an AI intelligent platform management method and system based on WeChat Mini Programs. It constructs a secure, controllable, and highly efficient intelligent question-answering platform for Mini Program scenarios, its core value lying in achieving an excellent balance across multiple objectives. First, through three layers of sensitive information filtering and structured feature analysis, the system ensures content security and deep understanding at the source, solidifying compliance for enterprise-level applications. Second, it innovatively combines a search-enhanced generation process with intelligent model routing decisions. By dynamically selecting the most suitable AI model and injecting precise knowledge, it significantly improves the accuracy and reliability of answers while achieving an optimal balance between cost and service quality. With a complete end-to-end optimization and verification mechanism, the solution builds an efficient bridge between the lightweight front-end of Mini Programs and the heavyweight AI capabilities of the cloud, providing users with a real-time, smooth, and professional interactive experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information management technology, specifically an AI-powered intelligent middleware management method and system based on mini-programs. Background Technology

[0002] With the development of the LLM model, it has been applied to more and more technical fields, thereby providing users with high-quality question-and-answer services.

[0003] However, the LLM model is difficult to apply in the context of WeChat Mini Programs, for the following specific difficulties:

[0004] (1) Challenges of resource-constrained environments: The operating environment of mini-programs is usually limited by CPU, memory and network bandwidth, making it difficult to directly deploy large-scale AI models. The response time of traditional AI services is generally 2-3 seconds, which cannot meet the expectations of mini-program users for instant feedback (<500ms). Cloud service APIs are expensive and not friendly to the high-concurrency, low-cost scenarios of mini-programs.

[0005] (2) Content security and compliance requirements: Mini Programs are aimed at a wide range of users and need to strictly filter out illegal content. Traditional keyword filtering has a large number of misjudgments and omissions, which cannot meet the content security requirements. Summary of the Invention

[0006] In view of this, the purpose of this application is to provide an AI intelligent middleware management method and system based on mini-programs to solve the problems in the background technology.

[0007] To achieve the above objectives, this application adopts the following technical solution:

[0008] This application discloses an AI-powered intelligent middleware management method based on a mini-program, comprising the following steps:

[0009] Retrieve the question text from the user's current conversation turn;

[0010] Sensitive information identification is performed on the question text to obtain sensitive information identification results, wherein sensitive information identification includes keyword filtering, semantic detection and behavioral pattern analysis;

[0011] When the sensitive information identification result indicates that the question text has no sensitive information, the length and complexity features, intent features, and entity features of the question text are extracted, and a structured feature vector is constructed based on the length and complexity features, intent features, entity features, and the embedding vector of the question text.

[0012] The target AI model is selected from multiple large AI models in the structured feature vector backend, wherein all the large AI models are deployed on the server.

[0013] The search is enhanced based on the structured feature vector to obtain search results; input text is generated based on the search results and the question text, and the input text is input into the target AI model to obtain preliminary answer text; the preliminary answer text is validated to obtain validation results, and the answer text is output based on the validation results.

[0014] In one embodiment of this application, sensitive information identification is performed on the problematic text based on a pre-built performance optimization strategy to obtain sensitive information identification results, including:

[0015] The sensitive word filtering results are obtained by filtering the question text based on a pre-built set of sensitive words and a Bloom filter.

[0016] Semantic detection is performed on the question text based on a pre-trained classifier to obtain the category probability corresponding to the highest risk type. ;

[0017] The deviation between the question text and the user's historical behavior is analyzed based on a pre-built Markov chain model of user behavior. Among them, sensitive word filtering, semantic detection, and deviation calculation are processed in parallel;

[0018] A sensitivity decision score is calculated based on the filtering results, the sensitive risks, and the deviation. The sensitive decision score The mathematical expression is:

[0019]

[0020] In the formula, For indicator functions, Indicates the problem text. This represents the set of words extracted from the question text. Represents a set of sensitive words. Represents a set of words The words in Represents the sensitivity coefficient. Indicates the degree of abnormality;

[0021] The sensitive decision score The score is compared with a preset decision score threshold, and the sensitive decision score is... If the decision score is greater than or equal to a preset decision score threshold, the question text is determined to contain no sensitive information; otherwise, the question text is determined to contain sensitive information.

[0022] In one embodiment of this application, the deviation between the question text and the user's historical behavior is analyzed based on a pre-built Markov chain model of user behavior, including:

[0023] Get the user's historical request sequence ;

[0024] The question text is vectorized to obtain a text embedding vector. ;

[0025] Calculate the text embedding vector With the historical request sequence similarity And based on the similarity Calculate the anomaly degree of the question text. , wherein the anomaly degree The mathematical expression is:

[0026]

[0027]

[0028]

[0029] In the formula, Indicates the historical request index. Indicates the number of historical requests. Indicates the weight of historical requests. The attenuation coefficient is... Indicates the first Embedded vectors of historical requests, Represents the embedding vector With embedding vector Cosine similarity;

[0030] Based on the anomaly degree Calculate deviation .

[0031] In one embodiment of this application, when the sensitive information identification result indicates that the question text contains no sensitive information, the length and complexity features, intent features, and entity features of the question text are extracted, and a structured feature vector is constructed based on the length and complexity features, intent features, entity features, and embedding vector of the question text, including:

[0032] Extract the character length of the question text. And calculate the information entropy of the question text. The information entropy The mathematical expression is:

[0033]

[0034] In the formula, Indicates character index, Indicates the problem text. Character In the question text The frequency of occurrence;

[0035] The question text is used to identify intents based on a pre-built classification neural network to obtain the probabilities of multiple intent categories; and the intent graph index with the highest probability is extracted from the probabilities of the multiple intent categories.

[0036] Entities are extracted from the question text based on command entity recognition technology, resulting in multiple entities, their types, and confidence levels; the number of target entities with confidence levels higher than a threshold is then counted.

[0037] Based on the character length The information entropy The concept graph index, the number of multiple target entities, and the embedding vector of the question text are used to generate a structured feature vector.

[0038] In one embodiment of this application, selecting a target AI model based on multiple large AI models in the structured feature vector backend includes:

[0039] Based on the structured feature vectors, calculate the cost score, latency score, quality score, and usability score of multiple large AI models;

[0040] The cost score, the delay score, the quality score, and the availability score are weighted and summed to obtain a comprehensive score.

[0041] Based on the availability score, the availability of multiple large AI models is evaluated, and the currently available large AI model with the highest comprehensive score is selected as the target AI model.

[0042] In one embodiment of this application, the mathematical expression for the cost score is:

[0043]

[0044]

[0045]

[0046] In the formula, Representation Model Cost rating Representation Model Processing problem text The estimated cost, Indicates the maximum tolerable cost. Representing the problem text Estimated number of tokens Representation Model unit price, For safety margin, , , and All of these represent linear regression parameters obtained through training with historical data. Indicates the number of multiple target entities;

[0047] The mathematical expression for the delayed scoring is:

[0048]

[0049] In the formula, Representation Model Delayed scoring, The delay sensitivity coefficient, and All of these are linear regression parameters obtained through training with historical data;

[0050] The mathematical expression for the quality score is:

[0051]

[0052] In the formula, Representation Model Quality rating Indicates the quality index. Indicates the quantity of quality indicators. This indicates the task type determined by the concept graph index. Representation Model In task type The One quality indicator;

[0053] The mathematical expression for the usability score is:

[0054]

[0055] In the formula, Representation Model Usability rating Representation Model Number of successes within the target time period Representation Model The number of failures within the target time period, which is the target duration preceding the current time.

[0056] In one embodiment of this application, retrieval enhancement is performed based on the structured feature vector to obtain retrieval results, including:

[0057] Based on the embedding vectors in the structured feature vectors, keyword retrieval, semantic retrieval, and extended retrieval are performed respectively to obtain multiple documents;

[0058] Calculate keyword scores, similarity scores, and expansion scores for multiple documents. The keyword scores are obtained based on the BM25 algorithm, the similarity scores are obtained based on cosine similarity, and the expansion scores are obtained by calculating the cosine similarity between the embedding vector of the expanded document and the embedding vector of the question text.

[0059] The keyword score, similarity score, and extended score are weighted and summed to obtain the comprehensive similarity score; then, the K documents with the highest comprehensive similarity scores are selected to obtain the search results.

[0060] In one embodiment of this application, generating input text based on the search results and the question text includes:

[0061] Obtain the current dialogue round, and fill the structured template with the dialogues from the previous multiple rounds, the search results, and the question text to obtain the input text.

[0062] In one embodiment of this application, the preliminary response text is validated to obtain a validation result, and the response text is output based on the validation result, including:

[0063] S1, perform coherence verification, information content verification, relevance verification, and factual consistency verification on the preliminary response text;

[0064] S2, when the initial response text fails any one of the coherence check, information content check, relevance check and factual consistency check, it is corrected and a corrected response text is obtained. The initial response text is updated based on the corrected response text and the process returns to step S1 until the initial response text passes the coherence check, information content check, relevance check and factual consistency check.

[0065] S3, after the preliminary response text passes the coherence check, the information content check, the relevance check, and the factual consistency check, the preliminary response text is output as the response return text.

[0066] This application also provides an AI intelligent middleware management system based on a mini-program, including:

[0067] The retrieval module is used to retrieve the question text from the user;

[0068] The sensitive content verification module is used to identify sensitive information in the problem text based on a pre-built performance optimization strategy, and obtain the sensitive information identification result. The sensitive information identification includes keyword filtering, semantic detection and behavioral pattern analysis. The performance optimization strategy includes concurrent processing, caching strategy and preloading mechanism.

[0069] The feature extraction module is used to extract the length and complexity features, intent features, and entity features of the problem text when the problem text does not contain sensitive information in the sensitive information identification result, and to construct a structured feature vector based on the length and complexity features, intent features, entity features, and the embedding vector of the problem text.

[0070] The model routing module is used to select a target AI model from multiple large AI models in the structured feature vector backend, wherein the multiple large AI models are deployed on the server.

[0071] The answer management module is used to perform retrieval enhancement based on the structured feature vector to obtain retrieval results; generate input text based on the retrieval results and the question text, and input the input text into the target AI model to obtain preliminary answer text; and verify the preliminary answer text to obtain verification results, and output the answer text based on the verification results.

[0072] The beneficial effects of this application are as follows: This application presents an AI intelligent platform management method and system based on mini-programs, constructing a secure, controllable, and highly efficient intelligent question-answering platform for mini-program scenarios. Its core value lies in achieving an excellent balance of multiple objectives. First, through three layers of sensitive information filtering and structured feature analysis, the system ensures content security and deep understanding at the source, solidifying the compliance baseline for enterprise-level applications. Second, it innovatively combines the retrieval enhancement generation process with intelligent model routing decision-making. By dynamically selecting the most suitable AI model and injecting precise knowledge, it significantly improves the accuracy and reliability of answers while achieving the optimal ratio of cost and service quality. Finally, with a complete end-to-end optimization and verification mechanism, the solution builds an efficient bridge between the lightweight front-end of mini-programs and the heavyweight AI capabilities in the cloud, providing users with a real-time, smooth, and professional interactive experience, and building a sustainable and scalable intelligent service infrastructure for operators. Attached Figure Description

[0073] The present application will be further described below with reference to the accompanying drawings and embodiments:

[0074] Figure 1 This is an application scenario diagram of an AI intelligent middleware management method based on a mini-program, as shown in one embodiment of this application;

[0075] Figure 2This is a flowchart illustrating an AI intelligent middleware management method based on a mini-program in one embodiment of this application;

[0076] Figure 3 This is a logic flowchart according to the processing sequence in one embodiment of this application;

[0077] Figure 4 This is a structural diagram of an AI intelligent middleware management system based on a mini-program, as shown in one embodiment of this application. Detailed Implementation

[0078] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.

[0079] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. Therefore, the drawings only show the layers related to this application and are not drawn according to the actual number, shape and size of the layers in the actual implementation. In the actual implementation, the form, number and proportion of each layer can be arbitrarily changed, and the layer layout may also be more complex.

[0080] Numerous details are explored in the following description to provide a more thorough explanation of embodiments of this application; however, it will be apparent to those skilled in the art that embodiments of this application may be practiced without these specific details.

[0081] Figure 1 This is an application scenario diagram illustrating an AI intelligent middleware management method based on a mini-program, as shown in one embodiment of this application. Figure 1 As shown, this application includes a cloud portion and an edge portion. The cloud portion mainly includes a cloud server 110 that deploys / accesses various large AI models; the edge portion is deployed as a mini-program on the user's smart terminal 120. Users log in to the mini-program and input their requests. The mini-program performs simple processing on the request text and then uploads it to the server 120 for sensitive information identification, feature extraction, retrieval, model routing, prompt construction, output control, and output validation. Specific management methods are described below.

[0082] Figure 2 This is a flowchart illustrating an AI intelligent middleware management method based on a mini-program, as shown in one embodiment of this application. Figure 2As shown, the AI ​​intelligent middleware management method based on mini-programs in this application mainly includes the following steps:

[0083] S210, Obtain the question text from the user's current dialogue turn;

[0084] S220, perform sensitive information identification on the problem text to obtain sensitive information identification results, wherein sensitive information identification includes keyword filtering, semantic detection and behavioral pattern analysis;

[0085] S230, when the sensitive information identification result indicates that the problem text has no sensitive information, extract the length and complexity features, intent features and entity features of the problem text, and construct a structured feature vector based on the length and complexity features, intent features, entity features and the embedding vector of the problem text;

[0086] S240, Select the target AI model from multiple large AI models in the structured feature vector backend, wherein the multiple large AI models are all deployed on the server;

[0087] S250, perform retrieval enhancement based on the structured feature vector to obtain retrieval results;

[0088] S260, Based on the search results and the question text, generate input text and input the input text into the target AI model to obtain preliminary answer text; and verify the preliminary answer text to obtain a verification result, and output the answer text based on the verification result.

[0089] Figure 3 This is a logic flowchart illustrating the processing sequence in one embodiment of this application. Please refer to it. Figure 3 The following section provides an understanding of the overall process described above. The specific principles, implementation methods, and beneficial effects of this application's overall process include:

[0090] S210, Obtain the question text from the user's current dialogue turn;

[0091] In this application, since it is used in a mini-program, it is easily affected by network fluctuations and local performance and other operating environment factors. The question text for each dialogue round is processed by the following scheme to avoid the problem of inconsistent answers in the entire dialogue when one of the AI ​​models becomes unavailable due to network reasons. Since the previous dialogues will be retained during the subsequent input of AI models, there will be no problem of inconsistent answers in the previous text.

[0092] S220, perform sensitive information identification on the problem text to obtain sensitive information identification results, wherein sensitive information identification includes keyword filtering, semantic detection and behavioral pattern analysis;

[0093] In the context of mini-programs, the identification of sensitive information is extremely important due to the broad reach of the target audience. When a user submits a question to the system, it first passes through three security defenses, acting like a funnel-shaped filter to eliminate risky content layer by layer. These three defenses are rapid keyword filtering, deep semantic detection, and behavioral pattern analysis, which ensure content security through cascading probability multiplication. The specific process is as follows:

[0094] S221, Based on the pre-constructed sensitive word set and Bloom filter, the problem text is filtered for sensitive words to obtain the sensitive word filtering result;

[0095] This application employs a Bloom filter, a highly space-efficient probabilistic data structure. It uses multiple hash functions to map sensitive words into a bit array, enabling rapid determination of whether a word is in the sensitive word set. Its core principle is: if all hash positions are 1, the word may be in the set; if even one position is 0, the word is definitely not in the set. The false positive rate is extremely low (approximately 0.1%), but it avoids false negatives.

[0096] S222, Perform semantic detection on the question text based on a pre-trained classifier to obtain the category probability corresponding to the highest risk type. ;

[0097] In this application, a pre-trained BERT model is used to classify the questions. BERT is able to understand the semantic context, determine whether the question involves illegal content, and output a risk value.

[0098] For example, "How to make explosives" would be directly identified as high-risk, while "How to make a cake" would pass normally. This layer also analyzes dimensions such as the emotional tendency and aggression of the question.

[0099] In typical cases, normal problems < 0.1, high-risk problem > 0.7.

[0100] S223, Analyze the deviation between the question text and the user's historical behavior based on a pre-built Markov chain model of user behavior. Among them, sensitive word filtering, semantic detection, and deviation calculation are processed in parallel;

[0101] This application establishes a Markov chain model of user behavior to analyze the deviation between current requests and historical user behavior. For example, if a user who usually asks programming questions suddenly asks a large number of sensitive questions, the system will become more alert. This layer also combines information such as IP address and request frequency for comprehensive judgment, specifically including:

[0102] S2231, Obtain the user's historical request sequence ;

[0103] Historical request sequence .

[0104] S2232, The question text is vectorized to obtain a text embedding vector. ;

[0105] This application uses a pre-built word embedding model to vectorize the question text, obtaining the question's embedding vector (e.g., 1536 dimensions).

[0106] S2233, Calculate the text embedding vector With the historical request sequence similarity And based on the similarity Calculate the anomaly degree of the question text. , wherein the anomaly degree The mathematical expression is:

[0107]

[0108]

[0109]

[0110] In the formula, Indicates the historical request index. Indicates the number of historical requests. Indicates the weight of historical requests. The attenuation coefficient is... Indicates the first Embedded vectors of historical requests, Represents the embedding vector With embedding vector Cosine similarity;

[0111] The logic of the above calculation formula is as follows:

[0112] Represents text embedding vectors With historical request sequence The higher the similarity, the lower the anomaly. The lower;

[0113] Represents text embedding vectors With the Embedded vectors of historical requests cosine similarity, This involves a weighted summation of the cosine similarities of all historical requests.

[0114] Weight Using the time decay calculation formula The longer the time, the lower the weight.

[0115] S2234, based on the anomaly degree Calculate deviation .

[0116] Finally, the exponential decay function is used to measure the abnormality of user behavior. Convert it into a probability of success. It is a function that decays rapidly from 1 to 0. The more abnormal the behavior, the higher the degree of abnormality. The larger the deviation, the greater the deviation. The smaller the value, the lower the probability of approval. Sensitivity coefficient. Control the decay rate. The larger the value, the more sensitive the system is to abnormal behavior, and the probability of passing through even the slightest abnormality will drop sharply.

[0117] S224, Calculate the sensitivity decision score based on the filtering results, the sensitive risks, and the deviation. The sensitive decision score The mathematical expression is:

[0118]

[0119] In the formula, For indicator functions, The indicator function is set to zero when the word is a sensitive word, otherwise it is set to 1. Indicates the problem text. This represents the set of words extracted from the question text. Represents a set of sensitive words. Represents a set of words The words in Represents the sensitivity coefficient. Indicates the degree of abnormality;

[0120] Sensitive decision score The computational logic is a three-layer filtering joint probability model that comprehensively evaluates the security of the question text. Its core lies in decomposing content security review into three independent and progressive dimensions:

[0121] Keyword filtering layer: This layer checks the question text for any preset sensitive words using an indicator function. If even one sensitive word appears, the overall score immediately drops to zero, enabling rapid blocking.

[0122] Semantic risk layer: Calculates the semantic risk probability of the question text based on a deep learning model. .pass This is converted into a security probability to ensure that even literally compliant but semantically sensitive content is identified.

[0123] Behavioral anomaly layer: via exponential decay function Convert the abnormality of user behavior into a credibility coefficient. The more the behavior deviates from the historical normal pattern ( The more drastic the decline in credibility, the more effectively malicious behavior that is disguised or mutated can be identified.

[0124] The final score is the product of the three factors, reflecting the defensive strategy of "one-step veto, layer by layer": only requests with compliant keywords, semantic security, and normal behavior can receive a high score and pass. This design ensures both review efficiency and allows for precise quantitative assessment of complex risks.

[0125] S225, the sensitive decision score The score is compared with a preset decision score threshold, and the sensitive decision score is... If the decision score is greater than or equal to a preset decision score threshold, the question text is determined to contain no sensitive information; otherwise, the question text is determined to contain sensitive information.

[0126] System set threshold =0.8, meaning the request will only be processed if the success probability is greater than 0.8.

[0127] Decision rule: If If the value is 0.8, continue processing; otherwise, reject the request.

[0128] S230, when the sensitive information identification result indicates that the problem text has no sensitive information, extract the length and complexity features, intent features and entity features of the problem text, and construct a structured feature vector based on the length and complexity features, intent features, entity features and the embedding vector of the problem text;

[0129] After passing the sensitive information verification, the process proceeds to feature extraction. This step is like performing a comprehensive health check on the problem, extracting features from multiple dimensions to provide a basis for subsequent processing. The system will conduct in-depth analysis of the problem's length, complexity, intent, and entities, forming a structured feature vector. The specific process includes:

[0130] S231, Extract the character length of the question text. And calculate the information entropy of the question text. ;

[0131] First, not only the number of characters is counted, but also the effective information density is calculated. For example, "Hello" has only 2 characters, but its information density is low; while "Please explain the basic principle of quantum entanglement" is longer, but its information density is high. The complexity calculation uses information entropy to measure the complexity of the problem. The higher the entropy value, the more complex and uncertain the problem is.

[0132] Among them, the character length and the information entropy The mathematical expressions are as follows:

[0133]

[0134]

[0135] In the formula, represents the character index, represents the problem text, represents the character in the problem text appearance frequency;

[0136] S232, based on a pre-constructed classification neural network, perform intent recognition on the problem text to obtain the probabilities of multiple intent categories; and extract the main intent index with the highest probability from the probabilities of the multiple intent categories;

[0137] Using a multi-label classification neural network, map the problem to predefined intent categories, such as "query facts", "seek advice", "request creation", etc. The model will output the probability of each category, forming a probability distribution vector. The main intent index with the highest output probability is expressed as:

[0138]

[0139] In the formula, represents the th intent label.

[0140] S233, based on command entity recognition technology, extract entities from the problem text to obtain multiple entities, multiple entity types and confidence levels; count the number of target entities with multiple confidence levels higher than the threshold;

[0141] Specifically, use named entity recognition technology to extract personal names, place names, organization names, professional terms, etc. from the problem. This helps subsequent knowledge retrieval, such as identifying that "Einstein" is a physicist and "relativity" is a physics concept.

[0142] Then count the number of entities, and the number of entities is expressed as:

[0143]

[0144] S234, based on the character length The information entropy The concept graph index, the number of multiple target entities, and the embedding vector of the question text are used to generate a structured feature vector.

[0145] Finally, the embedded vectors of the question text are combined to generate a structured feature vector, represented as follows:

[0146]

[0147] S240, Select the target AI model from multiple large AI models in the structured feature vector backend, wherein the multiple large AI models are all deployed on the server;

[0148] Model routing acts like an intelligent scheduling center, matching the appropriate AI model to each request while balancing four dimensions: cost, latency, quality, and availability. This is a multi-attribute decision problem (MADM). The specific process is as follows:

[0149] S241, Calculate the cost score, latency score, quality score and usability score of multiple large AI models based on the structured feature vectors;

[0150] (1) The mathematical expression for the cost rating is:

[0151]

[0152]

[0153]

[0154] In the formula, Representation Model Cost rating Representation Model Processing problem text The estimated cost, Indicates the maximum tolerable cost. Representing the problem text Estimated number of tokens Representation Model unit price, For safety margin, , , and All of these represent linear regression parameters obtained through training with historical data. Indicates the number of multiple target entities;

[0155] The cost scoring function described above estimates the number of tokens required for the current problem (based on historical data and problem length), multiplies it by the model's unit price, and obtains the estimated cost. Cost scoring follows an inverse relationship: the lower the cost, the higher the score.

[0156] In this application, a ternary linear regression model is trained using historical data. Specifically, features are extracted from each request in the historical data to obtain the length, information entropy, and number of entities in the historical request, and the actual number of tokens required is labeled. Then, the length, information entropy, number of entities, and number of tokens from multiple historical requests are substituted into the ternary linear regression equation to perform least squares fitting to obtain the fitting parameters. , , and .

[0157] The fitting parameters obtained using the above steps , , and This allows us to estimate the number of tokens required for the current question text. By combining the model unit price and the reserved safety margin, the estimated cost is calculated. Finally, the estimated costs will be... Substitute the values ​​into the scoring function for normalization to obtain the cost score.

[0158] (2) The mathematical expression for the delayed scoring is:

[0159]

[0160] In the formula, Representation Model Delayed scoring, The delay sensitivity coefficient, and All of these are linear regression parameters obtained through training with historical data;

[0161] Specifically, this application records the historical response time of each model and calculates the latency score using an exponential decay function. The exponential function ensures that a small increase in latency will lead to a significant decrease in the score, which is consistent with users' sensitivity to response time.

[0162] The delay scoring function transforms the model's estimated response time into a quality score between 0 and 1 through an exponential decay function. Its core is to penalize delay, and the penalty intensity increases exponentially with the increase of delay.

[0163] In the formula This is a linear regression model; please refer to the previous section on the ternary linear regression equation for the construction process. Used to predict the current request In the model The processing time in the process.

[0164] Substitute the predicted delay value into the natural exponential function. And using the sensitivity coefficient Control the severity of punishment. The higher the latency score, the more sensitive the system is to increases in latency. This function transforms millisecond-level latency into a standardized "utility score" that can be directly compared with other dimensions (such as cost and quality). It allows the system to quantitatively weigh "speed" against "cost / quality" when making model routing decisions: for a real-time dialogue requiring rapid response, the system will choose the model with the higher latency score (even if it may be more expensive or slightly less capable), thus ensuring a better user experience. This perfectly simulates the non-linear perception of human response time—we are extremely sensitive to the first few seconds of waiting.

[0165] (3) The mathematical expression for the quality score is:

[0166]

[0167] In the formula, Representation Model Quality rating Indicates the quality index. Indicates the quantity of quality indicators. This indicates the task type determined by the concept graph index. Representation Model In task type The One quality indicator;

[0168] The quality scoring function is a multi-dimensional weighted comprehensive evaluation function used to quantitatively assess the overall quality performance of a specific AI model on a given task.

[0169] Its core logic follows these three steps:

[0170] Task scenario locking: The function is not a general evaluation model, but rather first through... Determine the specific task type to which the current problem belongs (e.g., code generation, creative writing, fact-finding, etc.). This is a prerequisite for evaluation, because the same model can perform very differently on different tasks.

[0171] Multi-dimensional performance evaluation: Targeted at specific task types ,from The model is evaluated based on several pre-defined professional dimensions (such as factual accuracy, logical coherence, instruction compliance, information security, and creativity). Score and get This is similar to multiple judges (dimensions) from different disciplines scoring a contestant (model) on a specific competition item (task type). Specifically, the aforementioned metrics come from implicit user feedback (real-time data), automated evaluation systems (batch evaluation), and manual sampling and labeling (calibration benchmarks), among other sources.

[0172] Weighted aggregation decision: The system assigns weights to each quality dimension based on the needs of different business scenarios. Assign a weight (all The sum is 1). Final score It is a weighted sum of scores for each dimension and their respective weights. This allows the system to flexibly guide choices: for example, in customer service scenarios, "accuracy" and "security" have higher weights; in creative scenarios, "fluency" and "novelty" have higher weights.

[0173] (4) The mathematical expression for the usability score is:

[0174]

[0175] In the formula, Representation Model Usability rating Representation Model Number of successes within the target time period Representation Model The number of failures within the target time period, which is the target duration preceding the current time.

[0176] Usability scoring is a usability estimation algorithm that uses Bayesian smoothing. Its core logic is to add a virtual "prior confidence sample" to the direct statistical success rate to solve the problem of statistical unreliability under small sample data and achieve fair evaluation of new models or models with low call volume.

[0177] S242, the cost score, the delay score, the quality score and the availability score are weighted and summed to obtain a comprehensive score;

[0178] Finally, the cost score, delay score, quality score, and availability score are weighted and summed using the weighted coefficient sequence to obtain the comprehensive evaluation score:

[0179]

[0180] in, As a cost weight, For delayed weights, For quality weight, This is the availability weight.

[0181] The above weights can be adjusted based on user attributes, for example:

[0182] # For free users, emphasize cost control

[0183] =1.6, =0.5, =0.8;

[0184] # For VIP users, emphasis is placed on quality.

[0185] =0.4, =1.7, =0.9;

[0186] # For real-time conversations, response speed is emphasized.

[0187] =2.0, =0.7;

[0188] # For complex analyses, emphasize quality

[0189] =2.2, =0.6;

[0190] S243, based on the availability score, evaluate the availability of multiple large AI models, and select the currently available large AI model with the highest comprehensive score as the target AI model.

[0191] Finally, AI models with usability scores greater than a preset threshold are designated as usable large models, and the model with the highest overall score among the usable large models is selected as the target AI model.

[0192] Based on the aforementioned scoring mechanism, this application can also implement a degradation mechanism. By establishing a multi-level degradation strategy chain, it ensures that the system can still provide services when some components fail. Fault detection is based on health indicators and employs an exponential backoff retry strategy. For example:

[0193] Level 0 (Normal): Use the optimal model;

[0194] Level 1: ifm* fault → Use suboptimal model;

[0195] Level 2: if all external models fail → use the local lightweight model;

[0196] Level 3: if the local model fails → return the cached answer;

[0197] Level 4: if no cache is found → return a predefined response.

[0198] S250, perform retrieval enhancement based on the structured feature vector to obtain retrieval results;

[0199] This application employs a hybrid retrieval approach to enhance search results, which can expand the search pool as much as possible. Specifically, this application uses a hybrid retrieval method combining keyword retrieval, semantic retrieval, and expanded terms. The specific process includes:

[0200] S251, based on the embedding vectors in the structured feature vector, keyword retrieval, semantic retrieval, and extended retrieval are performed respectively to obtain multiple documents;

[0201] S252, calculate the keyword score, similarity score, and expansion score of multiple documents, wherein the keyword score is obtained based on the BM25 algorithm, the similarity score is obtained based on cosine similarity, and the expansion score is obtained by calculating the cosine similarity between the embedding vector of the expanded document and the embedding vector of the question text;

[0202] Among them, keywords The mathematical expression for the score is:

[0203]

[0204] In the formula, This refers to the documents retrieved. Indicates document length. Indicates terms, Indicate word frequency, Indicates the average document length. Indicates the word frequency adjustment parameter. This represents the length normalization parameter. Indicates inverse document frequency.

[0205] The similarity score is calculated using standard cosine similarity, which will not be elaborated here.

[0206] The extended sub-rule adds extended terms to the original question text and then calculates the cosine similarity with the original question text.

[0207] S253, the keyword score, similarity score and extended score are weighted and summed to obtain the comprehensive similarity; and the K documents with the highest comprehensive similarity are selected to obtain the search results.

[0208] After weighted summation, the multiple documents are sorted, and the Top-K target documents are selected as the search results.

[0209] S260: Based on the search results and the question text, generate input text and input the input text into the target AI model to obtain preliminary answer text; then, validate the preliminary answer text to obtain a validation result, and output the answer text based on the validation result. The specific process is as follows:

[0210] S261, First, obtain the current dialogue round, and fill the structured template with the dialogues from multiple rounds before the current round, the search results, and the question text to obtain the input text.

[0211] Specifically, input text The mathematical expression is:

[0212]

[0213] The explanation is as follows:

[0214] The symbol indicates string concatenation;

[0215] This represents a system role template used to define the AI's identity, area of ​​expertise, and speaking style.

[0216]

[0217] Indicate identity, Indicates a professional field, Indicates speaking style, These are constraint terms. For example: ;

[0218] Correspondingly, when filling in the template, it reads: "You are a professional medical AI assistant, proficient in internal medicine and pediatrics. When answering questions, maintain a professional and warm attitude, but note: do not provide specific diagnostic suggestions."

[0219] Representing knowledge context

[0220] Specifically, the retrieved relevant documents are formatted. This is not a simple concatenation, but rather annotated with tags such as "[Reference 1]", "[Reference 2]", and their relevance scores are noted. This creates contextual items.

[0221] This represents the dialogue history, i.e., the previous few rounds of dialogue. This application uses a sliding window mechanism to retain the most recent N rounds of dialogue. For earlier rounds of dialogue, a summary is performed.

[0222] This refers to the original question text.

[0223] S262, after constructing the input text, the input text is fed into the target AI model to obtain the preliminary response text. Validation is then performed to ensure the quality of the output answer. The validation process includes:

[0224] S1, perform coherence verification, information content verification, relevance verification, and factual consistency verification on the preliminary response text;

[0225] (1) Continuity check

[0226] A small language model is used to evaluate the coherence of the current sentence with the preceding text. The mathematical expression for coherence evaluation is:

[0227]

[0228] In the formula, Indicates a time step. Indicates consistency rating. Indicates the current word element, Indicating the entire training corpus The marginal probability of occurrence Representing a given history Time generation The probability of.

[0229] Both probabilities are calculated using a small language model (such as Distilled BERT), and the ratio in the above formula measures the reasonableness of the current generated word in the context.

[0230] when The current word is more likely to appear in the context than randomly, indicating good coherence;

[0231] when The current word is irrelevant to the context;

[0232] when The current word is unlikely to appear in the context, indicating a possible lack of coherence.

[0233] Therefore, when Through consistency verification.

[0234] (2) Information content verification

[0235]

[0236] In the formula, Indicates the information content score. Indicates time step All text generated so far; Represents the set of all possible lexical units used by the system. For vocabulary Probability distribution across the entire text;

[0237] In the above calculation formula, the word distribution is estimated using an n-gram language model or neural network, and the word distribution entropy value of the currently generated text is calculated; then, the information content is evaluated based on the word distribution entropy value.

[0238] when If the entropy value is too low, the word distribution is relatively concentrated, and the answer may be too general, repetitive, or templated.

[0239] when At that time, the word distribution was balanced and the amount of information was moderate;

[0240] when If the words are too scattered, it indicates that the answer may be disorganized and lack focus.

[0241] Therefore, in the current At that time, the information content is verified.

[0242] (3) Correlation verification

[0243]

[0244] This application evaluates the relevance between the output text and the original question text using similarity scores. If the value is greater than the set value, the correlation check is considered passed.

[0245] (4) Verification of factual consistency

[0246]

[0247] In the formula, Represents a set of factual statements. Indicates the quantity of facts. Statement The vector, Representing knowledge documents The vector, Indicates the retrieval of a knowledge set;

[0248] In the above calculation formula, all factual statements are extracted from the initial preliminary response text. , ,..., ;

[0249] Then, for each fact statement, its relationship with the retrieved document is calculated. The maximum similarity;

[0250] The average similarity of all facts is used as the final fact consistency score. .

[0251] For example:

[0252] This demonstrates a high degree of consistency with the facts;

[0253] This indicates that the facts are basically consistent;

[0254] This suggests that there may be a contradiction with the facts.

[0255] Therefore, in At 0.8, the factual consistency check is passed.

[0256] S2, when the initial response text fails any one of the coherence check, information content check, relevance check and factual consistency check, it is corrected and a corrected response text is obtained. The initial response text is updated based on the corrected response text and the process returns to step S1 until the initial response text passes the coherence check, information content check, relevance check and factual consistency check.

[0257] Specifically, the correction methods include:

[0258] Guided restatement: Add "In other words,..."

[0259] Request for clarification: "You mean...?"

[0260] Rollback and retry: Delete the most recent n tokens and regenerate.

[0261] S3, after the preliminary response text passes the coherence check, the information content check, the relevance check, and the factual consistency check, the preliminary response text is output as the response return text.

[0262] S263 Finally, for the output text that has been validated, control the output in a streaming manner.

[0263] Streaming output allows users to see the answer generation process word by word, rather than waiting for the complete answer. This involves a token bucket algorithm to control the sending rate, combined with natural language boundary detection, to ensure a smooth data flow.

[0264] This application also uses a token bucket algorithm to control the sending rate and avoid network congestion. Imagine a bucket filled with water at a fixed rate (e.g., 20 tokens / second), with each transmission consuming 1 unit of water. If the bucket is empty, transmission is paused and resumed only when the bucket is full. This ensures a smooth data flow without sudden spikes or drops.

[0265] In summary, the technical solution described in this application "invisibly" integrates complex AI capabilities into a cloud-based intelligent platform, transforming lightweight mini-programs into secure, smooth, and reliable intelligent service entry points. Through triple dynamic security filtering and abnormal behavior detection, it strengthens content compliance defenses and effectively mitigates the risk of platform removal. The "zero-model" design at the edge releases terminal resources, and combined with multi-level degradation strategies and streaming output, ensures uninterrupted service and a lifelike experience even in scenarios with weak networks or low-end devices. The intelligent routing engine dynamically matches the optimal model based on user identity and question type, enabling refined operations that control costs for free users and provide quality for VIP users. Enhanced search and a four-fold verification loop significantly suppress "illusions," generating verifiable professional answers and building long-term user trust. The solution significantly lowers the integration threshold for developers, enabling rapid empowerment in diverse scenarios such as government affairs, healthcare, and education. Furthermore, it allows the elderly and users in lower-tier cities to enjoy high-quality AI services through a simple "scan-to-use" interaction, truly realizing "small applications carrying great intelligence" and promoting the widespread adoption of technology and the high-quality development of the mini-program ecosystem.

[0266] This application presents an AI intelligent platform management method based on WeChat Mini Programs, constructing a secure, controllable, and highly efficient intelligent question-answering platform for Mini Program scenarios. Its core value lies in achieving an excellent balance across multiple objectives. First, through three layers of sensitive information filtering and structured feature analysis, the system ensures content security and deep understanding at the source, solidifying compliance for enterprise-level applications. Second, it innovatively combines a search-enhanced generation process with intelligent model routing decisions. By dynamically selecting the most suitable AI model and injecting precise knowledge, it significantly improves the accuracy and reliability of answers while achieving an optimal balance between cost and service quality. Finally, with a complete end-to-end optimization and verification mechanism, the solution builds an efficient bridge between the lightweight front-end of Mini Programs and the heavyweight AI capabilities in the cloud, providing users with a real-time, smooth, and professional interactive experience, and constructing a sustainable and scalable intelligent service infrastructure for operators.

[0267] like Figure 4 As shown, this application also provides an AI intelligent middleware management system based on a mini-program, including:

[0268] The retrieval module is used to retrieve the question text from the user;

[0269] The sensitive content verification module is used to identify sensitive information in the problem text based on a pre-built performance optimization strategy, and obtain the sensitive information identification result. The sensitive information identification includes keyword filtering, semantic detection and behavioral pattern analysis. The performance optimization strategy includes concurrent processing, caching strategy and preloading mechanism.

[0270] The feature extraction module is used to extract the length and complexity features, intent features, and entity features of the problem text when the problem text does not contain sensitive information in the sensitive information identification result, and to construct a structured feature vector based on the length and complexity features, intent features, entity features, and the embedding vector of the problem text.

[0271] The model routing module is used to select a target AI model from multiple large AI models in the structured feature vector backend, wherein the multiple large AI models are deployed on the server.

[0272] The answer management module is used to perform retrieval enhancement based on the structured feature vector to obtain retrieval results; generate input text based on the retrieval results and the question text, and input the input text into the target AI model to obtain preliminary answer text; and verify the preliminary answer text to obtain verification results, and output the answer text based on the verification results.

[0273] This application presents an AI-powered intelligent platform management system based on WeChat Mini Programs. It constructs a secure, controllable, and highly efficient intelligent question-answering platform for Mini Program scenarios, its core value lying in achieving a superior balance across multiple objectives. First, through three layers of sensitive information filtering and structured feature analysis, the system ensures content security and deep understanding at the source, solidifying compliance for enterprise-level applications. Second, it innovatively combines a search-enhanced generation process with intelligent model routing decisions. By dynamically selecting the most suitable AI model and injecting precise knowledge, it significantly improves the accuracy and reliability of answers while achieving an optimal balance between cost and service quality. Finally, with a complete end-to-end optimization and verification mechanism, the solution builds an efficient bridge between the lightweight front-end of Mini Programs and the heavyweight AI capabilities of the cloud, providing users with a real-time, smooth, and professional interactive experience, and constructing a sustainable and scalable intelligent service infrastructure for operators.

[0274] This embodiment also provides an electronic terminal, including: a processor and a memory;

[0275] The memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory so that the terminal performs any of the methods in this embodiment.

[0276] As will be understood by those skilled in the art, the computer-readable storage medium described in this embodiment allows for the implementation of all or part of the steps in the above method embodiments by computer program-related hardware. The aforementioned computer program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0277] The electronic terminal provided in this embodiment includes a processor, a memory, a transceiver, and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication between them. The memory is used to store computer programs, the communication interface is used to perform communication, and the processor and the transceiver are used to run the computer programs, so that the electronic terminal performs the steps of the above method.

[0278] In this embodiment, the memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.

[0279] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0280] In the above embodiments, although the present application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. The embodiments of the present application are intended to cover all such substitutions, modifications, and variations falling within the broad scope of the appended claims.

[0281] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.

Claims

1. A method for managing an AI-powered intelligent middleware platform based on a mini-program, characterized in that: Including the following steps: Retrieve the question text from the user's current conversation turn; Sensitive information identification is performed on the question text to obtain sensitive information identification results, wherein sensitive information identification includes keyword filtering, semantic detection and behavioral pattern analysis; When the sensitive information identification result indicates that the question text has no sensitive information, the length and complexity features, intent features, and entity features of the question text are extracted, and a structured feature vector is constructed based on the length and complexity features, intent features, entity features, and the embedding vector of the question text. The target AI model is selected from multiple large AI models in the structured feature vector backend, wherein all the large AI models are deployed on the server. The search is enhanced based on the structured feature vector to obtain search results; input text is generated based on the search results and the question text, and the input text is input into the target AI model to obtain preliminary answer text; the preliminary answer text is validated to obtain validation results, and the answer text is output based on the validation results.

2. The AI ​​intelligent middleware management method based on mini-programs according to claim 1, characterized in that, Sensitive information is identified in the problematic text based on a pre-built performance optimization strategy, resulting in the following sensitive information identification results: The sensitive word filtering results are obtained by filtering the question text based on a pre-built set of sensitive words and a Bloom filter. Semantic detection is performed on the question text based on a pre-trained classifier to obtain the category probability corresponding to the highest risk type. ; The deviation between the question text and the user's historical behavior is analyzed based on a pre-built Markov chain model of user behavior. Among them, sensitive word filtering, semantic detection, and deviation calculation are processed in parallel; A sensitivity decision score is calculated based on the filtering results, the sensitive risks, and the deviation. The sensitive decision score The mathematical expression is: In the formula, For indicator functions, This indicates the problem text. This represents the set of words extracted from the question text. Represents a set of sensitive words. Represents a set of words The words in Represents the sensitivity coefficient. Indicates the degree of abnormality; The sensitive decision score The score is compared with a preset decision score threshold, and the sensitive decision score is... If the decision score is greater than or equal to a preset decision score threshold, the question text is determined to contain no sensitive information; otherwise, the question text is determined to contain sensitive information.

3. The AI ​​intelligent middleware management method based on mini-programs according to claim 2, characterized in that, The deviation between the question text and the user's historical behavior is analyzed based on a pre-built Markov chain model of user behavior, including: Get the user's historical request sequence ; The question text is vectorized to obtain a text embedding vector. ; Calculate the text embedding vector With the historical request sequence similarity And based on the similarity Calculate the anomaly degree of the question text. , wherein the anomaly degree The mathematical expression is: In the formula, Indicates the historical request index. Indicates the number of historical requests. Indicates the weight of historical requests. The attenuation coefficient is... Indicates the first Embedded vectors of historical requests, Represents the embedding vector With embedding vector Cosine similarity; Based on the anomaly degree Calculate deviation .

4. The AI ​​intelligent middleware management method based on mini-programs according to claim 1, characterized in that, When the sensitive information identification result indicates that the question text contains no sensitive information, the length and complexity features, intent features, and entity features of the question text are extracted. A structured feature vector is then constructed based on the length and complexity features, intent features, entity features, and the embedding vector of the question text, including: Extract the character length of the question text. And calculate the information entropy of the question text. The information entropy The mathematical expression is: In the formula, Indicates character index, This indicates the problem text. Character In the question text The frequency of occurrence; The question text is used to identify intents based on a pre-built classification neural network to obtain the probabilities of multiple intent categories; and the intent graph index with the highest probability is extracted from the probabilities of the multiple intent categories. Entities are extracted from the question text based on command entity recognition technology, resulting in multiple entities, their types, and confidence levels; the number of target entities with confidence levels higher than a threshold is then counted. Based on the character length The information entropy The concept graph index, the number of multiple target entities, and the embedding vector of the question text are used to generate a structured feature vector.

5. The AI ​​intelligent middleware management method based on mini-programs according to claim 4, characterized in that, Based on the structured feature vector backend, a target AI model is selected from multiple large AI models, including: Based on the structured feature vectors, calculate the cost score, latency score, quality score, and usability score of multiple large AI models; The cost score, the delay score, the quality score, and the availability score are weighted and summed to obtain a comprehensive score. Based on the availability score, the availability of multiple large AI models is evaluated, and the currently available large AI model with the highest comprehensive score is selected as the target AI model.

6. The AI ​​intelligent middleware management method based on mini-programs according to claim 5, characterized in that, in, The mathematical expression for the cost rating is: In the formula, Representation Model Cost rating Representation Model Processing problem text The estimated cost, Indicates the maximum tolerable cost. Representing the problem text Estimated number of tokens Representation Model unit price, For safety margin, , , and All of these represent linear regression parameters obtained through training with historical data. Indicates the number of multiple target entities; The mathematical expression for the delayed scoring is: In the formula, Representation Model Delayed scoring, The delay sensitivity coefficient, and All of these are linear regression parameters obtained through training with historical data; The mathematical expression for the quality score is: In the formula, Representation Model Quality rating Indicates the quality index. Indicates the quantity of quality indicators. This indicates the task type determined by the concept graph index. Representation Model In task type The One quality indicator; The mathematical expression for the usability score is: In the formula, Representation Model Usability rating Representation Model Number of successes within the target time period Representation Model The number of failures within the target time period, which is the target duration preceding the current time.

7. The AI ​​intelligent middleware management method based on mini-programs according to claim 1, characterized in that, The retrieval is enhanced based on the structured feature vector to obtain retrieval results, including: Based on the embedding vectors in the structured feature vectors, keyword retrieval, semantic retrieval, and extended retrieval are performed respectively to obtain multiple documents; Calculate keyword scores, similarity scores, and expansion scores for multiple documents. The keyword scores are obtained based on the BM25 algorithm, the similarity scores are obtained based on cosine similarity, and the expansion scores are obtained by calculating the cosine similarity between the embedding vector of the expanded document and the embedding vector of the question text. The keyword score, similarity score, and extended score are weighted and summed to obtain the comprehensive similarity score; then, the K documents with the highest comprehensive similarity scores are selected to obtain the search results.

8. The AI ​​intelligent middleware management method based on mini-programs according to claim 1, characterized in that, Based on the search results and the question text, input text is generated, including: Obtain the current dialogue round, and fill the structured template with the dialogues from the previous multiple rounds, the search results, and the question text to obtain the input text.

9. The AI ​​intelligent middleware management method based on mini-programs according to claim 1, characterized in that, The preliminary response text is validated to obtain a validation result. Based on the validation result, the response text is output, including: S1, perform coherence verification, information content verification, relevance verification, and factual consistency verification on the preliminary response text; S2, when the initial response text fails any one of the coherence check, information content check, relevance check and factual consistency check, it is corrected and a corrected response text is obtained. The initial response text is updated based on the corrected response text and the process returns to step S1 until the initial response text passes the coherence check, information content check, relevance check and factual consistency check. S3, after the preliminary response text passes the coherence check, the information content check, the relevance check, and the factual consistency check, the preliminary response text is output as the response return text.

10. An AI intelligent middleware management system based on mini-programs, characterized in that, include: The retrieval module is used to retrieve the question text from the user; The sensitive content verification module is used to identify sensitive information in the problem text based on a pre-built performance optimization strategy, and obtain the sensitive information identification result. The sensitive information identification includes keyword filtering, semantic detection and behavioral pattern analysis. The performance optimization strategy includes concurrent processing, caching strategy and preloading mechanism. The feature extraction module is used to extract the length and complexity features, intent features, and entity features of the problem text when the problem text does not contain sensitive information in the sensitive information identification result, and to construct a structured feature vector based on the length and complexity features, intent features, entity features, and the embedding vector of the problem text. The model routing module is used to select a target AI model from multiple large AI models in the structured feature vector backend, wherein the multiple large AI models are deployed on the server. The answer management module is used to perform retrieval enhancement based on the structured feature vector to obtain retrieval results; generate input text based on the retrieval results and the question text, and input the input text into the target AI model to obtain preliminary answer text; and verify the preliminary answer text to obtain verification results, and output the answer text based on the verification results.