An enterprise intelligent assistant conversation routing method and system based on extensible skills and routing assets
By adopting an enterprise intelligent assistant dialogue routing method based on scalable skills and routing assets, the high maintenance cost and version inconsistency issues of static binding between routing trigger words and knowledge content in enterprise intelligent assistants are solved, and efficient and accurate dialogue routing and retrieval are achieved in multi-skill scenarios.
Patent Information
- Application Number
- CN202611076285.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-20
- Publication Date
- 2026-11-06
AI Technical Summary
Existing enterprise intelligent assistants, when multiple skills and knowledge bases coexist, suffer from high maintenance costs and omission risks due to the static binding of routing trigger words and knowledge content, as well as inconsistencies between index and routing versions.
By employing scalable skills and routing assets, and combining word segmentation for intersection and sentence vector similarity matching with conversation context management, the routing corpus is dynamically updated. Multi-channel parallel retrieval and weighted inverse sorting are used to generate natural language responses.
It enables the expansion of new business scenarios without modifying the core dialogue engine source code, solves the problem of the multi-round slot filling process of transactional skills not being preempted by the knowledge base question and answer path, reduces maintenance costs and omission risks, and improves retrieval recall and generation accuracy.
Smart Images

Figure CN123048706A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to an enterprise intelligent assistant dialogue routing method and system based on scalable skills and routing assets. Background Technology
[0002] With the rapid development of artificial intelligence technology, especially Large Language Model (LLM) technology, enterprise AI assistants have become important tools for improving office efficiency and reducing employees' information acquisition costs. Common forms of existing enterprise AI assistants or office automation solutions include the following categories: The first category is single-knowledge-base question-answering (RAG) products. These solutions focus on document retrieval and generation, capable of answering employee inquiries about policies and processes based on the enterprise's knowledge base. However, these solutions have weak support for multi-round transactional interactions such as meeting room booking, visitor workflows, and attendance inquiries, or require separating question-answering capabilities from transaction processing capabilities into multiple independent entry points, leading to frequent switching between different systems and a fragmented user experience for employees.
[0003] The second type is a single vector retrieval plus model generation scheme. This type of scheme embeds enterprise documents into a vector library in chunks, performs vector similarity retrieval when a user asks a question, and then calls a large language model to generate an answer based on the retrieval results. Although this type of scheme is simple to implement, it relies on a single vector retrieval channel, and the recall rate is unstable for scenarios such as proper nouns, policy clause numbers, and short questions. It is prone to "irrelevant answers" or situations where the source document fragment is weakly related to the question.
[0004] The third category is fixed keyword or rule-based routing schemes. These schemes use manually maintained word lists or regular expression rules to determine whether a user's question falls under the "search knowledge base" category, or which skill should be invoked for processing. However, in this type of scheme, there is a static binding relationship between the trigger words and the knowledge content. When documents are added, modified, or deleted in the knowledge base, the trigger word list needs to be manually updated synchronously. This is costly to maintain and prone to omissions, making it difficult for new knowledge to be included in the "whether to enter the knowledge base" judgment in a timely manner, leading to false rejections or false triggers.
[0005] The fourth category is the general dialogue platform plugin solution. This type of solution supports various business capabilities by configuring Prompt templates or mounting external workflows. However, the routing logic, transactional session state maintenance, and retrieval strategies of this type of solution are usually coupled in the application layer code, lacking lightweight routing assets that are aligned with the knowledge base version. When the knowledge base expands, the routing semantics may still point to the old knowledge view, leading to unpredictable system behavior.
[0006] In summary, existing technical solutions present numerous technical challenges when multiple skills and knowledge bases coexist in enterprise-scale deployment scenarios. Summary of the Invention
[0007] The technical problem to be solved by this invention is to provide an enterprise intelligent assistant dialogue routing method and system based on scalable skills and routing assets. This solves the high maintenance costs and omission risks caused by the static binding of routing trigger words and knowledge content in the prior art. At the same time, it solves the problem of inconsistency between index and routing version by aligning the corpus fingerprint and vector index version.
[0008] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: A first aspect is a dialogue routing method for an enterprise intelligent assistant based on scalable skills and routing assets, the method comprising: Based on the user's input of the current round's question text, firstly, trigger word matching is performed in the skill routing corpus by word segmentation and intersection method, and then secondly, semantic matching is performed by sentence vector similarity method to obtain candidate skills and their matching confidence scores. Based on whether there is an unfinished transactional skill session identifier in the session context that is in a suspended state, if the suspended state exists, the current round question will be directly connected to the slot filling logic of the transactional skill in the suspended state, interrupting subsequent routing steps. If the suspended state does not exist and the candidate skill is a knowledge base question answering skill, then the substring hit weight score of the current round question is calculated based on the full vocabulary merged across documents in the current release version of the routing asset, and the hits of the title field and route summary field of each document in the routing asset are added together to obtain the pre-gated comprehensive score. Based on the comparison between the pre-gated comprehensive score and the pre-configured pre-gated threshold, if the pre-gated comprehensive score reaches the pre-gated threshold, the routing decision will be determined as entering the knowledge base hybrid retrieval path; Based on the decision of entering the knowledge base hybrid retrieval path, candidate document fragments are obtained in parallel for the current round of questions through the database full-text keyword retrieval channel, the vector retrieval engine similarity retrieval channel, the full-text retrieval engine keyword retrieval channel and the rule matching retrieval channel. The candidate sets returned by each channel are then weighted and sorted inversely to obtain the top candidate document fragment list after fusion and sorting. Based on the list of candidate document fragments at the top, a large language model is injected to generate context, resulting in a natural language response text which is then output to the user interface.
[0009] Secondly, an enterprise intelligent assistant dialogue routing system based on scalable skills and routing assets includes: The skill management and routing corpus construction module is used to construct a skill routing corpus set based on the metadata description text, trigger phrase list and skill type identifier of each enabled skill package obtained by scanning the built-in skill directory and custom skill directory during system runtime. The skill routing matching module is used to perform first-level trigger word matching in the skill routing corpus by first finding the intersection of word segments, and then performing second-level semantic matching by sentence vector similarity, based on the current round question text input by the user, to obtain candidate skills and their matching confidence scores. The session state management module is used to determine the current routing priority based on whether there is an incomplete transactional skill session identifier in the session context that is in a suspended state. If the suspended state exists, the current round question is directly connected to the slot filling logic of the transactional skill in the suspended state, interrupting subsequent routing steps.
[0010] The above-described solution of the present invention has at least the following beneficial effects: The extensible skill mechanism supports various business capabilities such as meeting room booking (multi-round slot filling), visitor invitation, visitor appointment, and attendance inquiry. Administrators can upload and enable custom skills in a standard skill package format, expanding new business scenarios without modifying the core dialogue engine source code. Simultaneously, through session-level state machine management (pending_skill session identifier), it ensures that the multi-round slot filling process of transactional skills is not preempted by the knowledge base question-and-answer path, resolving the transaction interruption problem caused by the lack of state management when multiple skills coexist in existing technologies (corresponding to technical issue D5).
[0011] RoutePack includes a full vocabulary merged across documents, corpus fingerprint identifiers, and monotonically increasing version numbers. It automatically generates route summaries and query phrase lists for each document using a large language model, replacing the manual maintenance of trigger vocabulary in traditional solutions. When knowledge base documents change, it supports both incremental updates (partial recalculation of the routing corpus for affected documents) and full reconstruction, and uses a TTL mechanism to achieve smooth invalidation of in-process cache. This solution addresses the high maintenance costs and omission risks caused by the static binding of route trigger words to knowledge content in existing technologies. Furthermore, by aligning the corpus fingerprint with the vector index version, it resolves the inconsistency between the index and route versions.
[0012] Under the knowledge base question-answering path, candidate document fragments are obtained in parallel through four channels: full-text keyword retrieval from the database, similarity retrieval from the vector retrieval engine, keyword retrieval from the full-text retrieval engine, and rule matching retrieval. The results from each channel are dynamically fused using weighted inverse ranking fusion (WRRF). The weight coefficients are dynamically adjusted based on the textual features of the question (length, whether it contains proper nouns, etc.), so that the keyword channel receives higher weight in scenarios such as short questions and proper noun queries, while the vector channel receives higher weight in scenarios with long questions. This solution solves the problem of unstable recall for a single retrieval channel in scenarios such as proper nouns, policy clause numbers, and short questions.
[0013] A separate processing strategy is adopted for the generation and retrieval sides: on the generation side, parsed time-zoned time context text is injected into the large language model to ensure the accuracy of the generated content's time; on the retrieval side, the appending of timestamp suffixes is suppressed for timeliness and availability queries, preventing irrelevant policy documents from gaining high similarity in vector retrieval due to containing a large number of date characters. This solution solves the problem in existing technologies where directly concatenating timestamps into search queries leads to irrelevant long documents polluting the search results. Attached Figure Description
[0014] Figure 1 This is a flowchart illustrating the enterprise intelligent assistant dialogue routing method based on scalable skills and routing assets according to the present invention.
[0015] Figure 2 This is a schematic diagram of the enterprise intelligent assistant dialogue routing system based on scalable skills and routing assets according to the present invention. Detailed Implementation
[0016] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0017] See Figures 1 to 2 This embodiment provides an enterprise intelligent assistant system based on scalable skills and routing assets, including the following main modules: The skill management and routing corpus construction module is responsible for scanning the built-in skill directory (such as . / skills / builtin / ) and the custom skill directory (such as . / skills / custom / ) during system runtime, reading the SKILL.md metadata file of each enabled skill package, extracting the skill name, description text, list of trigger condition phrases and skill type identifier (such as "transaction" for transactional, "knowledge" for knowledge-based, and "query" for query-based), assembling them into a skill routing corpus set, storing it in memory, and rebuilding it when the skill package changes.
[0018] The skill routing and matching module is responsible for performing two-level routing matching on user questions. The first level, trigger word matching, segments the question and finds its intersection with the list of trigger phrases for each skill. Skills with a non-empty intersection are added to the candidate set. The second level, semantic matching, encodes the candidate skill metadata description text block and the user question into sentence vectors (e.g., based on the text2vec-large-chinese model), calculates the cosine similarity as the matching confidence score, and selects the skill with the highest score as the candidate skill.
[0019] The session state management module is responsible for maintaining the transactional skill state in each session context. The data structure includes session_id, pending_skill_id, slots mapping table, and pending timestamp. When pending_skill_id is not empty and has not timed out, the current round's question is directly connected to the skill's slot filling logic, skipping all subsequent routing steps, ensuring that multiple rounds of slot filling tasks, such as meeting room reservations, are not interrupted.
[0020] The routing asset pre-gating module loads the current release version of the RoutePack data package when the candidate skill is knowledge_qa. It performs substring matching of the vocabulary and accumulates the hit weight. At the same time, it performs matching and accumulates the score for the document title and route_summary. The two parts are added together to obtain the pre-gating comprehensive score. If the score reaches a threshold (e.g., 0.38), the user is routed to the knowledge base hybrid search path.
[0021] The hybrid retrieval module performs a four-channel parallel retrieval on the question: full-text keyword retrieval in the database (PostgreSQLtsquery), vector retrieval (QdrantANN retrieval, with a fallback to the local embedding_json on failure), full-text keyword retrieval in Elasticsearch (BM25), and rule matching retrieval (regular expression / keyword rule base); and performs WRRF fusion and sorting on the results of each channel.
[0022] The large language model generation module injects Top-K document fragments, grounding constraint prompts, and optional temporal contexts into a large language model (such as DeepSeek, Qwen, or GLM) to generate natural language response text and output it to the user interface.
[0023] The route asset building and publishing module is responsible for the full build and incremental update publishing of RoutePack. During the full build, it calls the large language model to generate route_summary and query_phrases for each active document, merges lexicon_global and calculates corpus_fingerprint, writes it to the system configuration store, and then notifies the API process to invalidate the cache after the TTL through the publish / subscribe mechanism.
[0024] The knowledge base management module is responsible for document uploading, parsing, chunking, vectorized embedding, and index synchronization (writing to DB, Qdrant, ES), maintaining document status (processing / active / inactive), and triggering RoutePack incremental updates after the status changes to active.
[0025] The question preprocessing module is responsible for: (1) spell correction based on the MacBERT-SC model; (2) determining whether to directly return capability summaries based on the introspective question pattern library; (3) synonym expansion and phrase rewriting based on the large language model, and behavioral clause extraction.
[0026] The custom skill management module receives ZIP format skill packages uploaded by the administrator, verifies the existence, pattern conformity, and path security of the SKILL.md file in the root directory, and decompresses it to the custom skill directory after successful verification. Custom skill packages with the same name will overwrite built-in packages first, and metadata will be written to the skills table in the database.
[0027] This embodiment describes in detail the data structure of the RoutePack and its construction process. The RoutePack is persistently stored in the system configuration store in JSON format. Its top-level data structure includes the following fields: kb_revision (monotonically increasing version number), corpus_fingerprint (SHA256 hash of the content digest of all active documents involved in the construction, which is logically the same as the vector index), documents array (document-level routing corpus for each active document), and lexicon_global (a full vocabulary merged across documents, containing a terms array and a frozen boolean flag).
[0028] Each element in the `documents` array contains: `document_id` (unique identifier for the document), `title` (document title), `route_summary` (a short text summarizing the route, generated by the large language model based on excerpts from the document body), `lexicon_terms` (a list of query phrases generated by the large language model, requiring phrases that closely resemble real user queries rather than pure word frequency statistics), `tags` (document tags), and `source_chunk_ids` (a list of knowledge chunk identifiers corresponding to the document).
[0029] The full build process for RoutePack is as follows: Query all documents with a status of "active" from the knowledge base management module, and obtain the document identifier, title, and excerpt of the main text for each document; for each active document, call the large language model to perform a corpus generation task, input a Prompt containing system instructions, excerpt of the document's main text, and output format constraints into the large language model, requiring the return of structured JSON, including a route_summary field (no more than 300 characters) and a query_phrases array (10 to 30 phrases, simulating possible questioning methods of real users, and prohibiting the use of pure word frequency statistics to extract keywords); if the large language model call fails or the return format does not meet the requirements, the RoutePack is rejected. Collect the query_phrases array of all documents, merge them by term text, and take the maximum weight of the term in each source document as the merged weight value for the same term. At the same time, collect the list of identifiers of all source documents to form the document_ids array; sort the SHA256 hash values of the content summaries of all active documents by document identifier and concatenate them, then calculate the SHA256 hash value of the concatenated result again to obtain corpus_fingerprint; retrieve the kb_revision value in the current storage and increment it by 1, serialize all fields into a JSON format RoutePack data packet and write it to the system configuration storage; notify all API processes that the RoutePack version has been updated through a publish / subscribe mechanism, and each process invalidates its locally cached RoutePack copy after a preset TTL (e.g., 45 seconds), and reloads the latest version from the system configuration storage on the next access.
[0030] This embodiment details the dynamic generation process of the Tier 2 semantic routing corpus for the knowledge base question-answering skill (knowledge_qa). Unlike other skills, the description text and trigger phrases for knowledge_qa are not solely derived from its static SKILL.md file, but are dynamically generated based on the currently released version of RoutePack.
[0031] Step 1: Obtain the current RoutePack. Read the current release's route asset data packet from the system configuration store, and retrieve the documents array and lexicon_global object.
[0032] Step 2: Dynamic Metadata Description Text Generation. Iterate through the metadata elements of each document in the `documents` array of `RoutePack`, obtain the length of the `route_summary` field for each document, and calculate the proportion of each document's `route_summary` length to the total length. Set a preset total character limit (e.g., 2000 characters) and allocate the character quota for the description fragment to each document proportionally.
[0033] For each document, extract the first part of its route_summary field. The text is a series of characters, concatenated in document order. Each section is prefixed with its document title, formatted as `{document title}}{extracted text}`. Fragments}. After all fragments are concatenated, they form the dynamic metadata description text of knowledge_qa.
[0034] Step 3: Dynamically generate the trigger phrase list. Collect the number of terms in the lexicon_terms array of each document and calculate the proportion of terms in each document to the total number (i.e., the proportion of document size). Set a preset total number of trigger phrases (e.g., 50), and allocate the number of trigger phrases contributing to each document proportionally. Extract the trigger phrases from the lexicon_terms array of each document in descending order of weight. The phrases are merged and deduplicated from all documents to form a dynamic trigger phrase list for knowledge_qa.
[0035] Step 4: Corpus Injection and Route Matching. The dynamically generated metadata description text and dynamic trigger phrase list are merged with the static metadata description text and static trigger phrase list of other non-knowledge base question-answering skills in the system, and they participate together in the secondary semantic matching. In the secondary semantic matching, the dynamically generated knowledge_qa corpus is regarded as an independent "virtual skill" and participates in the sentence vector similarity calculation.
[0036] Step 5: Version Synchronization Triggered. After a full build or incremental update of RoutePack, the system automatically triggers the regeneration of the knowledge_qa dynamic corpus. This process is synchronized with the incrementing kb_revision version number, ensuring that the semantic corpus of knowledge_qa participating in Tier 2 matching always reflects the latest released knowledge base content view.
[0037] Technical Performance Verification: After the enterprise knowledge base uploaded the Travel Expense Reimbursement Policy v2.0 document, RoutePack released a new version through incremental updates. The dynamic trigger phrase list of knowledge_qa automatically included user question phrases related to travel expense reimbursement (such as "How do I get reimbursed for business trips?" and "What are the travel allowances?"), without requiring manual modification of any configuration files or trigger word lists. Simultaneously, the dynamic metadata description text automatically included a summary description of the new document's content, enabling the semantic matching model to correctly establish semantic associations between travel-related questions and knowledge base question-answering skills in the vector space.
[0038] This embodiment describes in detail the multi-channel parallel retrieval and weighted inverse ranking fusion (WRRF) process under the knowledge base hybrid retrieval path.
[0039] Step 1: Query Preprocessing. Analyze the question text of the current round (after spell correction and query expansion processing by the preprocessing module) and extract the following text features: (a) Question length (b) Whether it contains proper nouns (based on Named Entity Recognition (NER) results); (c) Whether it is a short question ( Less than the preset short question threshold, such as (d) Whether it contains terms with high keyword density.
[0040] Step 2: Parallel multi-channel retrieval.
[0041] (a) Database Full-Text Keyword Search Channel (Channel 1): After segmenting the Chinese text of the question into words, a PostgreSQL tsquery full-text search query statement is constructed. The full-text search is then performed on the tsvector index column of the knowledge block table, and the results are returned by... The top 20 candidate document fragments, sorted in descending order.
[0042] (b) Vector Search Engine Similarity Search Channel (Channel 2): The text2vec-large-chinese model is called to encode the question text into a 768-dimensional vector. Cosine similarity ANN retrieval is performed in the Qdrant vector database, returning the Top-20 candidate document fragments. If the Qdrant service is unavailable, it falls back to the local embedding_json file for brute-force similarity calculation. (c) Full-Text Search Engine Keyword Search Channel (Channel 3): Constructs Elasticsearch's... The query performs a BM25 keyword search on the document title and block content fields, with the following matching pattern: , returns the Top-20 candidate document fragments. (d) Rule matching retrieval channel (channel 4): maintains a set of predefined regular expression rules and precise keyword matching rule library, performs rule matching on the question text one by one, and adds the corresponding document fragments of the matched rules directly to the candidate set, returning up to 10 candidate document fragments.
[0043] Step 3: Dynamic weight coefficient calculation. Based on the question text features extracted in Step 1, the fusion weight coefficients of the four channels are dynamically calculated. The weighting coefficient is calculated as follows: when proper nouns are included... , Short question ( When characters) , , Long question ( When characters) , When including the system clause number , By default .
[0044] Step 4: Weighted Inverse Sorting and Merging. All candidate document fragments from the four channels are deduplicated and merged (merged by chunk_id, retaining the highest rank in each channel). A WRRF score is calculated for each candidate document fragment. ;in For the first The fusion weighting coefficient of each channel, For candidate segments in the first The ranking position in each channel (starting from 1; if a position does not appear in a channel, its contribution to that channel is 0), and 60 is a smoothing constant. .
[0045] Step 5: Sort and Truncate. Sort all candidate document fragments by... Sort in descending order and extract the top-ranked preset quantities. Five to ten candidate document fragments are selected to form the Top-K Chunks. Optionally, the Top-K candidate fragments can be searched twice or rearranged using a Cross-Encoder / LLM algorithm to further improve the ranking quality.
[0046] Technical effectiveness verification: When users ask the question "IT equipment application process" (short question + proper noun), the keyword search channel and full-text search channel contribute high scores due to their exact match of "IT equipment application," the vector channel also contributes a certain score due to semantic similarity, and the rule channel may contribute additional scores due to matching "process-related" rules. In the Top-K results after the four-channel WRRF fusion, policy document fragments directly related to "IT equipment application" will rank higher, while fragments of "equipment management regulations" that are only semantically similar but have different themes will be suppressed.
[0047] This embodiment describes in detail the mechanism by which generation-side processing and retrieval-side processing are separated when the user's question contains relative time expressions.
[0048] Scenario Description: In an enterprise intelligent assistant, the knowledge base contains two types of documents: one type is policy and process documents (such as employee handbooks and attendance policies), which typically contain a large number of date fields (such as "effective from January 1, 2023" and "annual assessments are conducted every March"), but are not directly related to the specific time point in the user's question; the other type is time-sensitive information documents (such as shuttle bus schedules, cafeteria menus, and meeting arrangements), whose content is directly related to specific time points. When a user asks "Is there a shuttle bus now?", the existing solution parses "now" into a specific timestamp and incorporates it into the search query. This causes the vector search to prioritize the employee handbook in the TopK ranking due to the high frequency of date fields when calculating the similarity between the timestamp-containing query and the employee handbook, while relegating the actual shuttle bus schedule to a lower position.
[0049] The separation processing strategy in this embodiment is as follows: The relative time expression word determination involves performing pattern matching on the current round's question text to detect whether it contains relative time expression words such as "now," "currently," "today," "tomorrow," or "this week." If no pattern is matched, the process proceeds normally.
[0050] The timeliness availability query type determination further assesses whether a question containing relative time expressions belongs to the "timeliness availability query type." The determination criteria are that the question text simultaneously contains availability query words such as "is there," "can / cannot," and "is it possible" without containing a specific date (e.g., "Saturday" or "next Wednesday"). This determination distinguishes between "Is there a bus now?" (a timeliness availability query, applicable to search-side pollution suppression) and "Is there a bus on Saturday?" (a date-specified query, which can be supplemented with date hints to enhance the search).
[0051] The generation side processes the data to construct the time context text, for example, the current system time is 14:30 on Sunday, July 12, 2026, and the time zone is Asia / Shanghai (Beijing time). The user's question uses the current time expression; please understand the user's intent in conjunction with the actual current time. When injecting the large language model to generate the answer, this time context text, along with the top candidate document fragment list, is injected into the Prompt.
[0052] For timeliness and availability inquiries, no specific timestamp suffix is appended to the question text before it is sent to each retrieval channel. The original question text is sent directly to each retrieval channel to suppress irrelevant institutional documents from obtaining artificially high vector similarity scores due to the presence of a large number of date words.
[0053] Technical effectiveness verification: Taking "Is there a shuttle bus now?" as an example, the query text received by each channel on the retrieval side is approximately "Is there a shuttle bus?" (excluding the specific timestamp). The retrieved Top-K candidate fragments will be concentrated in document fragments related to the shuttle bus timetable. The generation side knows that the current time is Sunday 14:30. The large language model can combine the retrieved shuttle bus timetable fragments and the current time information to accurately answer "Is there a shuttle bus running now?".
[0054] This embodiment describes in detail the complete process of triggering incremental updates of routing assets when documents in the knowledge base change.
[0055] Triggering conditions: The incremental update process of routing assets is triggered by any of the following events: (a) a new document is uploaded and parsed, and the document status changes from processing to active; (b) an existing document is modified (e.g., the document file is replaced), and the status changes to active after re-parsing; (c) an existing document is deleted (the status changes to inactive or it is physically deleted from the knowledge base).
[0056] Process steps: Get the number of documents involved in this change operation. (Number of new documents + number of modified documents + number of deleted documents), read the preset incremental update threshold from the system configuration. (like ).
[0057] Incremental update judgment and execution.
[0058] Case A ( (Incremental Update): Obtain the `documents` array from the current release version of RoutePack as the base set; for newly added or modified documents, re-invoke the large language model to generate `route_summary` and `query_phrases` for each changed document (the process is the same as step 2 in Example 2), and overwrite or append the newly generated document-level routing corpus to the `documents` array; for deleted documents, remove the corresponding document-level routing corpus elements from the `documents` array; keep the document-level routing corpus of all unchanged documents unchanged, and only regenerate the corresponding parts of the changed documents; based on the updated `documents` array, re-execute the cross-document full vocabulary merge calculation (skip vocabulary recalculation unless `lexicon_global.frozen=true`), and recalculate the corpus fingerprint identifier; obtain the current `kb_revision` value and increment it by 1.
[0059] Case B ( Full rebuild): When the number of changed documents exceeds the incremental update threshold, a full RoutePack build process is executed to ensure that the overall quality of the routing assets does not degrade due to the accumulation of multiple incremental updates.
[0060] Serialization and storage. The updated kb_revision, corpus_fingerprint, documents array, and lexicon_global object are serialized into a new version of the RoutePack data packet, written to the system configuration store, and replace the old current version.
[0061] Cache invalidation and version alignment. After a successful RoutePack write, all API processes are notified via a publish / subscribe mechanism or message queue. Upon receiving the version update notification, each API process does not immediately invalidate its cache. Instead, it marks the current cache as "expired" after a preset TTL (e.g., 45 seconds), and reloads it from the system configuration storage on the next read. This delayed invalidation mechanism avoids the "thundering herd effect" caused by multiple processes loading simultaneously. Simultaneously, the knowledge base management module performs knowledge base index updates (DB+Qdrant+ES) to align the new version of kb_revision with the new version of corpus_fingerprint, ensuring that the routing semantics and retrieval index of the online system point to the same version of the knowledge view.
[0062] Version alignment verification mechanism. During system operation, version alignment verification can be performed periodically or before each request processing: comparing the corpus_fingerprint in the current RoutePack with the real-time fingerprints of the content of each active document in the knowledge base management module. If the two are inconsistent and exceed the preset tolerance window, an alarm is triggered and a full RoutePack rebuild is automatically initiated to ensure that the system can still recover to a consistent state in abnormal situations.
[0063] This embodiment describes in detail the registration process for custom skills and the method for isolating script execution.
[0064] Skills registration process: The system receives custom skill package ZIP files uploaded by the administrator that conform to preset package specifications (such as the agentskills.io specification). The system performs directory structure integrity checks (checking if a SKILL.md metadata file exists in the root directory of the ZIP package), path security checks (traversing all file entries within the ZIP package and checking if each file path contains a ".. / " parent directory traversal sequence or an absolute path prefix; if so, the package is rejected and a security error is returned), and schema compliance checks (performing schema validation on the SKILL.md file content to ensure that required fields exist and are of the correct type).
[0065] After successful verification, the ZIP package is extracted to a custom skills directory (e.g., . / skills / custom / {skill_name} / ), where skill_name is taken from the name field in SKILL.md. If a skill package with the same name already exists in the target directory, the administrator is prompted to confirm whether to overwrite it. Custom packages overwriting built-in packages requires administrator confirmation. The skill's metadata information is written to the skills table in the database. This table must contain at least the following fields: skill_id, name, display_name, skill_type (values include transaction, query, knowledge, script, etc.), enabled, version, directory_path, and is_custom_override.
[0066] After a skill is successfully registered, the skill management and routing corpus construction module is triggered to reconstruct the skill routing corpus set, and the routing corpus of the newly added skill is included in the subsequent first-level and second-level routing matching.
[0067] Isolation script execution flow: Check if a predefined executable script file exists in the skill directory of the target skill. The default naming convention for script files is scripts / run.py.
[0068] If an executable script file exists, create an isolated temporary working directory for this execution (e.g., / tmp / skill_exec / {skill_name}_{timestamp}_{random} / ), and copy or symbolically link the script file and required resource files from the skill directory to the temporary working directory.
[0069] Construct the current round's question text, conversation context information (including dialogue history and pending_skill status), and user identity information into standard input data in JSON format.
[0070] When running script files in an isolated execution environment, impose the following constraints: execution timeout limit (e.g., timeout=30 seconds, forcibly terminating the process upon timeout); output length limit (e.g., ... Network access control: If network access is not authorized in allowed_tools, block all outbound network connections through operating system-level network isolation mechanisms; memory limits (e.g.) File system access restrictions apply; scripts can only read and write files in the temporary working directory, and access to sensitive system paths is prohibited. These constraints can be implemented using containerization technology or operating system-level process isolation mechanisms.
[0071] Read the JSON-formatted structured dialogue response data returned by the script from the standard output, including content (response body text), message_type (message type), and optional payload (additional data payload), parse it, render it to the user interface, clean up the temporary working directory and its contents, and release the system resources occupied by the isolated execution environment.
[0072] Example scenario: Meeting room booking skill: The administrator uploads the "Meeting room booking (meeting-booking)" skill package. The SKILL.md file of this package declares the type as "transaction," and the trigger condition section includes phrases such as "book a meeting room," "reserve a meeting room," and "book a meeting room for me." When a user enters "book a meeting room for me," the system matches the "meeting-booking" skill through first-level and second-level routing, and runs run.py in the isolated environment. run.py receives the user's question and conversation context through standard input, finds that slots are missing "date," "time slot," and "number of participants," and returns follow-up text (e.g., "Which date and time slot do you need to book for the meeting room?") through standard output. In the next round, the user enters "tomorrow afternoon 3 pm." Because the pending_skill status prioritizes the "meeting-booking" skill, run.py runs again, collects slots, and continues to ask follow-up questions. When all slots are filled, run.py calls the meeting room management system via API to complete the booking and returns "You have successfully booked meeting room A301 for tomorrow afternoon 3 pm."
[0073] This embodiment uses a specific multi-turn dialogue scenario as an example to fully describe all the steps and processes of the dialogue routing method of the present invention.
[0074] Scenario Setting: A company has deployed the system of this invention, enabling four skills: meeting-booking (meeting room reservation, transactional), visitor-invitation (visitor invitation, transactional), attendance-query (attendance query, query-based), and knowledge_qa (knowledge base Q&A, knowledge-based). Documents such as employee handbooks, IT equipment management regulations, attendance policies, and travel reimbursement policies have been uploaded to the knowledge base, and RoutePack version v3 has been released.
[0075] In the first round of conversation, the user typed "Book me a meeting room".
[0076] Preprocessing: spelling correction, not self-reflection.
[0077] Level 1 trigger word matching: The word segmentation ["help", "me", "book", "each", "meeting room"] is intersected with the trigger phrases of each skill. The trigger phrase of meeting-booking contains "book meeting room" and "book meeting room", and "book" and "meeting room" are matched. The intersection is not empty. visitor-invitation, attendance-query, and knowledge_qa are not matched. The first-level matching result meeting-booking has the highest score.
[0078] Second-level semantic matching: The cosine similarity of sentence vectors between the metadata description text of meeting-booking and the user's question was calculated, resulting in a confidence score of 0.92. The candidate skill was determined to be meeting-booking.
[0079] Session status check: if pending_skill_id is empty (new session), no continuation chat logic is triggered; skill routing decision: if the candidate skill meeting-booking is not knowledge_qa, skip RoutePack pre-gating.
[0080] Skill execution: The `scripts / run.py` file of `meeting-booking` runs in an isolated environment. Upon detecting that `slots` is empty, it prompts the user with the question, "Which date and time slot of the meeting room do you wish to book?" and returns the result via standard output. Simultaneously, the session state management module sets `pending_skill_id` to "meeting-booking", and initializes the `slots` mapping to an empty table. The user interface displays the prompt text.
[0081] In the second round of conversation, the user entered "Tomorrow afternoon from 3 pm to 5 pm, about 10 people".
[0082] Preprocessing: Spelling correction is not required; this is not a self-reflection-based skill assessment.
[0083] Session state priority judgment: if pending_skill_id="meeting-booking" and has not timed out, directly continue the current round's question text into the slot filling logic of the meeting-booking skill, skipping all subsequent routing steps (no more skill routing matching, no more RoutePack pre-gating).
[0084] Slot filling: The `run.py` function of `meeting-booking` runs in an isolated environment (second run), receiving updated questions and existing session context (slots are empty) via standard input. `run.py` parses the slot information from the questions: Date = Tomorrow (July 13, 2026), Time slot = 15:00-17:00, Number of participants = 10. `slots` is updated. `run.py` determines that the number of participants does not exceed 10, recommends a medium-sized meeting room, and asks, "A301 (accommodates 12 people) and B205 (accommodates 15 people) are available. Which one do you prefer?" The session management module updates `slots`, and `pending_skill` remains on `meeting-booking`.
[0085] In the third round of dialogue, the user typed "A301 Bar".
[0086] The system continues the chat using the pending_skill method. run.py receives final confirmation and completes the reservation. It returns the message: "You have successfully reserved meeting room A301 for July 13, 2026, from 15:00 to 17:00, with a capacity of 10 people." The session management module clears the pending_skill_id.
[0087] In the fourth round of dialogue (a new topic, knowledge Q&A), the user entered "How do I report a problem when my IT equipment breaks down?"
[0088] Preprocessing: Spell correction is not required, as it is not a self-reflection-based function; Query expansion: "broken" → "fault" + "repair", extract "repair" as an additional search condition from the behavioral clause.
[0089] Route matching: Level 1 trigger word matching did not match any transactional skills, but knowledge_qa was matched because its dynamic trigger phrases contain "IT equipment" and "repair process". Level 2 semantic matching: The dynamic metadata description text of knowledge_qa (dynamically generated by RoutePackv3, containing a summary fragment of IT equipment management procedures) and the question sentence have a cosine similarity score of 0.81. The candidate skill is knowledge_qa.
[0090] Session status check: if pending_skill_id is empty, the chat will not be resumed.
[0091] RoutePack pre-gating: Load RoutePackv3 and perform substring matching on terms such as "IT equipment" and "repair report" in the full vocabulary: Matched terms "IT equipment" (weight 0.9), "equipment repair report" (weight 0.85), and "fault repair report" (weight 0.7). Vocabulary hit score = 0.9 + 0.85 + 0.7 = 2.45. Document-level hit score: The question "How to report a broken IT device?" scores 0.5 with the document title "IT Equipment Management System" and 0.4 with the route summary fragment, totaling 0.9. Pre-gating comprehensive score = 2.45 + 0.9 = 3.35, exceeding the threshold of 0.38, thus determining entry into the knowledge base mixed search path.
[0092] Hybrid retrieval: Four-channel parallel retrieval + WRRF fusion sorting, the Top-5 results include the relevant blocks of "equipment failure reporting and repair process" in the IT equipment management system.
[0093] Generation: The large language model generates the answer "The equipment failure reporting process is as follows: 1. Log in to the IT service platform; 2. Select 'Equipment Failure Reporting'; 3. Fill in the failure description; 4. Submit the application. The IT department will respond within 2 hours." based on the Top-5 fragments and time context. The natural language answer is output to the user interface. Simultaneously, routing debugging information (route_debug) is recorded, including audit fields such as route_pack_score=3.35 and kb_revision=v3.
[0094] This complete dialogue process demonstrates how the present invention ensures uninterrupted multi-round slot filling during the continuous switching between "meeting room reservation (transactional multi-round slot filling) → knowledge Q&A (knowledge-based RAG)," and how RoutePack pre-gating ensures that knowledge Q&A is correctly identified and accurately retrieved, reflecting the complete technical solution of collaborative work among various modules.
[0095] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A dialogue routing method for an enterprise intelligent assistant based on scalable skills and routing assets, characterized in that, The method includes: Based on the user's input of the current round's question text, firstly, trigger word matching is performed in the skill routing corpus by word segmentation and intersection method, and then secondly, semantic matching is performed by sentence vector similarity method to obtain candidate skills and their matching confidence scores. Based on whether there is an unfinished transactional skill session identifier in the session context that is in a suspended state, if the suspended state exists, the current round question will be directly connected to the slot filling logic of the transactional skill in the suspended state, interrupting subsequent routing steps. If the suspended state does not exist and the candidate skill is a knowledge base question answering skill, then the substring hit weight score of the current round question is calculated based on the full vocabulary merged across documents in the current release version of the routing asset, and the hits of the title field and route summary field of each document in the routing asset are added together to obtain the pre-gated comprehensive score. Based on the comparison between the pre-gated comprehensive score and the pre-configured pre-gated threshold, if the pre-gated comprehensive score reaches the pre-gated threshold, the routing decision will be determined as entering the knowledge base hybrid retrieval path; Based on the decision of entering the knowledge base hybrid retrieval path, candidate document fragments are obtained in parallel for the current round of questions through the database full-text keyword retrieval channel, the vector retrieval engine similarity retrieval channel, the full-text retrieval engine keyword retrieval channel and the rule matching retrieval channel. The candidate sets returned by each channel are then weighted and sorted inversely to obtain the top candidate document fragment list after fusion and sorting. Based on the list of candidate document fragments at the top, a large language model is injected to generate context, resulting in a natural language response text which is then output to the user interface.
2. The method according to claim 1, characterized in that, The process of building routing assets includes: Based on the excerpts of the main text of each active document in the knowledge base management module, the large language model is called to generate short routing summary texts and query phrase lists for each document, thus obtaining document-level routing corpus; Based on the list of query phrases in the document-level routing corpus of all active documents, cross-document merging is performed by term, and the maximum weight value and source document identifier list of the same term are retained in each source document to obtain a full cross-document vocabulary. The corpus fingerprint is calculated based on the hash value of the document content summary of all active documents; Based on the cross-document full vocabulary and the corpus fingerprint identifier, the data is serialized together with the monotonically increasing version number field into a routing asset data packet, which is then stored in the system configuration storage as the routing asset of the current release version.
3. The method according to claim 1, characterized in that, The calculation method for the pre-gated comprehensive score includes: In the full vocabulary of the routing assets, the current round question is matched word by word and the weight values corresponding to each matched word are accumulated to obtain the vocabulary hit score. In the document array of the routing assets, string matching is performed between the current round question and the title field of each document, and fragment matching is performed between the current round question and the routing summary field of each document. The title hit score and the summary fragment hit score are added together to obtain the document-level hit score. The pre-gated composite score is obtained by summing the vocabulary hit score and the document-level hit score.
4. The method according to claim 1, characterized in that, The weighted reciprocal sorting fusion process includes: Based on the text features of the current round of questions, dynamically adjust the fusion weight coefficients of the keyword retrieval channel, the vector retrieval channel, the full-text retrieval channel, and the rule retrieval channel; For each candidate document fragment returned by each channel, the reciprocal of its ranking position in its respective channel is multiplied by the corresponding channel's fusion weight coefficient to obtain the weighted reciprocal ranking fusion score of each candidate document fragment; Based on the weighted inverse sorting fusion score, candidates are sorted from high to low, and a predetermined number of candidate document fragments with the highest rankings are extracted to form the top candidate document fragment list.
5. The method according to claim 4, characterized in that, When the current round of questions contains relative time expressions, the generation-side processing and retrieval-side processing are separated: Based on the system's configured time zone parameters and the current system time, a large language model time context text containing date and time descriptions is constructed. In the step of injecting the large language model to generate context, the time context text is injected together with the top candidate document fragment list to obtain generation-side time context enhancement. In the step of parallel acquisition of candidate document fragments, if it is determined that the current round of questions belongs to the timeliness availability query type, then no specific timestamp suffix is added to the current round of questions, and the original question text is directly sent to each retrieval channel to suppress long documents containing a large number of date words but weakly related to the question topic from entering the candidate set, thereby achieving time pollution suppression on the retrieval side.
6. The method according to claim 5, characterized in that, When documents in the knowledge base are added, modified, or deleted, an incremental update of the routing assets is triggered, including: Based on the comparison between the number of documents involved in the change operation and the preset incremental update threshold, if the number of changed documents does not exceed the incremental update threshold, then only the changed documents are re-invoked by the large language model to generate document-level routing corpus, while the document-level routing corpus of the unchanged documents remains unchanged, thus obtaining the document-level routing corpus set after incremental update. Based on the incrementally updated document-level routing corpus set, the cross-document full vocabulary and corpus fingerprint identifier are recalculated and the version number field is incremented to obtain the new version of the routing asset data packet. Based on the new version of the routing asset data package, update the system configuration storage and invalidate the in-process cached copy of the routing assets after a preset lifespan, thus completing the version alignment of the routing assets with the knowledge base document index.
7. The method according to claim 6, characterized in that, For the knowledge base question-answering skills, the metadata description text and trigger phrase list participating in the secondary semantic matching are not uniquely determined by the static skill package file, but are dynamically generated based on the routing assets of the current release version: Based on the length ratio of the route summary field of each active document in the route asset, the character quota of the description fragment of each document is allocated according to the preset total character limit. The allocated number of characters in the route summary field of each document is extracted and concatenated to form the dynamic metadata description text of the knowledge base question and answer skills. Based on the document size ratio of each active document in the routing assets, the number of trigger phrases contributed by each document is allocated according to the preset total number of trigger phrases. Phrases with the aforementioned allocated number are extracted from the query phrase list of each document and merged to form the dynamic trigger phrase list of the knowledge base question and answer skills. Based on the dynamic metadata description text and the dynamic trigger phrase list, the dynamic metadata description text and the dynamic trigger phrase list, together with the static metadata and static trigger phrases of other non-knowledge base question answering skills, participate in the secondary semantic matching, so that the semantic routing corpus of the knowledge base question answering skills and the routing asset version are automatically synchronized after the knowledge base is expanded.
8. The method according to claim 7, characterized in that, Before the first-level trigger word matching and the second-level semantic matching, a question preprocessing step is also included: The original question text input by the user is subjected to spell correction processing to obtain the corrected question text, and the corrected question text is used to replace the original question text in subsequent routing steps; Determine whether the corrected question text is a capability self-reflection type question. If it is, directly return the capability summary text of all currently enabled skills and terminate all subsequent routing steps. Before the step of parallel acquisition of candidate document fragments, the current round of questions is subjected to query expansion processing, including thesis expansion based on a thesaurus and phrase rewriting based on a large language model. Behavioral clauses are identified and extracted according to the question type. The expanded question text and behavioral clauses are sent to each retrieval channel as additional retrieval conditions.
9. The method according to claim 8, characterized in that, It also includes custom skill registration and isolation script execution methods: Receive custom skill pack files uploaded by the administrator, verify the integrity of the directory structure and the security of the path of the custom skill pack files, and decompress them to the custom skill directory after the verification is successful; During system operation, the built-in skill catalog and custom skill catalog are scanned, metadata description files and text files in each skill package are read, a list of skill trigger condition phrases is extracted, and the metadata of each skill is stored in the database. The database maintains at least the skill name, activation status, version number and directory path fields. Once the routing decision determines that a target skill has been hit, it is determined whether a predefined executable script file exists in the skill directory of the target skill. If the executable script file exists, the executable script file is run in the isolated execution environment, taking the current round question text and the session context as input, exchanging data with the executable script file through the standard input / output interface, and imposing execution timeout limits, output length limits and network access control constraints in the isolated execution environment. The structured dialogue response data returned by the executable script file is received and output to the user interface. If the executable script file does not exist, the target skill type identifier will be used to route to the corresponding preset logic processing path.
10. An enterprise intelligent assistant system based on scalable skills and routing assets, the system being used to perform the method as described in any one of claims 1 to 9, characterized in that, include: The skill management and routing corpus construction module is used to construct a skill routing corpus set based on the metadata description text, trigger phrase list and skill type identifier of each enabled skill package obtained by scanning the built-in skill directory and custom skill directory during system runtime. The skill routing matching module is used to perform first-level trigger word matching in the skill routing corpus by first finding the intersection of word segments, and then performing second-level semantic matching by sentence vector similarity, based on the current round question text input by the user, to obtain candidate skills and their matching confidence scores. The session state management module is used to determine the current routing priority based on whether there is an incomplete transactional skill session identifier in the session context that is in a suspended state. If the suspended state exists, the current round question is directly connected to the slot filling logic of the transactional skill in the suspended state, interrupting subsequent routing steps.
