General dialogue processing method and system based on traditional Chinese medicine AI digital large model

By using a dialogue processing method based on the TCM AI digital large model, combined with vector cache and inverted cache, and performing multi-layer vector calculations and inverted calculations, the problems of low efficiency and insufficient accuracy in the TCM dialogue processing system were solved, achieving efficient, accurate and stable dialogue processing effects.

CN120687569AInactive Publication Date: 2025-09-23AIYUNJI (WEIHAI) NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510793704.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-09-23
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the existing technology, the traditional Chinese medicine dialogue processing system cannot efficiently utilize historical dialogue information, resulting in insufficient dialogue coherence and accuracy, especially when processing complex traditional Chinese medicine knowledge systems and diagnostic logic.

Method used

A general dialogue processing method based on the TCM AI digital big model is adopted. By combining vector cache and inverted cache, historical query dialogue information is stored and retrieved, and multi-layer vector calculations and inverted calculations are performed to accurately capture semantic information. The integrity and validity verification mechanism is used to ensure the reliability of the configuration parameter set.

Benefits of technology

The efficiency and accuracy of dialogue processing are improved, the consistency and stability of dialogue are enhanced, and the problems of low efficiency and insufficient accuracy in the existing technology are solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120687569A_ABST
    Figure CN120687569A_ABST
Patent Text Reader

Abstract

The invention discloses a general dialogue processing method and system based on a traditional Chinese medicine AI digital large model, and belongs to the technical field of artificial intelligence. The method comprises the following steps: acquiring a current query dialogue and a historical query dialogue; performing vector caching and inverted caching on the historical query dialogue; lLM configuration and knowledge base configuration are obtained; performing vector calculation and inverted calculation on the current query dialogue; screening vector caches and inverted caches meeting a preset standard as related knowledge fragments; combining the current query dialogue, the related knowledge fragments and the historical query dialogue into Prompt, and sending the Prompt to the LLM to generate a response; and feeding back the response generated by the LLM to the user. By means of vector caching, inverted caching and combination of multi-layer vector calculation and inverted calculation, the technical effect of efficient and accurate dialogue processing is achieved, and the problems that in the prior art, dialogue processing is low in efficiency and insufficient in accuracy are effectively solved.
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 technology, and in particular to a general dialogue processing method and system based on a traditional Chinese medicine AI digital large model. Background Art

[0002] With the rapid development of artificial intelligence (AI) technology, general-purpose dialogue systems based on large models are increasingly being used in healthcare. In the context of digital Traditional Chinese Medicine (TCM), intelligent dialogue with users through AI large models can assist in the dissemination of TCM knowledge, health consultation, and diagnosis and treatment support. Existing dialogue processing systems typically implement dialogue management through simple keyword matching or single vector retrieval.

[0003] However, in the process of implementing the technical solutions of the invention in the embodiments of the present application, the present application found that the above technology has at least the following technical problems:

[0004] Existing conversation processing methods often fail to efficiently utilize historical conversation information, resulting in poor conversation coherence and accuracy. Furthermore, traditional vector search and keyword matching methods struggle to capture complex semantic information, especially when dealing with the rich knowledge base and complex diagnostic logic within Traditional Chinese Medicine (TCM). This leads to significant inefficiencies and inaccuracies. Summary of the Invention

[0005] The embodiments of the present application solve the problems of low efficiency and insufficient accuracy in dialogue processing in the prior art by providing a general dialogue processing method and system based on a large digital model of traditional Chinese medicine AI, and achieve efficient and accurate dialogue processing effects.

[0006] The embodiment of the present application provides a general conversation processing method based on a TCM AI digital large model, comprising the following steps: obtaining a current query conversation and a historical query conversation sent by a user through an application;

[0007] Perform vector caching and inverted caching on historical query conversations to obtain a historical query conversation cache library;

[0008] Identify the application identifier in the current query session, and obtain the LLM configuration and knowledge base configuration according to the application identifier;

[0009] Perform vector calculation and inverted index calculation on the current query dialogue based on the obtained LLM configuration and knowledge base configuration;

[0010] Using the acquired knowledge base configuration, the vector cache and inverted cache that meet the preset criteria are filtered from the historical query conversation cache as relevant knowledge fragments.

[0011] Combine the current query dialogue, related knowledge fragments, and historical query dialogues into a prompt, and send it to the LLM to generate a response;

[0012] Feedback the response generated by the LLM to the user.

