Intelligent questioning method, system and computer readable storage medium

CN122885049APending Publication Date: 2026-10-09JACK SEWING MASCH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611139005.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-29
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0004]但是,相关技术在多租户场景下突出的跨租户数据越权风险

Benefits of technology

[0020]本申请提供一种计算机可读存储介质,其上存储有程序,该程序被处理器执行时,实现如上任一项所述的方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122885049A_ABST
    Figure CN122885049A_ABST
Patent Text Reader

Abstract

The application provides an intelligent query method, system and computer readable storage medium. The intelligent query method comprises the following steps: according to a first tenant label carried by a first natural language query initiated by a first tenant, searching for business knowledge bound to each tenant label in a vector knowledge base, and determining whether the business knowledge bound to the first tenant label matches, to obtain a search result; performing label filtering on the search result to obtain filtered current business knowledge; outputting the current business knowledge to a large language model and prohibiting output of any business knowledge of other tenants, so that the large language model generates a query result according to the current business knowledge and returns the query result to the first tenant.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent data processing technology, and in particular to an intelligent data query method, system, and computer-readable storage medium. Background Technology

[0002] In industrial applications based on Software as a Service (SaaS) architecture, Natural Language to Structured Query Language (NL2SQL) technology, which is based on a Large Language Model (LLM), is often used to implement intelligent query functions.

[0003] The relevant intelligent query solution allows business personnel to directly ask questions in everyday natural language. A large language model then automatically generates and converts SQL query statements based on the user's input. Finally, the SQL query results are used to retrieve various business data stored in the MES system for industrial production scenarios.

[0004] However, the relevant technologies pose a significant risk of cross-tenant data access violations in multi-tenant scenarios. Summary of the Invention

[0005] This application provides an improved intelligent questioning method, system, and computer-readable storage medium.

[0006] This application provides an intelligent questioning method, including: Based on the first tenant tag carried by the first tenant's natural language first question, retrieve the business knowledge pre-bound to each tenant tag in the vector knowledge base, and determine whether there is a match with the business knowledge bound to the first tenant tag to obtain the retrieval result. The search results are then tagged to obtain the filtered current business knowledge. The current business knowledge is output to the large language model, and the output of any business knowledge of other tenants is prohibited, so that the large language model can generate query results based on the current business knowledge and return them to the first tenant.

[0007] Furthermore, the search results include business knowledge in the search vector knowledge base that matches the first tenant tag; The step of tag-filtering the search results to obtain filtered current business knowledge includes: Tag filtering is performed on the search results containing business knowledge that matches the first tenant's tag to obtain the filtered current business knowledge.

[0008] Furthermore, the business knowledge pre-bound to each tenant tag in the vector knowledge base includes: Obtain a vector knowledge base for storing business knowledge of all tenants; the vector knowledge base is shared by all tenants; the vector knowledge base includes a tenant field for storing tenant tags for each tenant; Based on the received request for business knowledge synchronization initiated by the second tenant, obtain the tenant field of the second tenant; Based on the request, the business knowledge of the second tenant to be added to the database is processed and then stored in the vector knowledge base. After the vector knowledge base is stored, the tag mounting interface is called to bind the second tenant tag to the business knowledge stored in the vector knowledge base to perform tag mounting.

[0009] Furthermore, the step of processing the second tenant's business knowledge to be added to the database based on the request and then storing it in the vector knowledge base includes: In response to the request, the business knowledge to be imported into the database of the second tenant is processed by structured slicing and text formatting to obtain plain text business knowledge that can be imported into the database. The plain text business knowledge is stored in the vector knowledge base; After the data is stored in the vector knowledge base, the tag mounting interface is called to bind the second tenant tag to the business knowledge stored in the vector knowledge base, including: After the vector knowledge base is stored, the tag mounting interface is called to bind the second tenant tag to the plain text business knowledge stored in this time.

[0010] Furthermore, in response to the request, the business knowledge to be imported by the second tenant is subjected to structured slicing and text formatting to obtain plain text business knowledge, including: In response to the request, the business knowledge to be imported by the second tenant is sliced ​​according to the hierarchical nodes of the original structured data, while retaining the original parent-child node indentation relationship of the business knowledge to be imported, to obtain the sliced ​​data. The sliced ​​data is converted to plain text format to generate plain text business knowledge.

[0011] Furthermore, when processing the second tenant's business knowledge to be added to the database based on the request and storing it in the vector knowledge base, the method further includes: Generate a temporary batch identifier for all business data entering the warehouse this time; Based on the request, the batch identifier and the second tenant label are temporarily associated and bound together; After the vector knowledge base is stored, the tag mounting interface is called to bind the second tenant tag to the plain text business knowledge stored in this time, including: After the vector knowledge base is stored in the vector knowledge base, the tag mounting interface is called to extract the second tenant tag from the request; Based on the batch identifier temporarily associated with the second tenant label, all business data entered into the database for this time by the second tenant label are bound to the second tenant label.

[0012] Furthermore, the method also includes: When a new request for business knowledge synchronization from a third tenant is received, the global task control lock is used to search for existing tasks of the same tenant in the same directory level of the vector knowledge base that are currently in execution. If it does not exist, then based on the new request, execute a new task to synchronize business knowledge; If it exists, mark the existing task as cancelled, perform a soft interrupt on the existing task, release the resources occupied by the existing task, and then exit the existing task; and, Based on the new request, execute a new task to synchronize business knowledge.

[0013] Furthermore, the method also includes: When generating table-level query logic in the large language model, the tenant ID of the current execution environment is used as the basic filtering condition; The underlying query engine intercepts and verifies the basic filtering conditions; If the basic filtering conditions for matching are missing, the query will be rejected. If the basic filtering conditions are matched, the query will be executed.

