Local knowledge question answering control method based on index reusability detection and state degradation

CN122964160APending Publication Date: 2026-10-23CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611251710.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-18
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

[0004]第一,数据库状态与磁盘索引实际状态易产生不一致

Benefits of technology

[0027]本发明的基于索引可复用性检测与状态降级的本地知识问答控制方法,具有以下有益技术效果:通过将问答入口的可用性判定从单一依赖数据库状态升级为联合数据库记录状态与本地全文索引实际文档片段数的双重判定,有效避免在索引不可用时误开放问答入口,降低无依据问答或底层读取异常的风险。同时,通过结构化就绪状态对不可复用结果进行状态降级分类,使问答控制逻辑与索引实际可用性解耦,提升控制决策的准确性和鲁棒性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122964160A_ABST
    Figure CN122964160A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of big data and artificial intelligence, and provides a local knowledge question and answer control method based on index reusability detection and state degradation, which comprises the following steps: reading the database record state of a target knowledge base, positioning a local full-text index directory according to the knowledge base identifier of the target knowledge base; reading the number of document fragments in the local full-text index directory; if the reading is successful and the number of document fragments is greater than zero, it is determined that the index is reusable, otherwise, corresponding non-reusable determination results are generated according to the zero number of document fragments or reading abnormalities; according to the combination of the database record state and the number of document fragments, the state degradation classification is performed on the non-reusable determination results, a structured ready state corresponding to the actual availability of the current index is generated; when the structured ready state is reusable, the user is allowed to initiate a question and answer; when the structured ready state is non-reusable and corresponds to a non-available category after the state degradation classification, the user is guided to perform an index repair or refresh operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of big data and artificial intelligence technology, and in particular to a local knowledge question answering control method based on index reusability detection and state degradation. Background Technology

[0002] In a local knowledge-based question-answering system, the structured information of the knowledge base is stored in a database, and full-text search fragments are persisted in a disk index directory. When a user opens a knowledge base, the system needs to determine whether the knowledge base has actual question-answering capabilities.

[0003] Existing solutions typically determine whether to allow questions based solely on the knowledge base status in the database. When the database status is "indexed," the interface opens the question-and-answer interface. However, in a local desktop environment, this strategy faces the following problems:

[0004] First, inconsistencies can easily arise between the database status and the actual disk index status. After a user cleans up data, migrates directories, or performs an overwrite installation, the index files may have been deleted, but the database may still retain the "indexed" mark. The system is unaware of this and continues to display a question-and-answer status to the user.

[0005] Second, there is a lack of identification when the index directory exists but does not contain searchable content. Refresh interruptions, write anomalies, or external cleanup may cause the index directory to be empty or corrupted. The existing solution only checks whether the directory exists, without counting the number of valid segments, thus misclassifying invalid indexes as valid.

[0006] Third, there is a lack of secondary verification of actual readability after index refresh. Some solutions directly update the database state after refresh without rereading the index content to verify write integrity, thus failing to detect partial write failures or file corruption.

[0007] Fourth, the error messages lack differentiation. The reasons why an index cannot be answered include various situations such as no refresh triggered, refresh in progress, refresh failure, missing index, and corrupted index. Existing solutions often provide a general message such as "not indexed" or "unavailable," which makes it impossible for users to locate the problem and take corresponding measures.

[0008] Fifth, the Q&A entry point lacks degradation control based on actual index availability. When the index is actually unavailable, the Q&A entry point may still remain open because the database status is "indexed." If a user asks a question in this state, it will result in an answer lacking search basis or an underlying read error, affecting system stability and answer quality.

[0009] Chinese patent CN118132669A discloses an intelligent indexing method based on a large language model. This method cannot detect and verify the actual availability of the constructed index, cannot identify local disk abnormal states such as missing, empty or damaged indexes, and lacks a question-and-answer entry degradation control mechanism based on the actual readiness status of the index. There is a risk of triggering unfounded questions and answers due to the unavailability of the index.

[0010] Chinese patent CN121501919A discloses an automatic update method for an intelligent customer service knowledge base based on a large language model. The status determination of this method is based on the comparison results between candidate entries and existing entries. It does not involve the detection and verification of the actual readability, integrity and fragment availability of local index files. It cannot identify storage-level anomalies such as the deletion of the index directory, the corruption of the index file or the empty index content. Furthermore, it lacks a mechanism to degrade the query entry based on the actual readiness status of the index, and there is still a risk of responding without basis due to the unavailability of the index.