[0013] Furthermore, the steps of performing vector caching and inverted caching on historical query conversations include:

[0014] Perform word segmentation on the text content of the historical query dialogue to obtain multiple words;

[0015] Performing vectorization conversion on the vocabulary to obtain corresponding vector representation;

[0016] Storing the vector representation;

[0017] Establishing an inverted index between the vocabulary and document identifiers of historical query conversations;

[0018] The inverted index is stored to obtain a historical query conversation cache library including a vector cache and an inverted cache.

[0019] Furthermore, the steps of identifying the application identifier in the current query session and obtaining the LLM configuration and the knowledge base configuration according to the application identifier include:

[0020] Parse the request header or body of the current query session and extract the application identification field;

[0021] Matching the extracted application identifier with a pre-stored application identifier list;

[0022] According to the matching results, the corresponding LLM configuration parameter set and knowledge base configuration parameter set are retrieved from the pre-built configuration storage system;

[0023] Verify the integrity and validity of the retrieved configuration parameter set;

[0024] The verified LLM configuration parameter set and knowledge base configuration parameter set are stored to obtain the LLM configuration and knowledge base configuration.

[0025] Furthermore, the steps of verifying the integrity and validity of the retrieved configuration parameter set include:

[0026] Perform integrity check on the configuration parameter set to be verified and calculate the integrity index I using the integrity index formula;

[0027] The integrity index formula is:

[0028]

[0029] Where N 实际 N is the number of parameters actually present in the configuration parameter set. 期望 The number of parameters expected to exist in the configuration parameter set;

[0030] Verify the validity of the configuration parameter set whose integrity index is not less than the preset integrity threshold, and calculate the validity index V through the validity index formula;

[0031] The effectiveness index formula is:

[0032]

[0033] Where S 有效 is the number of valid parameter states in the configuration parameter set; S 总 is the total number of states in the configuration parameter set;

[0034] If the validity index of the configuration parameter set is not less than the preset validity threshold, the configuration parameter set is determined to have passed the verification; otherwise, it fails.

[0035] Furthermore, the steps of performing vector calculation and inverted index calculation on the current query session include:

[0036] Performing word segmentation processing on the text content of the current query dialogue to obtain multiple words constituting the text content;

[0037] Use the pre-trained word vector model to convert multiple words obtained after word segmentation into corresponding vector representations;

[0038] According to the vector hierarchical standard predefined by the system, the converted vector representation is hierarchically divided;

[0039] Perform normalization on the vector representation in each layer and store the normalized vector representation;

[0040] Building an inverted index of the multiple words and the current query dialogue;

[0041] According to the system's predefined inverted index stratification rules, the constructed inverted index is stratified and the stratified inverted index is stored;

[0042] Vector calculation formula and inverted calculation formula are used to perform vector calculation and inverted calculation on the data after vector stratification and inverted stratification respectively.

[0043] Furthermore, the vector calculation formula and the inverted calculation formula are:

[0044] Vector calculation formula:

[0045]

[0046] Where V final is the vector calculation result of the current query dialogue, n is the number of vector layers, α iis the weight coefficient of the i-th layer vector, V i core is the core vector representation of the i-th layer, V i aux is the auxiliary vector representation of the i-th layer, β is the fusion coefficient of the core vector and the auxiliary vector, γ i is the normalization factor of the i-th layer vector;

[0047] Inverted calculation formula:

[0048]

[0049] Where, I final is the inverted index calculation result of the current query session, m is the number of layers of the inverted index, is the basic inverted index of the jth layer, is the inverted index of the position of the j-th layer, is the inverted index of synonyms at level j, Represents a weighted merge operation on an inverted index.

[0050] Furthermore, the steps of screening the vector cache and inverted cache that meet the preset criteria in the historical query session cache library include:

[0051] Pre-set similarity threshold and relevance threshold;

[0052] For each vector cache in the historical query conversation cache library, obtain the cosine similarity between it and the vector calculation result of the current query conversation;

[0053] For each inverted index in the historical query session cache, obtain the Jaccard correlation between it and the inverted index calculation result of the current query session;

[0054] Filter out vector caches and inverted caches whose cosine similarity is not less than a preset similarity threshold and whose Jaccard correlation is not less than a preset correlation threshold as relevant knowledge fragments;

[0055] The filtered relevant knowledge fragments are stored.

[0056] Furthermore, the steps to obtain cosine similarity and Jaccard correlation are:

[0057] Obtain cosine similarity through the cosine similarity calculation formula;

[0058] The formula for calculating cosine similarity is:

[0059]

[0060] Where V hist Vector cache for historical query conversations;

[0061] The Jaccard correlation is obtained by the Jaccard correlation calculation formula;

[0062] The Jaccard correlation calculation formula is:

[0063]

[0064] Where, I hist An inverted cache for historical query conversations.

[0065] Furthermore, the steps of combining the current query dialogue, related knowledge fragments, and historical query dialogues into a prompt and sending it to the LLM to generate a response include:

[0066] The text content of the current query dialogue, the relevant knowledge fragments, and the text content of the historical query dialogues are spliced ​​together to obtain a combined string;

[0067] Insert separators and identifiers into composed strings;

[0068] Encode the combined string;

[0069] The encoded combined string is sent as a prompt to the LLM to generate a response.

[0070] The embodiment of the present application provides a universal dialogue processing system based on a TCM AI digital big model, which is used to implement the universal dialogue processing method based on the TCM AI digital big model, and is characterized by including: a dialogue acquisition module, a historical dialogue cache module, a configuration acquisition module, a current dialogue calculation module, a related knowledge fragment acquisition module, and a response output module;

[0071] The conversation acquisition module is used to acquire the current query conversation and the historical query conversation sent by the user through the application;

[0072] The historical conversation cache module is used to perform vector caching and inverted caching on historical query conversations to obtain a historical query conversation cache library;

[0073] The configuration acquisition module is used to identify the application identifier in the current query session and acquire the LLM configuration and knowledge base configuration according to the application identifier;

[0074] The current dialogue calculation module is used to perform vector calculation and inverted index calculation on the current query dialogue according to the acquired LLM configuration and knowledge base configuration;

[0075] The relevant knowledge fragment acquisition module is used to filter the vector cache and inverted cache that meet the preset criteria in the historical query dialogue cache library through the acquired knowledge base configuration as the relevant knowledge fragment;

[0076] The response output module is used to combine the current query dialogue, related knowledge fragments and historical query dialogues into a prompt and send it to the LLM to generate a response;

[0077] Feedback the response generated by the LLM to the user.

[0078] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:

[0079] 1. By combining vector caching and inverted cache, historical query conversation information can be efficiently stored and retrieved. The vector cache enables fast retrieval based on semantic similarity, while the inverted cache enables efficient keyword-based queries. This combination not only improves conversation processing efficiency but also enhances conversation coherence and accuracy, effectively addressing the inefficiency of conversation processing in existing technologies.

[0080] 2. Through multi-layer vector calculation and inverted index calculation, the semantic information and keyword position information of the current query dialogue are accurately captured, thereby improving the accuracy and relevance of dialogue processing. This enables precise processing of complex Traditional Chinese Medicine knowledge and diagnostic logic, effectively solving the problem of insufficient dialogue processing accuracy in existing technologies.

[0081] 3. Through integrity and validity verification mechanisms, the reliability and consistency of configuration parameter sets are ensured, thereby preventing system failures caused by configuration errors. This ensures the stability and reliability of dialogue processing, effectively solving the problem of imperfect configuration management in existing technologies. BRIEF DESCRIPTION OF THE DRAWINGS

[0082] Figure 1 Flowchart of a general dialogue processing method based on a TCM AI digital model provided in an embodiment of the present application.

[0083] Figure 2 A schematic diagram of the structure of a general dialogue processing system based on a TCM AI digital model provided in an embodiment of the present application. DETAILED DESCRIPTION

[0084] The embodiments of the present application solve the problems of low efficiency and insufficient accuracy in dialogue processing in the prior art by providing a general dialogue processing method and system based on a large digital model of traditional Chinese medicine AI. By combining vector caching, inverted caching, and vector retrieval with inverted retrieval, historical query dialogue information is efficiently stored and retrieved, and multi-layer vector calculations and inverted calculations are used to accurately capture the semantic information of the current query dialogue, thereby achieving high efficiency, accuracy, and stability in dialogue processing.

[0085] In order to better understand the above technical solution, the above technical solution will be described in detail below with reference to the accompanying drawings and specific implementation methods.

[0086] like Figure 1 As shown, it is a flow chart of a general conversation processing method based on a TCM AI digital model provided by an embodiment of the present application, the method comprising the following steps: obtaining a current query conversation and a historical query conversation sent by a user through an application;