[0014] Furthermore, the method also includes: When the fourth tenant initiates the second question of the natural language query, the large language model parses the query semantics and entity recognition to obtain the initial query logic generated by the fourth tenant's tenant ID, and iterates to extract the entity types contained in the initial query logic; Based on the entity type, the initial query logic is modified to obtain the final query logic; the time portion of the final query logic retains the conversion processing of the original time portion when the large language model generated the query logic; The final query logic is sent to the underlying query engine so that the underlying query engine calls the industrial production database to perform data query, obtains the query results, and returns the query results to the fourth tenant.

[0015] Furthermore, the step of modifying the initial query logic according to the entity type to obtain the final query logic includes: The entity types in the query logic are identified to obtain the entity types; If the entity type is an organizational structure entity, call the whitelist comparison interface; match the entity content of the organizational structure entity with the whitelist exclusive to the fourth tenant; if the match is successful, retain the entity content of the organizational structure entity and write it into the query logic; If the entity type is a global collection type entity, skip the whitelist matching; convert the entity content of the global collection type entity into a traversal execution instruction that conforms to the execution specification and write it into the query logic; If the entity type is a business serial number type entity, retain the original content of the serial number in the second question and write the original content into the query logic; The query logic is then integrated to obtain the final query logic.

[0016] Furthermore, the underlying query engine calls the industrial production database to perform data queries, including: When the underlying query engine executes the data query, the start and end dates of the query required by the fourth tenant are determined based on the current system time of the execution time. Based on the stated start and end dates, the industrial production database is invoked to perform a data query, and the query results are obtained.

[0017] Furthermore, the method also includes: The query results are processed to extract parameters, which include the verified tenant ID, the verified entity, and the start and end dates for the query to be performed by the fourth tenant. The verified tenant ID, the verified entity, and the start and end dates are encapsulated into a visual structure to obtain the encapsulation parameters. The encapsulated parameters are concatenated to the front-end basic route address of the business details page to generate and display a page jump link with complete query parameters; the page jump link is used to jump to the business details page corresponding to the industrial production business data in the query results when operated by the tenant.

[0018] Furthermore, the search results include business knowledge in the search vector knowledge base that does not match the first tenant's tag binding; the method also includes: directly returning notification information; the notification information is used to inform the first tenant that business knowledge has not been synchronized, terminate the current search process, and prohibit the output of any business knowledge of other tenants; or, The search results include business knowledge in the search vector knowledge base that does not match the first tenant's tag binding; the method also includes: automatically triggering a knowledge synchronization guidance prompt; the prompt is used to remind the first tenant that the business knowledge has not been synchronized, and to upload the required business knowledge and bind it to the first tenant's tag, and after the first tenant's tag binding is completed, to re-initiate the first question.

[0019] This application provides an electronic device including one or more processors for implementing the method described in any of the preceding claims.

[0020] This application provides a computer-readable storage medium having a program stored thereon that, when executed by a processor, implements the method described in any of the preceding claims.

[0021] This application provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the method described in any of the preceding claims.

[0022] In some embodiments, the intelligent query method of this application pre-binds tenant tags to the business knowledge of each tenant in the vector knowledge base. Each retrieval performs secondary tenant tag verification and filtering after obtaining the retrieval results, providing only the business knowledge that fully matches the tenant tags of the request initiator to the large language model. This cuts off the possibility of the large language model obtaining business knowledge from non-current tenants at the source, avoiding omissions in filtering conditions due to randomness when relying solely on the large language model to autonomously generate tenant filtering conditions. It also resists attacks that maliciously construct queries to induce bypassing of access rules, completely eliminating the risk of cross-tenant data escalation and leakage in multi-tenant scenarios, and ensuring the security of sensitive industrial production data for each tenant. Attached Figure Description

[0023] Figure 1 The diagram shown is a flowchart illustrating the intelligent question-answering method provided in an embodiment of this application. Figure 2 As shown Figure 1 The flowchart shown is a process for synchronizing business knowledge in the intelligent data query method. Figure 3 As shown Figure 1 The flowchart of the query process in the intelligent query method is shown below; Figure 4 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this application. Detailed Implementation

[0024] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0025] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.

[0026] The technical solutions of these different concepts will be introduced in turn below. Some terms and concepts may appear in multiple technical solutions of different concepts. These terms and concepts will be explained when they first appear in this article and will not be repeated thereafter.

[0027] The first tenant in this article refers to the tenant of a multi-tenant system that initiates a natural language question and requests the corresponding industrial production business data query results. The first tenant tag is a unique identifier used to distinguish the identities of different tenants, ensuring that every search and permission verification can accurately match the question initiator and avoid problems such as tenant identity confusion and tag matching errors.

[0028] The second tenant in this article refers to a multi-tenant system tenant that actively initiates a business knowledge synchronization request, hoping to store its own industrial production-related business knowledge into the shared vector knowledge base. The second tenant tag in this article corresponds to its own unique identity identifier, which is used to bind the business knowledge stored in the knowledge base to the identity in order to achieve permission filtering in the subsequent query stage.

[0029] In this paper, the third tenant refers to a multi-tenant system tenant that initiates a new business knowledge synchronization request. This request typically occurs when an existing synchronization task at the same level is incomplete and needs to be re-initiated. The fourth tenant refers to a multi-tenant system tenant that, after completing business knowledge synchronization, initiates a natural language query request to retrieve business data. This is a different implementation within the same scenario as the first tenant.

[0030] The "first" in the first tenant, the "second" in the second tenant, the "third" in the third tenant, and the "fourth" in the fourth tenant all refer to the same tenant or different tenants, and are not limited here.

[0031] It should be noted that the shared vector knowledge base used in this application embodiment can store the business knowledge of all tenants. Compared with the solution of allocating independent vector knowledge base storage space for each tenant, it can effectively reduce the redundancy and waste of storage space, improve the utilization rate of shared storage resources, and reduce the overall storage operation and maintenance cost in multi-tenant scenarios. With the tenant tag binding and secondary verification filtering mechanism, it can ensure both storage utilization efficiency and the access security of tenant data.

[0032] The first question refers to the natural language question raised by the first tenant to query specific industrial production business data.