[0011] Therefore, a method is needed to determine the database state and the actual number of disk index fragments, and to implement degradation control on the question-and-answer entry point based on the determination result, in order to improve the reliability and anomaly interpretability of the local knowledge question-and-answer system in a desktop environment. Thus, how to provide such a method has become an urgent technical problem to be solved. Summary of the Invention

[0012] In view of this, in order to overcome the shortcomings of the prior art, the present invention aims to provide a local knowledge question answering control method based on index reusability detection and state degradation.

[0013] According to a first aspect of the present invention, a local knowledge question-answering control method based on index reusability detection and state degradation is provided, the method comprising:

[0014] Step S1: In response to the user's selection of the target knowledge base, read the database record status of the target knowledge base and locate the local full-text index directory based on the knowledge base identifier of the target knowledge base;

[0015] Step S2: Read the number of document fragments in the local full-text index directory. If the reading is successful and the number of document fragments is greater than zero, the index is determined to be reusable. Otherwise, a corresponding non-reusable determination result is generated based on whether the number of document fragments is zero or the reading is abnormal.

[0016] Step S3: Based on the combination of database record status and document fragment quantity, classify the non-reusability determination results into different statuses and generate a structured ready state corresponding to the actual availability of the current index.

[0017] Step S4: Control the availability of the question and answer entry point based on the structured readiness state. When the structured readiness state is reusable, allow users to initiate questions and answers. When the structured readiness state is not reusable and corresponds to an unavailable category after state downgrading and classification, guide users to perform index repair or refresh operations.

[0018] Optionally, in the local knowledge question answering control method based on index reusability detection and state degradation of the present invention, in step S1, the database record state includes an unindexed state, an indexed state, an indexed state, and a failed state; the database record state is stored in the knowledge base record table of the local database and associated with the corresponding knowledge base record according to the knowledge base identifier. When the index refresh task is started, it is updated to the indexed state, and after the index refresh task is completed, it is updated to the indexed state or the failed state according to the index digest.

[0019] Optionally, in the local knowledge question answering control method based on index reusability detection and state degradation of the present invention, in step S1, the local full-text index directory is maintained independently in the local disk according to the knowledge base identifier, and each knowledge base corresponds to a unique index directory path; when locating the local full-text index directory, the corresponding index directory storage path is generated by concatenating according to the knowledge base identifier, and the existence and readability of the path are checked.

[0020] Optionally, in the local knowledge question answering control method based on index reusability detection and state degradation of the present invention, in step S2, when reading the number of document fragments in the local full-text index directory, if the index directory does not exist, the index directory is empty, or the local full-text index cannot be opened normally, a value of zero is returned as the number of document fragments; if the local full-text index directory is accessible and the index is readable, the statistical interface of the underlying retrieval engine is called to obtain the total number of document fragments actually stored.

[0021] Optionally, in the local knowledge question answering control method based on index reusability detection and state degradation of the present invention, in step S2, when a reading abnormality is captured, the fragment count reading is terminated and the current detection result is marked as an abnormal state, which is different from the detection result where the document fragment count is zero.

[0022] Optionally, in the local knowledge question answering control method based on index reusability detection and state degradation of the present invention, in step S2, the reading exception includes at least one of the following situations: the local full-text index directory is inaccessible, the local full-text index file is corrupted, the underlying retrieval engine throws a reading exception, and disk input / output error.

[0023] Optionally, in the local knowledge question answering control method based on index reusability detection and state degradation of the present invention, in step S3, the non-reusability determination result is classified into state degradation categories as follows: when the number of document fragments is zero and the database record status is indexed, the database record status is downgraded from indexed to index missing category; when the number of document fragments is zero and the database record status is not indexed, the database record status is classified into index empty category; when an exception occurs during the reading process, the database record status is classified into index error category.

[0024] Optionally, in the local knowledge question answering control method based on index reusability detection and state degradation of the present invention, in step S3, the structured ready state is generated by the service layer after joint determination based on the database record status and the number of document fragments. The structured ready state includes at least a status type field, a fragment number field, and a user-readable prompt message field. The status type field is used to identify whether the current index is reusable, missing, empty, or incorrect. The fragment number field records the number of document fragments actually read. The user-readable prompt message field contains guiding text generated for the current status type.