[0087] Perform hierarchical splitting of historical query conversations. Based on the hierarchical splitting results, perform vector caching and inverted caching to obtain a historical query conversation cache library.

[0088] The application management module identifies the application identifier in the current query session and obtains the corresponding LLM configuration and knowledge base configuration according to the application identifier;

[0089] The model gateway sends the current query dialogue to the knowledge base management module based on the obtained LLM configuration and knowledge base configuration for vector stratification and inverted stratification;

[0090] Based on the vector stratification and inverted stratification results, perform vector calculation and inverted ranking calculation on the current query session;

[0091] The knowledge base management module retrieves similar vectors related to the query from the historical query conversation cache using the acquired knowledge base configuration, and selects vector caches and inverted caches that meet the preset criteria as relevant knowledge fragments;

[0092] Combine the current query dialogue, related knowledge fragments, and historical query dialogues into a prompt, and send it to the LLM to generate a response;

[0093] Feedback the response generated by the LLM to the user.

[0094] Furthermore, the steps of performing vector caching and inverted caching on historical query conversations include:

[0095] Perform word segmentation on the text content of the historical query dialogue to obtain multiple words;

[0096] The steps of word segmentation processing include: using a predefined word segmentation algorithm to segment the text content of the historical query dialogue word by word; standardizing the segmented vocabulary, including removing stop words and punctuation marks; restoring the morphology and extracting the stems of the standardized vocabulary; and using the processed vocabulary as the result of word segmentation processing.

[0097] Perform vectorization conversion on the vocabulary to obtain the corresponding vector representation;

[0098] The steps of vectorization conversion include: selecting a predefined word embedding model and inputting the words after word segmentation into the word embedding model;

[0099] Obtain the vocabulary vector representation output by the word embedding model, normalize the vocabulary vector representation, and use the normalized vocabulary vector representation as the result of vectorization conversion.

[0100] Storing the vector representation in a vector cache database to store the vector representation;

[0101] At the same time, an inverted index is established between the vocabulary and the document identifiers of the historical query dialogue;

[0102] The step of extracting the document identifier includes: reading metadata of the historical query conversation record, extracting a unique identifier for each conversation from the metadata, and using the unique identifier as the document identifier.

[0103] The constructed inverted index is stored in the inverted cache database, and the inverted index is stored to obtain a historical query conversation cache library including a vector cache and an inverted cache.

[0104] Furthermore, during the initialization phase of the dialog system, a pre-stored application identifier list is created, the application identifier list including the application identifiers of all registered applications;

[0105] Storing the pre-stored application identifier list in the configuration storage system of the device, where the configuration storage system is a database or file system pre-defined by the system for storing application identifiers and corresponding configuration parameters;

[0106] In the configuration storage system, the corresponding LLM configuration parameter set and knowledge base configuration parameter set are pre-configured and stored for each application identifier;

[0107] Parse the request header or body of the current query session and extract the application identification field;

[0108] The steps for parsing the request header or request body of the current query conversation are as follows: first, read all the data in the request header or request body of the current query conversation, then determine the specific position or key name of the application identifier in the request header or request body, search for the predetermined application identifier field in the read data, and then extract the value of the found application identifier field to complete the parsing work.

[0109] Matching the extracted application identifier with a pre-stored application identifier list;

[0110] According to the matching results, the corresponding LLM configuration parameter set and knowledge base configuration parameter set are retrieved from the pre-built configuration storage system;

[0111] Verify the integrity and validity of the retrieved configuration parameter set;

[0112] The verified LLM configuration parameter set and knowledge base configuration parameter set are stored to obtain the LLM configuration and knowledge base configuration.

[0113] Furthermore, the steps of verifying the integrity and validity of the retrieved configuration parameter set include:

[0114] Perform integrity check on the configuration parameter set to be verified and calculate the integrity index I using the integrity index formula;

[0115] The integrity index formula is:

[0116]

[0117] Where N 实际 N is the number of parameters actually present in the configuration parameter set. 期望 The number of parameters expected to exist in the configuration parameter set;

[0118] Verify the validity of the configuration parameter set whose integrity index is not less than the preset integrity threshold, and calculate the validity index V through the validity index formula;

[0119] The effectiveness index formula is:

[0120]

[0121] Where S 有效 is the number of valid parameter states in the configuration parameter set. A valid parameter state means that the parameter value is within a predefined reasonable range. 总 is the total number of states in the configuration parameter set;