[0033] The second question is used to represent a natural language question raised by the fourth tenant to query specific industrial production business data. It is a different embodiment of the first question in the same application scenario. The two questions have the same technical meaning and only correspond to the identity of the request initiator in different embodiments.

[0034] In related technologies, relying solely on large language models to autonomously generate tenant filtering conditions through prompt words is problematic because large language models themselves have a randomness in generation. In complex scenarios involving queries across multiple tables, tenant filtering conditions can easily be missed due to logical oversights, or the rules can be bypassed by deliberately constructed first questions, ultimately generating query statements that can obtain data from other tenants, leading to the leakage of sensitive production data of tenants.

[0035] Thus, the relevant technologies pose a significant risk of cross-tenant data access violations in multi-tenant scenarios.

[0036] To address the prominent issue of cross-tenant data access privilege escalation risks in multi-tenant scenarios, this application provides an intelligent query method. In this method, each tenant's business knowledge in the vector knowledge base is pre-bound with tenant tags. Each retrieval performs secondary tenant tag verification and filtering after obtaining the search results, providing only business knowledge that perfectly matches the tenant tags of the request initiator to the large language model. This effectively prevents the large language model from acquiring business knowledge from non-current tenants, avoiding omissions in filtering conditions due to randomness when relying solely on the large language model to generate tenant filtering conditions. It also resists attacks that maliciously construct queries to bypass access rules, completely eliminating the risk of cross-tenant data access privilege escalation and leakage in multi-tenant scenarios, and ensuring the security of sensitive industrial production data for each tenant.

[0037] Figure 1 The diagram shown is a flowchart of the intelligent questioning method provided in an embodiment of this application.

[0038] like Figure 1 As shown, this intelligent questioning method may include, but is not limited to, the following steps 110 to 130: Step 110: Based on the first tenant tag carried in the first natural language question initiated by the first tenant, retrieve the business knowledge pre-bound to each tenant tag in the vector knowledge base, and determine whether there is a match with the business knowledge bound to the first tenant tag to obtain the retrieval result.

[0039] The large language model presented in this paper represents a generative AI model based on the Transformer architecture and pre-trained on a large-scale general corpus. This model can perform semantic understanding and logical reasoning on natural language questions, automatically generate corresponding structured query statements, and can correct and optimize the generated query logic based on the input business knowledge to ensure that the generated query statements comply with the business data specifications of the corresponding tenant.

[0040] It should be noted that all business knowledge stored in the vector knowledge base includes, but is not limited to, metadata, as well as business scenario examples, historical query rules, and other knowledge content that can assist the large language model in generating accurate query logic. Metadata includes, but is not limited to, basic reference knowledge describing business data structures and entity relationships. When the above-mentioned types of business knowledge are stored in the vector knowledge base, they all need to be bound to corresponding tenant tags.

[0041] Metadata refers to data that describes the structure, type, and entity relationships of business data in an industrial production database. It is the basic reference knowledge that enables large language models to convert natural language queries into structured query logic. In this application, the metadata of each tenant will be bound to the corresponding tenant tag in advance.

[0042] After identifying all metadata entries that need to be mounted under a tenant, all metadata can be stored in a vector knowledge base. Then, for all metadata entries of that tenant, the tag mounting interface can be called uniformly to complete the binding operation of all metadata of that tenant with the corresponding tenant tags in one go, thus completing the independent metadata mounting process. After binding, when the tenant subsequently initiates a smart query request to retrieve business knowledge, the metadata that is only available to that tenant can be accurately filtered based on the bound tenant tags, thus achieving permission isolation from the source.

[0043] To address this, the vector knowledge base pre-stores the business knowledge uploaded and synchronized by different tenants, and each piece of business knowledge is bound to the corresponding tenant tag to ensure that the business knowledge corresponds one-to-one with the tenant identity.

[0044] Step 120: Filter the search results by tags to obtain the filtered current business knowledge.

[0045] Step 130: Output the current business knowledge to the large language model and prohibit the output of any business knowledge of other tenants, so that the large language model can generate query results based on the current business knowledge and return them to the first tenant.

[0046] In multi-tenant environments, intelligent query solutions using large language models exhibit uncontrollable characteristics when generating complex relational query logic. If data filtering relies solely on prompts, the model may overlook tenant authentication conditions, leading to unauthorized data access. Therefore, intelligent query solutions using these technologies face the risk of cross-tenant data access violations.

[0047] Compared to related technologies, intelligent query solutions have the technical problem of cross-tenant data access violations. In this embodiment, by pre-binding tenant tags and then filtering tags after retrieval, only the business knowledge that the current tenant is authorized to access is input into the large language model. This achieves permission isolation of tenant data from the source, eliminating the need for the large language model to autonomously generate tenant filtering conditions. Therefore, it fundamentally eliminates the risk of unauthorized access caused by the randomness of the results generated by the large language model. Even when faced with maliciously constructed leading questions, the large language model cannot obtain business knowledge that is not currently held by the tenant and will not generate query statements that would allow unauthorized access to other tenants' data, thus ensuring the security of sensitive production data for each tenant.

[0048] Combination Figure 1 As shown, the retrieval results include business knowledge in the retrieval vector knowledge base that matches the first tenant tag binding; correspondingly, step 120 above may include, but is not limited to, the following step 121: performing tag filtering on the retrieval results containing business knowledge that matches the first tenant tag binding to obtain the filtered current business knowledge. Thus, the current business knowledge is retained and output to the large language model, while any business knowledge with other tenant tags is prohibited from being output to the large language model.

[0049] In one embodiment, the retrieval results of step 110 above include business knowledge in the retrieval vector knowledge base that does not match the first tenant's tag binding; the method further includes: directly returning notification information; the notification information is used to inform the first tenant that business knowledge has not been synchronized, terminate the current retrieval process, and prohibit the output of any business knowledge of other tenants. In this way, unauthorized data access is prevented from occurring at the source.