[0025] Optionally, in the local knowledge question-answering control method based on index reusability detection and state degradation of the present invention, in step S4, the availability of the question-answering entry is controlled according to the structured readiness state in the following manner: when the structured readiness state is reusable, the question-answering entry is set to an allowed state, and the user can input questions through the question-answering entry and obtain answers based on local index evidence; when the structured readiness state is missing index, empty index, or index error, the question-answering entry is set to a restricted state, and the user interface guides the user to perform index repair or refresh operations first through a combination of prompt bar, status label, and refresh button, and the refresh button remains visible and operable.

[0026] Optionally, in the local knowledge question answering control method based on index reusability detection and state degradation of the present invention, in step S4, after the user performs the index refresh operation, the database record status is updated to the indexed status, and after the index refresh task is completed, the database record status is updated according to the number of indexed documents, the number of generated fragments, and the number of failed documents in the index digest; when the user selects or opens the target knowledge base again, the latest number of document fragments is read and the index reusability is re-determined, thereby discovering the index that was deleted or damaged externally after the refresh.

[0027] The local knowledge question-answering control method based on index reusability detection and state degradation of the present invention has the following beneficial technical effects: By upgrading the availability determination of the question-answering entry point from a single dependency on the database state to a dual determination based on the combined database record state and the actual number of document fragments in the local full-text index, the method effectively avoids mistakenly opening the question-answering entry point when the index is unavailable, reducing the risk of unfounded question-answering or underlying read anomalies. Simultaneously, by classifying unreusable results into structured ready states for state degradation, the question-answering control logic is decoupled from the actual availability of the index, improving the accuracy and robustness of control decisions. Attached Figure Description

[0028] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0029] Figure 1 This is a flowchart illustrating a local knowledge question-answering control method based on index reusability detection and state degradation according to an exemplary embodiment 1 of the present invention.

[0030] Figure 2 A schematic diagram illustrating the process of database record status update management according to the method of Exemplary Embodiment 1 of the present invention;

[0031] Figure 3 A schematic diagram illustrating the process of reading the number of document fragments according to an exemplary embodiment 1 of the present invention;

[0032] Figure 4 This is a flowchart illustrating the method for index reading exception capture and marking according to an exemplary embodiment 1 of the present invention;

[0033] Figure 5 This is a flowchart illustrating the process of classifying the non-reusable determination result status downgrade according to the method of Exemplary Embodiment 1 of the present invention.

[0034] Figure 6 This is a flowchart illustrating the method for controlling the availability of the question-and-answer entry point according to an exemplary embodiment 1 of the present invention. Detailed Implementation

[0035] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0036] It should be noted that, in the absence of conflict, the following embodiments and features can be combined with each other; and, based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0037] It should be noted that various aspects of embodiments within the scope of the appended claims are described below. It will be apparent that the aspects described herein can be embodied in a wide variety of forms, and any particular structure and / or function described herein is merely illustrative. Based on this disclosure, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects set forth herein can be used to implement the device and / or practice the method. Additionally, this device and / or method can be implemented using structures and / or functionalities other than one or more of the aspects set forth herein.

[0038] Example 1

[0039] Exemplary embodiment 1 of the present invention provides a local knowledge question answering control method based on index reusability detection and state degradation. Figure 1 This is a flowchart illustrating a local knowledge question-answering control method based on index reusability detection and state degradation according to an exemplary embodiment 1 of the present invention. Figure 1 As shown, in this embodiment, the method of the present invention is implemented in the following manner:

[0040] Step S1: In response to the user's selection of the target knowledge base, read the database record status of the target knowledge base and locate the local full-text index directory based on the knowledge base identifier of the target knowledge base.

[0041] Figure 2 This is a schematic diagram of the process for managing database record status updates according to an exemplary embodiment 1 of the present invention, as follows: Figure 2 As shown, in this embodiment, the database record status includes unindexed, indexed, indexed, and failed states. This database record status is stored in the knowledge base record table of the local database and associated with the corresponding knowledge base record according to the knowledge base identifier. It is updated to the indexed state when the index refresh task starts, and updated to the indexed or failed state based on the index digest after the index refresh task is completed. This embodiment can accurately track the entire lifecycle of index processing, providing reliable status input for subsequent joint judgment and avoiding misjudgments caused by insufficient state granularity.

[0042] In this embodiment, the local full-text index directory is maintained independently on the local disk according to the knowledge base identifier, and each knowledge base corresponds to a unique index directory path. When locating the local full-text index directory, the corresponding index directory storage path is generated by concatenating the knowledge base identifier, and the existence and readability of the path are checked. This embodiment realizes index isolation management in multi-knowledge base scenarios, avoids mutual interference between indexes of different knowledge bases, and improves the index location accuracy and maintenance convenience of multi-knowledge base systems.