[0122] If the validity index of the configuration parameter set is not less than the preset validity threshold, the configuration parameter set is determined to have passed the verification, otherwise it fails;

[0123] Mark the configuration parameter set that passes verification as valid and store it in the specified area in memory.

[0124] Furthermore, the steps of performing vector calculation and inverted index calculation on the current query session include:

[0125] Perform word segmentation on the text content of the current query dialogue to obtain multiple words that constitute the text content;

[0126] Use the pre-trained word vector model (Word2Vec) to convert multiple words obtained after word segmentation into corresponding vector representations;

[0127] According to the system's predefined vector hierarchical standard (based on the semantic granularity of the vector), the converted vector representation is hierarchically divided;

[0128] Perform normalization on the vector representations in each layer to make the scale of the vector representations uniform; and store the normalized vector representations;

[0129] Building an inverted index between multiple terms and document identifiers of the current query session;

[0130] The steps for building an inverted index include: first, initializing the inverted index data structure and creating an empty dictionary to store the mapping between terms and documents. Second, iterating through all terms, determining the position of each term in the current query session, and creating a record for each term to record the location of its occurrence. Finally, each term and its corresponding document identifier (a unique identifier for the current query session) are added to the inverted index dictionary, completing the inverted index construction.

[0131] According to the system's predefined inverted index stratification rules (based on the frequency of keyword occurrence), the constructed inverted index is stratified and the stratified inverted index is stored;

[0132] Vector calculation formula and inverted calculation formula are used to perform vector calculation and inverted calculation on the data after vector stratification and inverted stratification respectively.

[0133] Furthermore, the vector calculation formula and the inverted calculation formula are:

[0134] Vector calculation formula:

[0135]

[0136] Where V final is the vector calculation result of the current query dialogue, n is the number of vector layers, α i is the weight coefficient of the i-th layer vector, which is determined by the layer weight parameter in the LLM configuration, V i core is the core vector representation of the i-th layer, which is calculated by the core vocabulary subset, V i aux is the auxiliary vector representation of the i-th layer, which is calculated by the auxiliary vocabulary subset, β is the fusion coefficient of the core vector and the auxiliary vector, which is determined by the vector fusion parameter in the knowledge base configuration, and γ i is the normalization factor of the i-th layer vector, ensuring that the modulus of the final vector meets the vector dimension requirements in the LLM configuration;

[0137] Inverted calculation formula:

[0138]

[0139] Where, I finalis the inverted index calculation result of the current query session, m is the number of layers of the inverted index, is the basic inverted index of the jth layer, recording the basic mapping relationship between words and documents. is the position inverted index of the jth layer, recording the position information of the vocabulary in the document, is the inverted index of synonyms at the jth level, recording the mapping relationship between vocabulary synonyms and documents, Indicates a weighted merge operation of the inverted index, where the weight is determined by the synonym weight parameter in the knowledge base configuration.

[0140] Furthermore, the steps of screening the vector cache and inverted cache that meet the preset criteria in the historical query session cache library include:

[0141] Pre-set similarity threshold and relevance threshold;

[0142] For each vector cache in the historical query conversation cache library, obtain the cosine similarity between it and the vector calculation result of the current query conversation;

[0143] For each inverted index in the historical query session cache, obtain the Jaccard correlation between it and the inverted index calculation result of the current query session;

[0144] Filter out vector caches and inverted caches whose cosine similarity is not less than a preset similarity threshold and whose Jaccard correlation is not less than a preset correlation threshold as relevant knowledge fragments;

[0145] The filtered relevant knowledge fragments are stored for use in subsequent steps.

[0146] Furthermore, the steps to obtain cosine similarity and Jaccard correlation are:

[0147] Obtain cosine similarity through the cosine similarity calculation formula;

[0148] The formula for calculating cosine similarity is:

[0149]

[0150] Where V hist Vector cache for historical query conversations;

[0151] The Jaccard correlation is obtained by the Jaccard correlation calculation formula;

[0152] The Jaccard correlation calculation formula is:

[0153]

[0154] Where, I histAn inverted cache for historical query conversations.

[0155] Furthermore, the steps of combining the current query dialogue, related knowledge fragments, and historical query dialogues into a prompt and sending it to the LLM to generate a response include:

[0156] The text content of the current query dialogue, the relevant knowledge fragments, and the text content of the historical query dialogues are spliced ​​together to obtain a combined string;