[0050] In another embodiment, the retrieval results of step 110 above include business knowledge in the retrieval vector knowledge base that does not match the first tenant's tag binding; the method further includes: automatically triggering a prompt message to guide knowledge synchronization; the prompt message is used to prompt the first tenant that the business knowledge has not been synchronized, and to upload the required business knowledge and bind it to the first tenant's tag, and after the first tenant's tag binding is completed, to initiate the first question again.

[0051] In another embodiment, the retrieval result of step 110 above includes business knowledge in the retrieval vector knowledge base that does not match the first tenant's tag binding; the method further includes: automatically triggering a knowledge synchronization guidance prompt; the prompt is used to inform the first tenant that no corresponding bound business knowledge has been found and / or guide the first tenant to enter the business knowledge upload synchronization process, complete the upload operation of the required business knowledge according to the guidance prompt, and complete the binding of the uploaded business knowledge with the first tenant's tag. After the first tenant's tag binding process is completed, the retrieval process of the first question is automatically initiated again based on the business knowledge that the first tenant has completed binding, without requiring the first tenant to re-enter the question content, thus simplifying the user operation process.

[0052] In a specific application embodiment, the first tenant is Factory XX. After registering with multiple tenants, it obtains a unique first tenant tag. When this factory initiates a natural language query regarding the monthly production capacity data of Production Line XX, the system first searches the vector knowledge base based on its first tenant tag. If the factory has not yet completed the business knowledge upload and synchronization, and there is no business knowledge matching the first tenant tag in the vector knowledge base, a notification message informing the factory of the unsynchronized business knowledge will be output, terminating the current query process. No other tenant's business knowledge will be output to avoid cross-tenant data leakage. Alternatively, a knowledge synchronization guidance prompt will be output to guide Factory XX to upload its own production capacity business metadata and scenario example knowledge. After the knowledge is bound to the first tenant tag, the system will automatically re-initiate the query process to generate corresponding data query results for the first tenant.

[0053] Combination Figure 1 As shown, the business knowledge pre-bound to each tenant tag in the vector knowledge base may include, but is not limited to, steps 210 to 240: Step 210: Obtain a vector knowledge base for storing the business knowledge of all tenants; the vector knowledge base is shared by all tenants; the vector knowledge base includes a tenant field for storing tenant tags for each tenant. In this way, all tenants share the vector knowledge base, eliminating the need to pre-allocate independent physical storage partitions for any tenant, reserving only a metadata tag storage field, and uniformly storing the business knowledge vectors of all tenants.

[0054] Step 220: Based on the received request for business knowledge synchronization initiated by the second tenant, obtain the tenant field of the second tenant.

[0055] Step 220 above may include, but is not limited to, obtaining the tenant field of the second tenant through a separate API interface based on the received request for business knowledge synchronization initiated by the second tenant. The separate API interface represents an interface specifically developed for tenant business knowledge synchronization scenarios, open only to tenants with business knowledge synchronization permissions. When calling the interface, the identity and permissions of the request initiator are automatically verified, allowing only verified tenants to initiate business knowledge synchronization requests, thus preventing unauthorized uploads or tampering with business knowledge content in the vector knowledge base. The separate API interface may include, but is not limited to, an Application Programming Interface (API).

[0056] In this paper, we dynamically obtain the globally unique identifier (UUID) of tenant fields such as tenant_code in the target knowledge base through the application programming interface (API).

[0057] Step 230: Based on the request, process the business knowledge of the second tenant to be added to the database and store it in the vector knowledge base.

[0058] Step 240: After the vector knowledge base is stored in this time, the tag mounting interface is called to bind the second tenant tag to the business knowledge stored in the vector knowledge base in this time, so as to perform tag mounting.

[0059] The tag mounting interface is specifically designed to bind corresponding tenant tags to business knowledge stored in the vector knowledge base. Only after tag binding is complete can the search accurately filter out the business knowledge available to the current tenant based on the tenant tags. In this way, the data content import and tag binding processes are independent of each other, avoiding concurrency conflicts caused by multiple tenants simultaneously modifying the vector knowledge base metadata during the data import process, and improving the stability of knowledge synchronization and import.

[0060] In this regard, the mounting of metadata in the aforementioned tenant label mounting process is also known as independent metadata mounting.

[0061] Independent metadata mounting is the process of mounting corresponding tenant tags to the metadata of each tenant's own business through an independent binding process. This is independent of the tag mounting interface call during a single business knowledge entry, and can adapt to the entry and binding needs of different types of knowledge. It supports both one-time tag binding of batch metadata and real-time tag binding after incremental business knowledge entry, making the tenant knowledge binding process more flexible and adaptable to different scenarios. In this way, tenant permission verification is decentralized to the knowledge storage and retrieval stage, eliminating the need for large language models to autonomously identify and add tenant filtering conditions during the generation stage. Permission isolation is achieved from the source of knowledge supply, fundamentally avoiding the risk of unauthorized access caused by the randomness of large language model generation.

[0062] In this embodiment, by independently mounting the underlying metadata and forcibly injecting tenant conditions during the SQL generation stage, the discretionary power of the large language model over the scope of data access is limited, effectively preventing unauthorized access caused by model illusion. This enhances the security of multi-tenant data. Furthermore, after tag mounting is completed, the knowledge of all tenants is shared and stored in the same underlying vector knowledge base. During the retrieval stage, the system directly filters the retrieval scope through pre-mounted tenant tags, returning only the knowledge content corresponding to the current tenant, thus achieving logical-level tenant knowledge isolation.

[0063] Furthermore, step 230 above may include, but is not limited to, steps 231 and 232 below; correspondingly, step 240 above may include, but is not limited to, step 241 below: Step 231: In response to the request, perform structured slicing and text formatting on the business knowledge to be stored in the second tenant to obtain plain text business knowledge that can be stored in the database.

[0064] Step 232: Store the plain text business knowledge into the vector knowledge base.

[0065] Step 241: After the vector knowledge base is stored in this time, the tag mounting interface is called to bind the second tenant tag to the plain text business knowledge stored in this time.