[0043] Step S2: Read the number of document fragments in the local full-text index directory. If the reading is successful and the number of document fragments is greater than zero, the index is determined to be reusable. Otherwise, a corresponding non-reusable determination result is generated based on whether the number of document fragments is zero or the reading is abnormal.

[0044] Figure 3 This is a flowchart illustrating the method for reading the number of document fragments according to an exemplary embodiment 1 of the present invention, as shown below. Figure 3 As shown in this embodiment, when reading the number of document fragments in the local full-text index directory, if the index directory does not exist, is empty, or cannot be opened normally, a value of zero is returned as the number of document fragments; if the local full-text index directory is accessible and the index is readable, the statistical interface of the underlying retrieval engine is called to obtain the total number of document fragments actually stored. This embodiment can ensure the completeness and accuracy of the fragment count acquisition, providing a reliable quantitative basis for joint determination.

[0045] Figure 4 This is a flowchart illustrating the index read exception capture and marking process according to an exemplary embodiment 1 of the present invention. Figure 4 As shown in this embodiment, when a read anomaly is detected, the fragment count reading is terminated and the current detection result is marked as an abnormal state. This abnormal state is different from the detection result of zero document fragment count. By clearly distinguishing between read anomalies and the detection result of zero document fragment count, it is possible to identify anomaly risks at the index storage level rather than simply equating anomalies with empty indexes. This provides accurate anomaly markings for subsequent state degradation classification, improving the sensitivity of anomaly detection and the granularity of state classification.

[0046] In practical applications, read exceptions in this embodiment include at least one of the following: the local full-text index directory is inaccessible, the local full-text index file is corrupted, the underlying search engine throws a read exception, and disk input / output errors.

[0047] Step S3: Based on the combination of database record status and document fragment quantity, classify the non-reusability determination results into different statuses and generate a structured ready state corresponding to the actual availability of the current index.

[0048] Figure 5This is a flowchart illustrating the process of classifying the non-reusable determination result state downgrade according to the method of Exemplary Embodiment 1 of the present invention, as follows: Figure 5 As shown, in this embodiment, the non-reusability determination result is classified into different statuses in the following way: when the number of document fragments is zero and the database record status is indexed, the database record status is downgraded from indexed to index missing; when the number of document fragments is zero and the database record status is not indexed, the database record status is classified into the index empty category; when an exception occurs during the reading process, the database record status is classified into the index error category. By downgrading the indexed database status to the index missing category when the index is missing, the inconsistency between the database record and its actual availability can be explicitly identified, and indexes that were originally incorrectly identified as usable can be downgraded to a state that needs repair, thereby avoiding misleading users and providing users with clear guidance on index repair.

[0049] In this embodiment, the structured ready state is generated by the service layer based on the database record status and the number of document fragments. The structured ready state includes at least a status type field, a fragment number field, and a user-readable prompt message field. The status type field is used to identify whether the current index is reusable, missing, empty, or erroneous. The fragment number field records the number of document fragments actually read. The user-readable prompt message field contains guiding text generated for the current status type.

[0050] This embodiment generates a structured ready state object containing state type, number of fragments, and user-readable prompt messages through the service layer. This allows the interface layer to directly consume the state for display and control without performing multiple discrete Boolean judgments, reducing the logical complexity of the interface layer, improving the reusability and maintainability of the service layer and the interface layer, and ensuring that the user receives accurate guidance information for the current state type.

[0051] Step S4: Control the availability of the question and answer entry point based on the structured readiness state. When the structured readiness state is reusable, allow users to initiate questions and answers. When the structured readiness state is not reusable and corresponds to an unavailable category after state downgrading and classification, guide users to perform index repair or refresh operations.

[0052] Figure 6 This is a flowchart illustrating the method for question-and-answer entry availability control according to Exemplary Embodiment 1 of the present invention, as follows: Figure 6As shown, in this embodiment, the availability of the question-and-answer entry is controlled according to the structured readiness state in the following manner: when the structured readiness state is reusable, the question-and-answer entry is set to the allowed state, and users can enter questions through the question-and-answer entry and obtain answers based on local index evidence; when the structured readiness state is missing index, empty index, or index error, the question-and-answer entry is set to the restricted state, and the user interface guides users to perform index repair or refresh operations first through a combination of prompt bar, status label, and refresh button, and the refresh button remains visible and operable.