[0157] Insert separators and identifiers into composed strings;

[0158] Encode the combined string;

[0159] The encoded combined string is sent as a prompt to the LLM to generate a response.

[0160] like Figure 2 , which is a schematic diagram of the structure of a general dialogue processing system based on a TCM AI digital big model provided in an embodiment of the present application. The general dialogue processing system based on a TCM AI digital big model provided in an embodiment of the present application includes: a dialogue acquisition module, a historical dialogue cache module, a configuration acquisition module, a current dialogue calculation module, a related knowledge fragment acquisition module, and a response output module;

[0161] The conversation acquisition module is used to obtain the current query conversation and historical query conversation sent by the user through the application;

[0162] The historical conversation cache module is used to perform vector caching and inverted caching on historical query conversations to obtain a historical query conversation cache library;

[0163] Configuration acquisition module, used to identify the application identifier in the current query session and obtain LLM configuration and knowledge base configuration according to the application identifier;

[0164] The current conversation calculation module is used to perform vector calculation and inverted index calculation on the current query conversation based on the acquired LLM configuration and knowledge base configuration;

[0165] The relevant knowledge fragment acquisition module is used to filter the vector cache and inverted cache that meet the preset criteria in the historical query dialogue cache library through the acquired knowledge base configuration as relevant knowledge fragments;

[0166] The response output module is used to combine the current query dialogue, related knowledge fragments and historical query dialogues into a prompt and send it to the LLM to generate a response;

[0167] Feedback the response generated by the LLM to the user.

[0168] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0169] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0170] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0171] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0172] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0173] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

Claims

1. A general dialogue processing method based on a large digital model of Traditional Chinese Medicine AI, characterized by: The following steps are involved: Get the current query conversation and historical query conversation sent by the user through the application; Perform vector caching and inverted caching on historical query conversations to obtain a historical query conversation cache library; Identify the application identifier in the current query session, and obtain the LLM configuration and knowledge base configuration according to the application identifier; Perform vector calculation and inverted index calculation on the current query dialogue based on the obtained LLM configuration and knowledge base configuration; Using the acquired knowledge base configuration, the vector cache and inverted cache that meet the preset criteria are filtered from the historical query conversation cache as relevant knowledge fragments. Combine the current query dialogue, related knowledge fragments, and historical query dialogues into a prompt, and send it to the LLM to generate a response; Feedback the response generated by the LLM to the user.

2. The general dialogue processing method based on the TCM AI digital model as claimed in claim 1 is characterized in that: The steps for vector caching and inverted caching of historical query sessions include: Perform word segmentation on the text content of the historical query dialogue to obtain multiple words; Performing vectorization conversion on the vocabulary to obtain corresponding vector representation; Storing the vector representation; Establishing an inverted index between the vocabulary and document identifiers of historical query conversations; The inverted index is stored to obtain a historical query conversation cache library including a vector cache and an inverted cache.

3. The general dialogue processing method based on the TCM AI digital model as claimed in claim 1 is characterized in that: The steps of identifying an application identifier in the current query session and obtaining an LLM configuration and a knowledge base configuration according to the application identifier include: Parse the request header or body of the current query session and extract the application identification field; Matching the extracted application identifier with a pre-stored application identifier list; According to the matching results, the corresponding LLM configuration parameter set and knowledge base configuration parameter set are retrieved from the pre-built configuration storage system; Verify the integrity and validity of the retrieved configuration parameter set; The verified LLM configuration parameter set and knowledge base configuration parameter set are stored to obtain the LLM configuration and knowledge base configuration.

4. The general dialogue processing method based on the TCM AI digital model as claimed in claim 3 is characterized in that: The steps for verifying the integrity and validity of the retrieved configuration parameter set include: Perform integrity check on the configuration parameter set to be verified and calculate the integrity index I using the integrity index formula; The integrity index formula is: Where N 实际 N is the number of parameters actually present in the configuration parameter set. 期望 The number of parameters expected to exist in the configuration parameter set; Verify the validity of the configuration parameter set whose integrity index is not less than the preset integrity threshold, and calculate the validity index V through the validity index formula; The effectiveness index formula is: Where S 有效 is the number of valid parameter states in the configuration parameter set; S 总 is the total number of states in the configuration parameter set; If the validity index of the configuration parameter set is not less than the preset validity threshold, the configuration parameter set is determined to have passed the verification; otherwise, it fails.