[0066] Step 241 above, by independently calling the metadata mounting interface, also known as the tag mounting interface, appends tenant tags to the plain text data block based on the obtained UUID, thus achieving physical isolation of the vector retrieval layer. In this way, the separate tenant isolation tag mounting process can avoid concurrent conflicts during document creation.

[0067] In this embodiment, a balance is struck between the granularity of data slicing and the integrity of business knowledge. The intelligent question-and-answer architecture, which adapts to the requirements of large language models and vector retrieval for input data format, completes the conversion of structured data into searchable plain text without changing the original business knowledge logic of the tenant, which facilitates subsequent tag mounting and vector storage.

[0068] Furthermore, the process of performing structured slicing and text formatting on the second tenant's business knowledge to be imported into the database in response to the request, to obtain plain text business knowledge, may include, but is not limited to, the following steps 310 to 320: Step 310: For the request, slice the business knowledge to be entered into the database of the second tenant according to the hierarchical nodes of the original structured data, retain the original parent-child node indentation relationship of the business knowledge to be entered into the database, and obtain the sliced ​​data.

[0069] Step 320: Convert the sliced ​​data into plain text format to generate plain text business knowledge.

[0070] This involves slicing tenant structured data into a hierarchical tree, preserving the parent-child node indentation relationship, and creating the underlying document in plain text format.

[0071] In this embodiment, the data is sliced ​​according to the hierarchical nodes of the original structured data. This not only cuts the data into independent data blocks of suitable length for vector retrieval, but also preserves the logical connections of the original hierarchical structure by maintaining the parent-child node indentation relationship of the original data. This does not destroy the integrity of the business knowledge itself, and ultimately can effectively improve the accuracy of subsequent vector retrieval, and also enable the large language model to better understand the hierarchical logic of the business knowledge.

[0072] As an optional embodiment of this application, in step 230 above, the method may also include, but is not limited to, steps 410 to 420; correspondingly, step 241 may include, but is not limited to, steps 510 to 520: Step 410: Generate a temporary batch identifier for all business data to be entered into the database this time.

[0073] Step 420: Based on the request, temporarily associate and bind the batch identifier and the second tenant label.

[0074] Step 510: After the vector knowledge base is stored in this time, the tag mounting interface is called to extract the second tenant tag from the request.

[0075] Step 520: Based on the batch identifier temporarily associated with the second tenant label, bind all business data that the second tenant label has entered into the database this time to the second tenant label.

[0076] The synchronization mechanism of intelligent query methods in related technologies is prone to blocking threads when handling long-running tasks, and the high coupling between document creation and metadata mounting easily leads to concurrency conflicts and tenant tag misalignment. Thus, knowledge base synchronization is easily blocked in high-concurrency scenarios, meaning that in a multi-tenant environment, a large number of tenants frequently adjust their organizational structure and initiate synchronization requests to the vector knowledge base. To address this technical issue, the following solution is adopted: Figure 2 As shown Figure 1 The flowchart shown illustrates the business knowledge synchronization process in the intelligent data query method.

[0077] like Figure 2 As shown, the intelligent questioning method may also include, but is not limited to, steps 610 to 640: Step 610: When a new request for business knowledge synchronization from a third tenant is received, the system uses a global task control lock to check if there is an existing task from the same tenant at the same directory level in the vector knowledge base that is currently in execution. Thus, this paper maintains a global task control lock on the server side, using an asynchronous task scheduling model with state locks and high-concurrency knowledge synchronization based on asynchronous interrupts to prevent high-concurrency synchronization requests from exhausting threads.

[0078] Step 620: If it does not exist, then based on the new request, execute a new task to synchronize business knowledge.

[0079] Step 630: If it exists, mark the existing task as cancelled, perform a soft interrupt on the existing task, release the resources occupied by the existing task, and then exit the existing task. In this way, a soft interrupt is triggered on the existing task marked as cancelled, so that the existing task actively releases the system resources such as database connection, memory, and threads it occupies after the current execution phase ends, and then exits the execution process.

[0080] Among them, "existing tasks" refers to the current tasks, which are old business knowledge synchronization tasks that are being executed under the same directory level of the same tenant. "New requests" are new synchronization tasks initiated by the tenant after updating business knowledge. Under the premise that there are existing tasks being executed, the system will not adopt a queuing and waiting method to avoid old tasks occupying core resources for a long time and slowing down the response speed of new tasks.

[0081] In step 630 above, by utilizing the global task control handle, when a concurrent request arrives, the current read / write task is softly interrupted, resources are released, and the latest synchronization request is executed first. This achieves anti-concurrency synchronization based on asynchronous state locks.

[0082] In step 630 above, when the system is running and receives a new synchronization request at the same level, a blocking queuing strategy is not adopted. Instead, the current task is marked as canceled. The database fetching and text sharding processes in the soft interrupt execution release resources and prioritize the latest request to ensure the overall availability of the system and eventual data consistency.

[0083] Step 640: Based on the new request, execute a new task for business knowledge synchronization.

[0084] In this embodiment, old tasks marked as canceled only need to have their current execution interrupted and core computing resources (such as database connections, worker threads, and memory cache blocks) released before transferring execution control to the new task's startup synchronization process. Any residual resources from the old task that do not affect the new task's operation (such as temporary files and log caches) can be asynchronously cleaned up by the system background after the new task starts, without waiting for complete resource cleanup before starting the new task. Thus, using an asynchronous interrupt mechanism to handle synchronization requests avoids system thread blocking caused by long-running tasks, ensuring the stability of the SaaS platform and improving system availability in high-concurrency scenarios. This minimizes the waiting time for new tasks, ensuring that new knowledge synchronization requests can quickly acquire core resources and start execution, while also thoroughly cleaning up residual resources to avoid resource leaks, thus balancing response speed and operational stability.

[0085] Figure 3 As shown Figure 1 The diagram shows the query process in the intelligent query method.