[0053] It's important to note that after a user performs an index refresh operation, the database record status is updated to reflect the indexed state. Furthermore, after the index refresh task is completed, the database record status is updated based on the number of indexed documents, generated fragments, and failed documents in the index digest. When the user selects or opens the target knowledge base again, the latest document fragment count is read, and index reusability is reassessed, thus identifying indexes that were externally deleted or corrupted after the refresh. By updating the database status based on the index digest after the index refresh task is completed and rereading the latest fragment count to reassess reusability upon the user's return, a self-healing mechanism can be established to detect and correct indexes that were externally deleted or corrupted after the refresh on each access, forming a closed-loop index availability guarantee mechanism and avoiding continuous erroneous judgments caused by a single status record deviation.

[0054] Example 2

[0055] Exemplary Example 2 of the present invention provides a local knowledge question answering control method based on index reusability detection and state degradation. The method of the present invention is implemented in a specific operating system. In this embodiment, the method of the present invention is implemented in the following manner:

[0056] Knowledge base records are stored in a local database, each containing a knowledge base identifier, name, and status. Status can include unindexed, indexing, indexed, and failed. An independent local index directory is maintained for each knowledge base. Full-text search snippets are stored in the index directory. In this embodiment, the database status and the index directory represent two different levels of status: the database status expresses the business process, while the index directory expresses the actual searchable capabilities.

[0057] After a user selects a knowledge base, the system locates the index directory based on the knowledge base identifier and attempts to open the index. If the index directory does not exist, the index does not exist, or the index is empty, the fragment count is zero. If the index exists and is readable, the system reads the number of document fragments in the index. A fragment count greater than zero indicates that the knowledge base has a reusable index.

[0058] The system encapsulates the detection results into a structured ready state. This state includes at least: 1. State type; 2. Number of fragments; 3. User-readable prompt message. State types can include: 1. Available: Number of fragments is greater than zero; 2. Missing: Number of fragments is zero, but the database record is indexed; 3. Empty: Number of fragments is zero, and the database record is not indexed; 4. Error: An exception occurred during index reading. This structured object allows the service layer and the interface layer to share a unified judgment result, avoiding multiple scattered Boolean judgments in the interface layer.

[0059] When the number of fragments is greater than zero, the system generates an available status and includes the number of fragments in the prompt message. For example, "Local index loaded, several fragments, you can ask a question directly." In this status, the interface allows users to directly enter questions and indicates that the evidence sources on the right will be updated as the answer is given.

[0060] When the database status is indexed but the number of fragments is zero, the system does not continue processing it as indexed, but instead generates a missing status. This status indicates that the database records and the disk index are inconsistent. The interface prompts "Index file not found, please refresh the index" and guides the user to rebuild the searchable content of the current knowledge base.

[0061] When the number of fragments is zero and the database status is unindexed, indexing, or failed, the system generates an empty status and outputs next steps based on the database status. For example, if the database is unindexed, the system prompts the user to refresh the index first; if it is indexing, the system prompts the user to wait for the index to complete; if it has failed, the system prompts the user to check the path, URL, or model configuration and then retry.

[0062] If an exception occurs during the index reading process, such as an inaccessible index directory, corrupted index files, or an exception thrown by the underlying search library, the system generates an error status. The interface displays a message indicating that the index read failed and guides the user to refresh the index or check the local data directory. This status differs from the normal unindexed status and is used to alert the user to potential abnormalities in local index storage.

[0063] The system controls the question-and-answer entry point based on the structured readiness status. When the input field is available, users can directly ask questions. In the missing, empty, or error states, the system prioritizes prompting for a refresh or repair. In practical applications, even if the input field remains visible, the system will guide users to restore the index first through prompts, status labels, and a refresh button, thus preventing users from mistakenly believing that the knowledge base is already answerable.

[0064] When a user clicks "Refresh Index," the system updates the knowledge base status to "Indexed." After the refresh is complete, the system updates the knowledge base status based on the number of indexed documents, fragments, and failures. When the user switches to or opens the knowledge base again, the method of this invention rereads the number of index fragments, instead of simply using the previously saved status. This allows for the detection of indexes that have been externally deleted or corrupted after the refresh.

[0065] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.