5. The general dialogue processing method based on the TCM AI digital model as claimed in claim 1 is characterized in that: The steps for performing vector calculation and inverted index calculation on the current query session include: Performing word segmentation processing on the text content of the current query dialogue to obtain multiple words constituting the text content; Use the pre-trained word vector model to convert multiple words obtained after word segmentation into corresponding vector representations; According to the vector hierarchical standard predefined by the system, the converted vector representation is hierarchically divided; Perform normalization on the vector representation in each layer and store the normalized vector representation; Building an inverted index of the multiple words and the current query dialogue; According to the system's predefined inverted index stratification rules, the constructed inverted index is stratified and the stratified inverted index is stored; Vector calculation formula and inverted calculation formula are used to perform vector calculation and inverted calculation on the data after vector stratification and inverted stratification respectively.

6. The general dialogue processing method based on the TCM AI digital model as claimed in claim 5 is characterized in that: The vector calculation formula and the inverted calculation formula are: Vector calculation formula: Where V final is the vector calculation result of the current query dialogue, n is the number of vector layers, α i is the weight coefficient of the i-th layer vector, V i core is the core vector representation of the i-th layer, V i aux is the auxiliary vector representation of the i-th layer, β is the fusion coefficient of the core vector and the auxiliary vector, γ i is the normalization factor of the i-th layer vector; Inverted calculation formula: Where, I final is the inverted index calculation result of the current query session, m is the number of layers of the inverted index, is the basic inverted index of the jth layer, is the inverted index of the position of the j-th layer, is the inverted index of synonyms at level j, Represents a weighted merge operation on an inverted index.

7. The general dialogue processing method based on the TCM AI digital model as claimed in claim 6 is characterized in that: The steps for selecting vector cache and inverted cache that meet preset criteria in the historical query session cache library include: Pre-set similarity threshold and relevance threshold; For each vector cache in the historical query conversation cache library, obtain the cosine similarity between it and the vector calculation result of the current query conversation; For each inverted index in the historical query session cache, obtain the Jaccard correlation between it and the inverted index calculation result of the current query session; Filter out vector caches and inverted caches whose cosine similarity is not less than a preset similarity threshold and whose Jaccard correlation is not less than a preset correlation threshold as relevant knowledge fragments; The filtered relevant knowledge fragments are stored.

8. The general dialogue processing method based on the TCM AI digital model as claimed in claim 7 is characterized in that: The steps to obtain cosine similarity and Jaccard correlation are: Obtain cosine similarity through the cosine similarity calculation formula; The formula for calculating cosine similarity is: Where V hist Vector cache for historical query conversations; The Jaccard correlation is obtained by the Jaccard correlation calculation formula; The Jaccard correlation calculation formula is: Where, I hist An inverted cache for historical query conversations.

9. The general dialogue processing method based on the TCM AI digital model as claimed in claim 1 is characterized in that: The steps of combining the current query dialog, related knowledge fragments, and historical query dialogs into a prompt and sending it to the LLM to generate a response include: The text content of the current query dialogue, the relevant knowledge fragments, and the text content of the historical query dialogues are spliced ​​together to obtain a combined string; Insert separators and identifiers into composed strings; Encode the combined string; The encoded combined string is sent as a prompt to the LLM to generate a response.

10. A general dialogue processing system based on a TCM AI digital model, used to implement the general dialogue processing method based on a TCM AI digital model according to any one of claims 1 to 9, characterized in that: include: Dialogue acquisition module, historical dialogue cache module, configuration acquisition module, current dialogue calculation module, related knowledge fragment acquisition module, response output module; The conversation acquisition module is used to acquire the current query conversation and the historical query conversation sent by the user through the application; The historical conversation cache module is used to perform vector caching and inverted caching on historical query conversations to obtain a historical query conversation cache library; The configuration acquisition module is used to identify the application identifier in the current query session and acquire the LLM configuration and knowledge base configuration according to the application identifier; The current dialogue calculation module is used to perform vector calculation and inverted index calculation on the current query dialogue according to the acquired LLM configuration and knowledge base configuration; The relevant knowledge fragment acquisition module is used to filter the vector cache and inverted cache that meet the preset criteria in the historical query dialogue cache library through the acquired knowledge base configuration as the relevant knowledge fragment; The response output module is used to combine the current query dialogue, related knowledge fragments and historical query dialogues into a prompt and send it to the LLM to generate a response; Feedback of the response generated by the LLM to the user.