[0086] like Figure 3 As shown, the intelligent questioning method may also include, but is not limited to, steps 710 to 730: Step 710: When the large language model generates table-level query logic, the tenant ID of the current execution environment is used as the basic filtering condition. Thus, the query logic output by the large language model is enforced at the rule layer to include, and primarily includes, a tenant filtering condition matching the current system context. This enforces tenant isolation constraints on the large language model.

[0087] Step 720: Intercept and verify basic filtering conditions through the underlying query engine.

[0088] Step 730: If the basic filtering conditions that match are missing, the query will be rejected.

[0089] Step 740: If the basic filter conditions are matched, execute this query.

[0090] In this embodiment, the tenant ID (Identifier) ​​of the current execution environment is forcibly implanted as a basic filtering condition at the underlying table-level query logic generated by the large language model. The underlying execution engine intercepts and verifies this condition to prevent cross-tenant unauthorized access and, at the execution level, blocks cross-tenant unauthorized access, ensuring data security and compliance.

[0091] As an embodiment of this application, the intelligent questioning method may also include, but is not limited to, the following steps 810 to 850: Step 810: After the fourth tenant initiates the second question of the natural language query, the large language model is used to parse the query semantics and entity recognition to obtain the initial query logic generated by the fourth tenant's tenant ID, and to traverse and extract the entity types contained in the initial query logic.

[0092] Step 820: According to the entity type, modify the initial query logic to obtain the final query logic; the time part of the final query logic retains the conversion processing of the original time part when the large language model generates the query logic.

[0093] Step 830: Send the final query logic to the underlying query engine so that the underlying query engine calls the industrial production database to perform data query, obtains the query results, and returns the query results to the fourth tenant.

[0094] As an optional embodiment of this application, step 820 may include, but is not limited to, steps 821 to 825: Step 821: Identify the entity type in the query logic to obtain the entity type.

[0095] Step 822: If the entity type is an organizational structure entity, call the whitelist comparison interface; match the entity content of the organizational structure entity with the whitelist specific to the fourth tenant; if the match is successful, retain the entity content of the organizational structure entity and write it into the query logic. If the match fails, directly return an entity recognition error message to the fourth tenant and terminate the current query process.

[0096] The aforementioned organizational structure entities are used to represent different organizational units within an industrial production system, divided according to business division and management structure. These include, but are not limited to, entities that hierarchically manage production operations, such as XX factory, XX production workshop, XX work group, and XX functional department. Thus, tenant whitelist comparisons are performed on entities representing organizational structures (such as workshop names).

[0097] Step 823: If the entity type is a global collection type entity, skip the whitelist matching; convert the entity content of the global collection type entity into a traversal execution instruction that conforms to the execution specification and write it into the query logic.

[0098] Among them, the aforementioned global collection entity is used to represent the full set of business entities that are allowed to be publicly accessed within the organizational structure of the fourth tenant. This type of entity has already undergone system-level permission verification and will not involve business content that is beyond the current tenant's access scope. Therefore, it can be directly converted into a traversal execution instruction without repeated verification, which improves query execution efficiency while ensuring access security.

[0099] The aforementioned global set entities can include, but are not limited to, entities of set terms such as the entire factory and each line group. For these, comparison is waived and the commands are converted to traversal instructions.

[0100] Step 824: If the entity type is a business serial number type entity, retain the original content of the serial number in the second question and write the original content into the query logic.

[0101] Among them, the business serial number entity is used to represent a unique business document number in the entire database. It is generated by the system and is bound to the tenant information. Simply retaining the original content can ensure that the query scope will not exceed the current tenant's permission boundary without additional verification, which further improves the query processing efficiency.

[0102] The aforementioned business transaction number entities can include entities related to transaction numbers such as payment numbers and order numbers. Transaction numbers such as payment numbers and order numbers are exempt from verification and are transmitted verbatim in the query command. This provides hierarchical entity verification.

[0103] Step 825: Integrate the query logic to obtain the final query logic.

[0104] In related technologies, intelligent query counting models often hard-code relative time descriptions such as "today" and "last month" as absolute dates, leading to incorrect query ranges when called or reused across days. Simultaneously, excessive parsing of specific business identifiers (such as transaction numbers) also reduces query accuracy. Thus, there is a discrepancy between hard-coded time parsing and entity recognition. To address this technical issue, the following solution is adopted: Step 830 may include, but is limited to, steps 831 to 832 as follows: Step 831: When the underlying query engine executes the data query, the start and end dates of the query required by the fourth tenant are determined based on the current system time of the execution time.

[0105] In step 831 above, the large language model is restricted from converting vague time descriptions (such as "last three days") into specific dates, requiring the model to retain the original time terms. The underlying query engine performs late binding calculations based on the current system time at execution time, achieving relative time pass-through.

[0106] Step 832: According to the stated start and end dates, query the industrial production database to obtain the query results. In this way, whitelisting is implemented for organizational entities, and relative time parameters are transmitted as is with underlying delay calculations, achieving hierarchical entity verification and time transmission.

[0107] The whitelist represents a compliant list of organizational structure entities that the fourth tenant can access. It is pre-maintained and updated by the fourth tenant's system administrator and includes only legitimate entities within the fourth tenant's own management structure. Any organizational structure entities not on the whitelist will be filtered out and removed from the query logic. In this way, the whitelist enables fine-grained control over organizational structure access permissions, effectively preventing unauthorized access attempts made by forging organizational entity names.

[0108] In this embodiment, by using time-based word pass-through and hierarchical entity verification strategies, the hard-coding errors of relative dates in the large language model and the over-parsing of business dynamic identifiers are avoided, thereby improving the accuracy of natural language queries.

[0109] As an optional embodiment of this application, the above method may also include, but is not limited to, steps 910 to 930: Step 910: Extract parameters from the query results to obtain extracted parameters; the extracted parameters include the verified tenant ID, the verified entity, and the start and end dates for the query required by the fourth tenant.