[0066] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A local knowledge question-answering control method based on index reusability detection and state degradation, characterized in that, The method includes: Step S1: In response to the user's selection of the target knowledge base, read the database record status of the target knowledge base and locate the local full-text index directory based on the knowledge base identifier of the target knowledge base; Step S2: Read the number of document fragments in the local full-text index directory. If the reading is successful and the number of document fragments is greater than zero, the index is determined to be reusable. Otherwise, a corresponding non-reusable determination result is generated based on whether the number of document fragments is zero or the reading is abnormal. Step S3: Based on the combination of database record status and document fragment quantity, classify the non-reusability determination results into different statuses and generate a structured ready state corresponding to the actual availability of the current index. Step S4: Control the availability of the question and answer entry point based on the structured readiness state. When the structured readiness state is reusable, allow users to initiate questions and answers. When the structured readiness state is not reusable and corresponds to an unavailable category after state downgrading and classification, guide users to perform index repair or refresh operations.

2. The local knowledge question answering control method based on index reusability detection and state degradation according to claim 1, characterized in that, In step S1, the database record status includes unindexed status, indexed status, indexed status, and failed status. This database record status is stored in the knowledge base record table of the local database and associated with the corresponding knowledge base record according to the knowledge base identifier. When the index refresh task starts, it is updated to the indexed status, and after the index refresh task is completed, it is updated to the indexed status or failed status according to the index summary.

3. The local knowledge question answering control method based on index reusability detection and state degradation according to claim 1, characterized in that, In step S1, the local full-text index directory is maintained independently on the local disk according to the knowledge base identifier, and each knowledge base corresponds to a unique index directory path. When locating the local full-text index directory, the corresponding index directory storage path is generated by concatenating the knowledge base identifier, and the existence and readability of the path are checked.

4. The local knowledge question answering control method based on index reusability detection and state degradation according to claim 1, characterized in that, In step S2, when reading the number of document fragments in the local full-text index directory, if the index directory does not exist, is empty, or the local full-text index cannot be opened normally, a value of zero is returned as the number of document fragments; if the local full-text index directory is accessible and the index is readable, the statistics interface of the underlying retrieval engine is called to obtain the total number of document fragments actually stored.

5. The local knowledge question answering control method based on index reusability detection and state degradation according to claim 1, characterized in that, In step S2, when a reading exception is detected, the fragment count reading is terminated and the current detection result is marked as an abnormal state, which is different from the detection result where the document fragment count is zero.

6. The local knowledge question answering control method based on index reusability detection and state degradation according to claim 1, characterized in that, In step S2, read exceptions include at least one of the following: the local full-text index directory is inaccessible, the local full-text index file is corrupted, the underlying search engine throws a read exception, and disk input / output errors.

7. The local knowledge question answering control method based on index reusability detection and state degradation according to claim 1, characterized in that, In step S3, the non-reusable determination result is classified into different categories for downgrading as follows: when the number of document fragments is zero and the database record status is indexed, the database record status is downgraded from indexed to index missing; when the number of document fragments is zero and the database record status is not indexed, the database record status is classified into the index empty category. When an exception occurs during the read process, the database record status is classified into the index error category.

8. The local knowledge question answering control method based on index reusability detection and state degradation according to claim 1, characterized in that, In step S3, the structured ready state is generated by the service layer based on the database record status and the number of document fragments. The structured ready state includes at least a status type field, a fragment number field, and a user-readable prompt message field. The status type field is used to identify whether the current index is reusable, missing, empty, or erroneous. The fragment number field records the number of document fragments actually read. The user-readable prompt message field contains guiding text generated for the current status type.

9. The local knowledge question answering control method based on index reusability detection and state degradation according to claim 1, characterized in that, In step S4, the availability of the question-and-answer entry is controlled according to the structured readiness state as follows: when the structured readiness state is reusable, the question-and-answer entry is set to the allowed state, and users can enter questions through the question-and-answer entry and obtain answers based on local index evidence; When the structured readiness state is missing, empty, or incorrect, the Q&A entry is set to a restricted state. The user interface guides the user to prioritize index repair or refresh operations through a combination of prompts, status labels, and a refresh button, while the refresh button remains visible and operable.

10. The local knowledge question answering control method based on index reusability detection and state degradation according to claim 1, characterized in that, In step S4, after the user performs the index refresh operation, the database record status is updated to the indexed status. After the index refresh task is completed, the database record status is updated according to the number of indexed documents, the number of generated fragments, and the number of failed documents in the index digest. When the user selects or opens the target knowledge base again, the latest number of document fragments is read and the index reusability is reassessed, thereby discovering the index that was deleted or damaged externally after the refresh.

Citation Information

Patent Citations

  • Intelligent indexing method based on large language model

    CN118132669A

  • Intelligent customer service knowledge base automatic updating method based on large language model

    CN121501919A