[0110] Step 920: Encapsulate the verified tenant ID, the verified entity, and the start and end dates into a visual structure to obtain the encapsulation parameters.

[0111] The visualization structure is used to represent the structured data format that organizes the query dimensions and filtering conditions into a format that can be parsed by the front-end visualization component. This allows users to directly adjust the query scope through the visualization component on the query results page without having to re-initiate a natural language question.

[0112] The visualization structure described above may include, but is not limited to, JSON (JavaScript Object Notation) parameters, as well as hierarchical nested structures adapted to the rendering requirements of front-end components.

[0113] Step 920 extracts the entity ID and calculated start and end times from the intent parsing stage, encapsulates them into standard JSON parameters, concatenates them into the front-end basic route, and generates a parameterized URL (Uniform Resource Locator) link that can directly jump to the business details page.

[0114] Step 930: Concatenate the encapsulation parameters to the front-end basic route address of the business details page to generate and display a page jump link with complete query parameters; the page jump link is used to jump to the business details page corresponding to the industrial production business data in the query results when operated by the tenant.

[0115] If any tenant performs a page redirection operation, the system will directly redirect to the business details page corresponding to the industrial production business data in the query results, load the query parameters for filtering, without needing to re-enter the filtering conditions, and fully retain the context information during the query process.

[0116] Once the system completes the visualization of the query results and outputs the data summary, a clickable jump entry control will be generated in a prominent position in the corresponding result module, such as the lower right corner of the result card and below the summary text. The control's display text can generally be configured to view business details. Users can directly trigger the jump by clicking the control without having to manually copy or enter a URL link, further simplifying the operation process.

[0117] As shown in the example below, after obtaining the database query results, the data structure is analyzed by judging the logic through charts, and the visualization configuration and data summary are output adaptively.

[0118] The intelligent query solution in related technologies only outputs summary statistics. If users need to view detailed data, they need to manually switch to the business page and re-enter the filter conditions, which is cumbersome and inefficient. At the same time, if the filter parameters generated during the natural language query process cannot be reused in reverse, it will lead to a break in the context information and disrupt the continuity of user operations.

[0119] Compared to related technologies, in this embodiment, the query parameters that have been parsed and confirmed during the data collection process are directly converted into directly accessible front-end routes, achieving a seamless connection from the intelligent data collection results to the business details page, significantly improving efficiency and user experience. Thus, the query parameters are routed in reverse, generating parameterized page jump links that can be displayed along with the query results in the intelligent data collection results area.

[0120] In this embodiment, independent tenant identity verification is enforced in all three stages: vector retrieval, large language model logic translation, and underlying query execution. This enables intelligent querying across the entire multi-tenant chain. Furthermore, by separating and mounting metadata from the vector knowledge base, and using plain text documentation without metadata, tenant fields are dynamically extracted and tags are appended via independent interfaces, achieving data isolation.

[0121] The method provided in this invention can be applied to electronic devices. Specifically, the electronic device can be a desktop computer, a portable computer, a smart mobile terminal, a server, a PDA (Personal Digital Assistant), or a handheld terminal, etc. The PDA can include industrial PDAs and consumer PDAs. Any electronic device that can implement the embodiments of this invention falls within the protection scope of this invention and is not limited thereto.

[0122] Figure 4 The diagram shown is a structural schematic of the electronic device 50 provided in an embodiment of this application.

[0123] like Figure 4 As shown, the electronic device 50 includes one or more processors 51 for implementing the intelligent questioning method as described above.

[0124] In some embodiments, electronic device 50 may include storage medium 59. For example, computer-readable storage medium may store a program that can be invoked by processor 51, and may include non-volatile storage medium. In some embodiments, electronic device 50 may include memory 58 and interface 57. In some embodiments, electronic device 50 may also include other hardware depending on the specific application.

[0125] The computer-readable storage medium of this application embodiment stores a program that, when executed by processor 51, implements the intelligent questioning method described above.

[0126] This application provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the method described in any of the preceding claims.

[0127] This application also provides a computer program stored in a computer-readable storage medium, for example... Figure 4 The storage medium 59, and when the processor executes the computer program, causes the processor 51 to perform the method described above.

[0128] This application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-readable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be implemented using any method or technology. Information may be computer-readable instructions, data structures, program modules, or other data. Examples of computer-readable storage media include, but are not limited to: phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0129] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.

[0130] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Without further limitation, an element qualified by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A method for intelligent number retrieval, characterized in that, include: Based on the first tenant tag carried by the first tenant's natural language first question, retrieve the business knowledge pre-bound to each tenant tag in the vector knowledge base, and determine whether there is a match with the business knowledge bound to the first tenant tag to obtain the retrieval result. The search results are then tagged to obtain the filtered current business knowledge. The current business knowledge is output to the large language model, and the output of any business knowledge of other tenants is prohibited, so that the large language model can generate query results based on the current business knowledge and return them to the first tenant.

2. The intelligent questioning method as described in claim 1, characterized in that, The search results include business knowledge in the search vector knowledge base that matches the first tenant tag; The step of tag-filtering the search results to obtain filtered current business knowledge includes: Tag filtering is performed on the search results containing business knowledge that matches the first tenant's tag to obtain the filtered current business knowledge.

3. The intelligent questioning method as described in claim 1 or 2, characterized in that, The business knowledge pre-bound to each tenant tag in the vector knowledge base includes: Obtain a vector knowledge base for storing business knowledge of all tenants; the vector knowledge base is shared by all tenants; the vector knowledge base includes a tenant field for storing tenant tags for each tenant; Based on the received request for business knowledge synchronization initiated by the second tenant, obtain the tenant field of the second tenant; Based on the request, the business knowledge of the second tenant to be added to the database is processed and then stored in the vector knowledge base. After the vector knowledge base is stored, the tag mounting interface is called to bind the second tenant tag to the business knowledge stored in the vector knowledge base to perform tag mounting.

4. The intelligent questioning method as described in claim 3, characterized in that, The process of processing the second tenant's business knowledge to be added to the database based on the request and then storing it in the vector knowledge base includes: In response to the request, the business knowledge to be imported into the database of the second tenant is processed by structured slicing and text formatting to obtain plain text business knowledge that can be imported into the database. The plain text business knowledge is stored in the vector knowledge base; After the data is stored in the vector knowledge base, the tag mounting interface is called to bind the second tenant tag to the business knowledge stored in the vector knowledge base, including: After the vector knowledge base is stored, the tag mounting interface is called to bind the second tenant tag to the plain text business knowledge stored in this time.

5. The intelligent questioning method as described in claim 4, characterized in that, In response to the request, the business knowledge to be imported into the database by the second tenant is processed by structured slicing and text formatting to obtain plain text business knowledge, including: In response to the request, the business knowledge to be imported by the second tenant is sliced ​​according to the hierarchical nodes of the original structured data, while retaining the original parent-child node indentation relationship of the business knowledge to be imported, to obtain the sliced ​​data. The sliced ​​data is converted to plain text format to generate plain text business knowledge.

6. The intelligent questioning method as described in claim 5, characterized in that, When processing the second tenant's business knowledge to be added to the database based on the request and storing it in the vector knowledge base, the method further includes: Generate a temporary batch identifier for all business data entering the warehouse this time; Based on the request, the batch identifier and the second tenant label are temporarily associated and bound together; After the vector knowledge base is stored, the tag mounting interface is called to bind the second tenant tag to the plain text business knowledge stored in this time, including: After the vector knowledge base is stored in the vector knowledge base, the tag mounting interface is called to extract the second tenant tag from the request; Based on the batch identifier temporarily associated with the second tenant label, all business data entered into the database for this time by the second tenant label are bound to the second tenant label.

7. The intelligent questioning method according to any one of claims 1, 2, 4 to 6, characterized in that, The method further includes: When a new request for business knowledge synchronization from a third tenant is received, the global task control lock is used to search for existing tasks of the same tenant in the same directory level of the vector knowledge base that are currently in execution. If it does not exist, then based on the new request, execute a new task to synchronize business knowledge; If it exists, mark the existing task as cancelled, perform a soft interrupt on the existing task, release the resources occupied by the existing task, and then exit the existing task; and, Based on the new request, execute a new task to synchronize business knowledge.

8. The intelligent questioning method according to any one of claims 1, 2, 4 to 6, characterized in that, The method further includes: When generating table-level query logic in the large language model, the tenant ID of the current execution environment is used as the basic filtering condition; The underlying query engine intercepts and verifies the basic filtering conditions; If the basic filtering conditions for matching are missing, the query will be rejected. If the basic filtering conditions are matched, the query will be executed.

9. The intelligent questioning method according to any one of claims 1, 2, 4 to 6, characterized in that, The method further includes: When the fourth tenant initiates the second question of the natural language query, the large language model parses the query semantics and entity recognition to obtain the initial query logic generated by the fourth tenant's tenant ID, and iterates to extract the entity types contained in the initial query logic; Based on the entity type, the initial query logic is modified to obtain the final query logic; the time portion of the final query logic retains the conversion processing of the original time portion when the large language model generated the query logic; The final query logic is sent to the underlying query engine so that the underlying query engine calls the industrial production database to perform data query, obtains the query results, and returns the query results to the fourth tenant.

10. The intelligent questioning method as described in claim 9, characterized in that, The step of modifying the initial query logic according to the entity type to obtain the final query logic includes: The entity types in the query logic are identified to obtain the entity types; If the entity type is an organizational structure entity, call the whitelist comparison interface; match the entity content of the organizational structure entity with the whitelist exclusive to the fourth tenant; if the match is successful, retain the entity content of the organizational structure entity and write it into the query logic; If the entity type is a global collection type entity, skip the whitelist matching; convert the entity content of the global collection type entity into a traversal execution instruction that conforms to the execution specification and write it into the query logic; If the entity type is a business serial number type entity, retain the original content of the serial number in the second question and write the original content into the query logic; The query logic is then integrated to obtain the final query logic.

11. The intelligent questioning method as described in claim 9, characterized in that, The underlying query engine calls the industrial production database to query data, including: When the underlying query engine executes the data query, the start and end dates of the query required by the fourth tenant are determined based on the current system time of the execution time. Based on the stated start and end dates, the industrial production database is invoked to perform a data query, and the query results are obtained.

12. The intelligent questioning method according to any one of claims 1, 2, 4 to 6, 10 to 11, characterized in that, The method further includes: The query results are processed to extract parameters, which include the verified tenant ID, the verified entity, and the start and end dates for the query to be performed by the fourth tenant. The verified tenant ID, the verified entity, and the start and end dates are encapsulated into a visual structure to obtain the encapsulation parameters. The encapsulated parameters are concatenated to the front-end basic route address of the business details page to generate and display a page jump link with complete query parameters; the page jump link is used to jump to the business details page corresponding to the industrial production business data in the query results when operated by the tenant.

13. The intelligent questioning method according to any one of claims 1, 2, 4 to 6, 10 to 11, characterized in that, The search results include business knowledge in the search vector knowledge base that does not match the first tenant's tag binding; the method also includes: directly returning notification information; the notification information is used to inform the first tenant that business knowledge has not been synchronized, terminate the current search process, and prohibit the output of any business knowledge of other tenants; or, The search results include business knowledge in the search vector knowledge base that does not match the first tenant's tag binding; the method also includes: automatically triggering a knowledge synchronization guidance prompt; the prompt is used to remind the first tenant that the business knowledge has not been synchronized, and to upload the required business knowledge and bind it to the first tenant's tag, and after the first tenant's tag binding is completed, to re-initiate the first question.

14. An electronic device, characterized in that, It includes one or more processors for implementing the intelligent questioning method as described in any one of claims 1 to 13.

15. A computer-readable storage medium, characterized in that, It stores a program that, when executed by a processor, implements the intelligent questioning method as described in any one of claims 1 to 13.