Emergency plan knowledge question and answer method, system and equipment

Through large language model and vector database technology, intelligent Q&A of emergency plan knowledge is realized, and the problem of low efficiency of traditional emergency plans in the face of complex failures is solved, the efficiency and accuracy of emergency response is improved, and complex failure scenarios are adapted to complex failure scenarios and ensure the safety and stability of civil aviation operations.

CN119719288APending Publication Date: 2025-03-28TRAVELSKY TECHNOLOGY LIMITED

Patent Information

Application Number
CN202411783039.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

When traditional emergency plans face sudden, complex and diverse failures, search and execution are inefficient, difficult to respond quickly to emergencies, and have high requirements for professional quality.

Method used

A large language model is used to combine vector database and index technology to obtain emergency plan knowledge data for cutting and vectorization, and answers are generated through vector retrieval and sorting to realize intelligent emergency plan Q&A.

Benefits of technology

It improves the efficiency and accuracy of emergency response, adapts to complex failure scenarios, reduces dependence on manual intervention, and ensures the safety and stability of civil aviation operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719288A_ABST
    Figure CN119719288A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of emergency questioning and answering, and provides an emergency plan knowledge questioning and answering method, system and equipment, and the method comprises the steps: cutting obtained emergency plan knowledge data, and storing the cut emergency plan knowledge data as a CSV file; constructing a vector database for the cut emergency plan knowledge data through vectorization, and constructing a vector index for vector data in the vector database; when vector retrieval is carried out on the optimized user problem, corresponding vector data are loaded by reading a vector index; the method comprises the steps of obtaining vector data of a CSV file, reordering and selecting the obtained vector data, obtaining corresponding cut emergency plan knowledge data according to the selected vector data, carrying out deduplication processing and selection, reading a corresponding large text in the CSV file according to the selected cut emergency plan knowledge data, and generating an answer for a user according to the read large text. The emergency response efficiency and accuracy can be improved, dependence on manual intervention is reduced, and civil aviation operation safety and stability are guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of emergency question-and-answer technology, and in particular relates to an emergency plan knowledge question-and-answer method, system, and device. Background Art

[0002] In recent years, with the rapid development of the aviation industry, the civil aviation computer transaction system has become an important tool for airlines and airports to operate. The system is used to manage flight information, passenger reservations, baggage handling, etc. However, due to the complexity of the system and the high risk of aviation operations, any system failure may lead to serious operational interruptions and economic losses. Therefore, it is particularly important to develop an effective emergency plan to deal with possible system failures.

[0003] Traditional emergency plans are usually manually written by professionals based on experience and preset fault scenarios. These plans are relatively effective in dealing with specific known problems, but the limitations of traditional methods gradually emerge when faced with sudden, complex and diverse faults. The search and execution of plan scenarios are often time-consuming and inefficient, and require high professional quality of personnel, making it difficult to respond quickly in emergency situations.

[0004] The development of artificial intelligence, especially large language models, has provided new solutions to these challenges. Large language models can understand and generate natural language texts by learning from massive text data, and have powerful semantic understanding and intelligent question-answering capabilities. The Chinese patent "Interactive Emergency Plan Automatic Generation Method, Device, Equipment and Storage Medium" with publication number CN117454852A discloses an interactive emergency plan automatic generation method, device, equipment and storage medium, which extracts text from the emergency plan sample library through a well-trained generator, thereby realizing the automatic generation of initial emergency plans. In actual applications, this solution has the disadvantages of being time-consuming, inefficient and low in accuracy.

[0005] How to combine the advantages of large language models to provide an intelligent emergency plan question-and-answer method, respond to system failure events in real time, and provide customized emergency response suggestions and solutions based on real-time situations has become a technical problem that needs to be solved urgently. Summary of the invention

[0006] In response to the above problems, the present application provides an emergency plan knowledge question and answer method, system and device.

[0007] According to one aspect of the present application, a method for answering questions about emergency plans is provided, the method comprising:

[0008] Acquire emergency plan knowledge data, cut the acquired emergency plan knowledge data, and save the cut emergency plan knowledge data as a CSV file;

[0009] By vectorization, a vector database is constructed for the segmented emergency plan knowledge data, and a vector index is constructed for the vector data in the vector database;

[0010] Receive and optimize user questions. When performing vector retrieval on the optimized user questions, load the corresponding vector data by reading the vector index.

[0011] Reorder and select the acquired vector data, and acquire the corresponding cut emergency plan knowledge data according to the selected vector data;

[0012] The acquired and segmented emergency plan knowledge data is deduplicated and selected, the corresponding large text in the CSV file is read according to the selected segmented emergency plan knowledge data, and an answer is generated for the user according to the read large text.

[0013] Optionally, in the emergency plan knowledge question and answer method of the present application, obtaining emergency plan knowledge data and segmenting the obtained emergency plan knowledge data include:

[0014] Obtain the emergency plan knowledge loading path, and load the emergency plan knowledge file according to the acquired emergency plan knowledge loading path;

[0015] The emergency plan knowledge data is extracted from the loaded emergency plan knowledge file, and the extracted emergency plan knowledge data is segmented.

[0016] Optionally, in the emergency plan knowledge question and answer method of the present application, the cut emergency plan knowledge data is saved as a CSV file according to the loading path, including: saving the cut emergency plan knowledge data as a CSV file in the form of a dataframe data structure, wherein the large text obtained by cutting is used as the first column of the dataframe data structure, and the small text obtained by cutting is used as the remaining columns of the dataframe data structure.

[0017] Optionally, in the emergency plan knowledge question and answer method of the present application, a vector database is constructed for the segmented emergency plan knowledge data through vectorization, and a vector index is constructed for the vector data in the vector database, including: vectorizing the segmented emergency plan knowledge data through an Embedding model, constructing a vector database, and constructing corresponding vector indexes for the vector data according to the type of knowledge and storing them locally.

[0018] Optionally, in the emergency plan knowledge question-answering method of the present application, user questions are received and optimized, and when vector retrieval is performed on the optimized user questions, corresponding vector data is loaded by reading the vector index, including:

[0019] Receive questions from users, and use the large language model base to standardize and optimize the expression of questions based on prompt words;

[0020] When performing vector retrieval on the optimized user question, the vector data of the vector database is loaded by reading the vector index stored locally to obtain the corresponding vector data.

[0021] Optionally, in the emergency plan knowledge question and answer method of the present application, the acquired vector data is reordered and selected, and the corresponding cut emergency plan knowledge data is obtained based on the selected vector data, including: using a sorting model to reorder and score the acquired vector data, selecting a certain number of vector data from the sorted vector data based on the score, and obtaining the corresponding cut emergency plan knowledge data based on the selected vector data.

[0022] Optionally, in the emergency plan knowledge question and answer method of the present application, the acquired cut emergency plan knowledge data is deduplicated and selected, and the corresponding large text in the CSV file is read according to the selected cut emergency plan knowledge data, including: deduplicating the acquired cut emergency plan knowledge data, selecting a certain number of cut emergency plan knowledge data from the deduplicated data according to the scores, and reading the corresponding large text content in the CSV file according to the selected cut emergency plan knowledge data.

[0023] Optionally, in the emergency plan knowledge question and answer method of the present application, answers are generated for users based on the read large text, including: using the read large text content as context, calling a large language model base to generate answers for user questions, and returning the generated answers to the user.

[0024] According to a second aspect of the present application, an emergency plan knowledge question and answer system is provided, the system comprising a knowledge question and answer server, the knowledge question and answer server comprising:

[0025] The emergency plan knowledge processing module is used to obtain emergency plan knowledge data, segment the acquired emergency plan knowledge data, and save the segmented emergency plan knowledge data as a CSV file; construct a vector database for the segmented emergency plan knowledge data through vectorization, and construct a vector index for the vector data in the vector database;

[0026] The emergency plan knowledge question and answer module is used to receive and optimize user questions. When performing vector retrieval on the optimized user questions, the corresponding vector data is loaded by reading the vector index; the obtained vector data is reordered and selected, and the corresponding segmented emergency plan knowledge data is obtained according to the selected vector data; the obtained segmented emergency plan knowledge data is deduplicated and selected, and the corresponding large text in the CSV file is read according to the selected segmented emergency plan knowledge data, and an answer is generated for the user based on the read large text.

[0027] According to a third aspect of the present application, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect of the present application when executing the program.

[0028] The emergency plan knowledge question and answer method, system and device of the present application have the following beneficial technical effects:

[0029] 1. Improve the efficiency and accuracy of emergency response: Through the rapid search and real-time question-answering support of the large language model, it is possible to quickly generate corresponding response strategies when a failure occurs in the civil aviation computer trading system, greatly improving the efficiency and accuracy of emergency response;

[0030] 2. Adapt to complex fault scenarios: The emergency plan knowledge data is constructed based on emergency data and multi-source information from large-scale civil aviation transaction computing systems. It has a wide coverage and can adapt to ever-changing complex and unknown fault situations, thus enhancing the system's robustness and emergency handling capabilities.

[0031] 3. Reduce reliance on manual intervention: Through automated question-and-answer functions, reduce reliance on manual intervention, reduce labor costs, provide 24 / 7 emergency support, and ensure that failures can be quickly responded to at any time;

[0032] 4. Ensure the safety and stability of civil aviation operations. By improving fault handling efficiency and reducing economic losses, it provides a strong guarantee for the safety and stability of civil aviation operations. It has broad application prospects and development potential in the civil aviation field and has important practical application value.

[0033] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures indicated in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0035] Figure 1 This is an example diagram of the architecture of an emergency plan knowledge question and answer system according to an embodiment of the present application;

[0036] Figure 2 This is an example diagram of the architecture of a knowledge question and answer server of an emergency plan knowledge question and answer system according to an embodiment of the present application;

[0037] Figure 3 This is an example diagram of the operating principle of an emergency plan knowledge question and answer system according to an embodiment of the present application;

[0038] Figure 4 A flowchart of the steps of an emergency plan knowledge question and answer method according to an embodiment of the present application;

[0039] Figure 5 This is an example diagram of executing an emergency plan knowledge question and answer method according to an embodiment of the present application;

[0040] Figure 6 Another example diagram of executing an emergency plan knowledge question-answering method according to an embodiment of the present application;

[0041] Figure 7 This is an example of the Nginx server emergency plan knowledge analysis result obtained according to the emergency plan knowledge question and answer method of the embodiment of the present application;

[0042] Figure 8 A schematic diagram of the structure of the device provided in this application. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0044] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.

[0045] Figure 1 FIG. 1 is a schematic diagram of an architecture of an emergency plan knowledge question and answer system according to an embodiment of the present application. Figure 1 As shown, the system may include a knowledge question answering server 101, a communication network 102 and / or one or more knowledge question answering clients 103. Figure 1 The example shown is a plurality of knowledge question and answer clients 103 .

[0046] The knowledge question and answer server 101 can be any suitable server for storing information, data, programs and / or any other suitable type of content. In some embodiments, the knowledge question and answer server 101 can perform appropriate functions. For example, in some embodiments, the knowledge question and answer server 101 can be used for emergency plan knowledge questions and answers. As an optional example, in some embodiments, the knowledge question and answer server 101 can be used to implement emergency plan knowledge questions and answers by building a vector database. For example, the knowledge question and answer server 101 can be used to: obtain emergency plan knowledge data, segment the acquired emergency plan knowledge data, and save the segmented emergency plan knowledge data as a CSV file; construct a vector database for the segmented emergency plan knowledge data through vectorization, and construct a vector index for the vector data in the vector database; receive and optimize user questions, and when performing vector retrieval on the optimized user questions, load the corresponding vector data by reading the vector index; reorder and select the acquired vector data, and obtain the corresponding segmented emergency plan knowledge data based on the selected vector data; deduplicate and select the acquired segmented emergency plan knowledge data, read the corresponding large text in the CSV file based on the selected segmented emergency plan knowledge data, and generate answers for the user based on the read large text.

[0047] As another example, in some embodiments, the knowledge question and answer server 101 may send the emergency plan knowledge question and answer method to the knowledge question and answer client 103 for user use based on the request of the knowledge question and answer client 103 .

[0048] Figure 2FIG. 1 is an example diagram of the architecture of a knowledge question and answer server of an emergency plan knowledge question and answer system according to an embodiment of the present application. Figure 3 FIG. 1 is an example diagram of the operating principle of an emergency plan knowledge question and answer system according to an embodiment of the present application. Figure 2 and Figure 3 As shown, the knowledge question and answer server of this embodiment is composed of an emergency plan knowledge processing module and an emergency plan knowledge question and answer module.

[0049] The emergency plan knowledge processing module of the present embodiment is used to obtain emergency plan knowledge data, cut the acquired emergency plan knowledge data, and save the cut emergency plan knowledge data as a CSV file; construct a vector database for the cut emergency plan knowledge data through vectorization, and construct a vector index for the vector data in the vector database. The CSV file of the present embodiment is called Comma-Separated Values ​​file. The CSV file is stored in plain text form. The data therein is usually separated by commas and can be recognized and processed by most spreadsheet software and database programs. It is used to store tabular data. In the present embodiment, after directly obtaining the full text, that is, reading the text data formed by all the text contents obtained from a single emergency plan knowledge file, a large amount of data or large text is cut into smaller and more meaningful parts through cutting, so as to more effectively process and apply the data.

[0050] As an optional example, the emergency plan knowledge processing module of this embodiment is composed of an emergency plan knowledge parsing unit, a data vector unit and a vector index construction unit. The emergency plan knowledge parsing unit is used to obtain the emergency plan knowledge loading path, load the emergency plan knowledge file according to the acquired emergency plan knowledge loading path, extract the emergency plan knowledge data from the loaded emergency plan knowledge file, cut the extracted emergency plan knowledge data, and save the cut emergency plan knowledge data as a CSV file according to the loading path. The data vector unit is used to vectorize the cut emergency plan knowledge data through the Embedding model to build a vector database. The vector index construction unit is used to build a corresponding vector index for the vector data according to the type of knowledge and store it locally. The Embedding model of this embodiment refers to a machine learning model or a neural network model, which is used to map high-dimensional input data (such as text, images, audio, etc.) to a low-dimensional continuous vector space. These vectors are called embeddings. This mapping process helps to capture the semantics and features of the data, making the data easier to process and understand in the computer.

[0051] The emergency plan knowledge question and answer module of this embodiment is used to receive and optimize user questions. When performing vector retrieval on the optimized user questions, the corresponding vector data is loaded by reading the vector index; the obtained vector data is reordered and selected, and the corresponding segmented emergency plan knowledge data is obtained according to the selected vector data; the obtained segmented emergency plan knowledge data is deduplicated and selected, and the corresponding large text in the CSV file is read according to the selected segmented emergency plan knowledge data, and an answer is generated for the user based on the read large text.

[0052] As an optional example, the emergency plan knowledge question and answer module of this embodiment is composed of a question receiving optimization unit, a vector retrieval unit, a vector index reading unit, a result reordering unit and a knowledge tracing unit. The question receiving optimization unit is used to receive questions raised by users, and use a large language model base to standardize and optimize the expression of questions raised by users according to prompt words. The vector retrieval unit performs vector retrieval on the optimized questions. The vector index reading unit is used to load the vector data of the vector database by reading the vector index stored locally when performing vector retrieval on the optimized user questions, and obtain the corresponding vector data. The result reordering unit is used to use a sorting model to reorder and score the acquired vector data, select a certain number of vector data from the sorted vector data according to the score, and obtain the corresponding segmented emergency plan knowledge data according to the selected vector data. The knowledge tracing unit is used to deduplicate the acquired segmented emergency plan knowledge data, select a certain number of segmented emergency plan knowledge data from the deduplicated data according to the score, read the corresponding large text content in the CSV file according to the selected segmented emergency plan knowledge data, use the read large text content as context, call the large language model base to generate answers for user questions, and return the generated answers to the user. The large language model base of this embodiment is an artificial intelligence system that can process and generate natural language text, such as by deploying the Qwen1.5-72B large language model on the server to achieve basic dialogue capabilities, integrate retrieval and generation models through RAG (Retrieval-Augmented Generation), and use retrieval to assist in generating text to improve the quality and relevance of the generated text.

[0053] As an optional example, in some embodiments, the knowledge question and answer client 103 is used to provide a visual question and answer interface, which is used to receive the user's selection input operation for emergency plan knowledge questions and answers, and to respond to the selection input operation, obtain the question and answer interface corresponding to the option selected by the selection input operation from the knowledge question and answer server 101 and display the question and answer interface, wherein the question and answer interface at least displays information on emergency plan knowledge questions and operation options for the information on emergency plan knowledge questions and answers.

[0054] In some embodiments, the communication network 102 can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network 102 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN), and / or any other suitable communication network. The knowledge question and answer client 103 can be connected to the communication network 102 via one or more communication links (e.g., communication link 104), and the communication network 102 can be linked to the knowledge question and answer server 101 via one or more communication links (e.g., communication link 105). The communication link can be any communication link suitable for transmitting data between the knowledge question and answer client 103 and the knowledge question and answer server 101, such as a network link, a dial-up link, a wireless link, a hard-wired link, any other suitable communication link, or any suitable combination of such links.

[0055] The knowledge question and answer client 103 may include any one or more clients that present an interface related to customizing and sorting the fare search results in an appropriate form for use and operation by the user. In some embodiments, the knowledge question and answer client 103 may include any suitable type of device. For example, in some embodiments, the knowledge question and answer client 103 may include a mobile device, a tablet computer, a laptop computer, a desktop computer, and / or any other suitable type of client device.

[0056] Although the knowledge question answering server 101 is illustrated as one device, in some embodiments, any suitable number of devices may be used to perform the functions performed by the knowledge question answering server 101. For example, in some embodiments, multiple devices may be used to implement the functions performed by the knowledge question answering server 101. Alternatively, a cloud service may be used to implement the functions of the knowledge question answering server 101.

[0057] Based on the above system, an embodiment of the present application provides an emergency plan knowledge question and answer method, which is illustrated by the following embodiments.

[0058] Figure 4 is a flowchart of the steps of an emergency plan knowledge question and answer method according to an embodiment of the present application. The emergency plan knowledge question and answer method of this embodiment can be executed on the knowledge question and answer server, such as Figure 4 As shown, the emergency plan knowledge question and answer method includes the following steps:

[0059] Step S201: Acquire emergency plan knowledge data, segment the acquired emergency plan knowledge data, and save the segmented emergency plan knowledge data as a CSV file.

[0060] Figure 5 FIG. 1 is an example diagram of executing an emergency plan knowledge question-answering method according to an embodiment of the present application, such as Figure 5 As shown, as an optional example, this embodiment obtains an emergency plan knowledge loading path, loads an emergency plan knowledge file according to the acquired emergency plan knowledge loading path; extracts emergency plan knowledge data from the loaded emergency plan knowledge file, and cuts the extracted emergency plan knowledge data. The emergency plan knowledge files of this embodiment include files in formats such as Word, HTLM, PDF, and pictures. Various types of emergency plan knowledge files are derived from emergency plans of various civil aviation computer trading software. For example, this embodiment reads emergency plan knowledge according to different software of the civil aviation computer trading system, and uses Python's BeautifulSoup, pytesseract, Python-docx, and pdfplumber libraries to read HTLM, Word, PDF, and picture content. In practical applications, Python is a widely used high-level programming language that supports multiple programming paradigms, including object-oriented, imperative, functional, and procedural programming. The BeautifulSoup library is a Python library for parsing HTML and XML documents; pytesseract is a Python library that serves as a wrapper for Google's Tesseract-OCR engine, allowing users to easily call Tesseract in Python programs for optical character recognition (OCR); Python-docx is a Python library that allows users to create, modify, and extract the contents of Word documents (.docx files); the pdfplumber library is a Python library specifically for extracting text and table data from PDF files.

[0061] After cutting the acquired emergency plan knowledge data, this embodiment saves the cut emergency plan knowledge data as a CSV file in the form of a dataframe data structure, wherein the large text obtained by cutting is used as the first column of the dataframe data structure, and the small text obtained by cutting is used as the remaining columns of the dataframe data structure. For example, in actual applications, this embodiment performs text cutting on the emergency plan content belonging to each software according to each software division, uses the large text before cutting as the first column of the dataframe data structure, and uses the small text after cutting as the second column and the remaining columns, and saves it as a CSV file according to the file path of the emergency plan knowledge file. The dataframe data structure of this embodiment is used for data analysis and processing, and is a two-dimensional labeled data structure, similar to a table in a spreadsheet or database, in which data is organized in the form of rows and columns.

[0062] Step S202: construct a vector database for the segmented emergency plan knowledge data through vectorization, and construct a vector index for the vector data in the vector database.

[0063] like Figure 5 As shown, as an optional example, this embodiment vectorizes the emergency plan knowledge data after segmentation through the Embedding model, constructs a vector database, constructs corresponding vector indexes for the vector data according to the knowledge type and stores them locally. For example, this embodiment uses the Langchain framework to vectorize the emergency plan knowledge data after segmentation through the Embedding model to construct the Faiss vector database. The Langchain framework of this embodiment is used to build a development framework for applications that can be integrated with a large language model. For example, this embodiment vectorizes different types of emergency plan knowledge and constructs it into a Faiss vector database, and constructs vector indexes in a dictionary manner for subsequent index reading. The types of knowledge in this embodiment can be distinguished according to the software types of the civil aviation computer trading system. The Faiss vector database of this embodiment is an open source vector database used for efficient similarity search and clustering, processing large-scale vector data, and quickly searching for nearest neighbors, similar vectors, and cluster analysis tasks.

[0064] For example, in this embodiment, the small text content in the CSV file is vectorized using the bce-embedding-base_v1 model, and the CSV file path and number of rows where the content is located are stored locally in the metadata mode and pickle in the format of {software name_index: Faiss vector data} dictionary, forming a "data_index.pkl" vector index file, so as to find the large text before cutting through the small text after cutting. In this embodiment, the bce-embedding-base_v1 model is used to generate semantic vectors. Metadata is usually used to provide additional information when processing and managing data. Additional information about data sources, data types, data features, etc. can be provided. This information can help better understand and process data. Pickle is one of Python's standard libraries, used to serialize and deserialize Python objects, that is, convert Python objects into byte streams, and convert byte streams back to Python objects.

[0065] In actual applications, when a user asks a question: How to deal with Nginx server downtime? This question involves a lot of large text content of emergency plan knowledge, including: "1. How to deal with Nginx server downtime; 2. How to deal with ordinary server downtime, etc." Since "2. How to deal with ordinary server downtime" is irrelevant to the question, if this particularly long text is directly searched by vector, the score will be lower than the score after cutting, affecting the ranking. If this long text is cut into "How to deal with Nginx server downtime" and "How to deal with ordinary server downtime", then the ranking score of "How to deal with Nginx server downtime" will be very high, which can avoid the loss of key text content due to the low vector search score of the text being too long, resulting in poor answering effect.

[0066] Step S203: receiving and optimizing the user question, and when performing vector retrieval on the optimized user question, loading the corresponding vector data by reading the vector index.

[0067] Figure 6 FIG. 2 is another example diagram of executing an emergency plan knowledge question-answering method according to an embodiment of the present application. Figure 6 As shown, as an optional example, this embodiment receives questions raised by users, and uses a large language model base to standardize and optimize the expression of the questions raised by users according to prompt words. In actual applications, this embodiment uses a large language model base to optimize the questions raised by users according to prompt words, and through optimization, the questions raised by users are expressed in a more professional and standardized manner.

[0068] For example, this embodiment uses the prompt "You are a civil aviation computer trading system maintenance engineer. Please optimize the user problem: {user problem} from a professional perspective, and provide three optimized problems in the format of {'problem 1: optimized problem 1, problem 2: optimized problem 2'}. The current civil aviation computer trading system includes three software: APP1, APP2, and APP3. Please indicate which software the problem should belong to in the format of {'software': 'APP1'}."

[0069] When performing vector retrieval on the optimized user question, the corresponding vector data is obtained by reading the vector data of the vector database stored in the local vector index loading. It should be noted that this embodiment selects the quantity of the retrieved vector data according to the actual application scenario and business needs, such as obtaining the first 512 vector data from the retrieval results according to the similarity score.

[0070] For example, this embodiment uses pickle to read the processed vector index file saved locally. For example, the file content is:

[0071] {'APP1_index':<langchain_community.vectorstores.faiss.FAISS object at0x7fc64b3b74c0> ,

[0072] 'APP2_index':<langchain_community.vectorstores.faiss.FAISS object at0x7fc64b3bd8a0>}.

[0073] Furthermore, this embodiment can also use a suitable algorithm such as the BM25 algorithm to recall the selected 512 vector data and select the top 256 texts as the search results. The BM25 algorithm of this embodiment is a ranking function based on a probabilistic information retrieval model, which is used for document retrieval tasks in search engines and text matching tasks, and can effectively calculate the relevance between documents and queries.

[0074] Step S204: reorder and select the acquired vector data, and acquire the corresponding cut emergency plan knowledge data according to the selected vector data.

[0075] As an optional example, this embodiment uses a sorting model to re-sort and score the acquired vector data, selects a certain number of vector data from the sorted vector data according to the score, and obtains the corresponding segmented emergency plan knowledge data according to the selected vector data. For example, this embodiment can use a Rerank model to re-sort the acquired vector data according to the questions raised by the user, for example, taking the top 10 vector data with high scores according to the score. The Rerank model of this embodiment is used to re-sort candidates or generate results. The purpose of re-ranking in this embodiment is to optimize the original generation or retrieval results by introducing additional models or standards to improve the final quality or meet specific goals.

[0076] For example, in this embodiment, the bce-reranker-base_v1 model is used to re-rank the above 256 search results, and the re-ranked result is a small text. In this embodiment, the bce-reranker-base_v1 model is a Chinese-English bilingual and cross-language semantic representation algorithm model library, which is used to optimize semantic search results and semantic related order precision ranking.

[0077] Step S205: deduplicate and select the acquired segmented emergency plan knowledge data, read the corresponding large text in the CSV file according to the selected segmented emergency plan knowledge data, and generate an answer for the user according to the read large text.

[0078] As an optional embodiment, this embodiment performs deduplication processing on the acquired cut emergency plan knowledge data, selects a certain number of cut emergency plan knowledge data from the deduplication processed data according to the score, and reads the corresponding large text content in the CSV file according to the selected cut emergency plan knowledge data. The read large text content is used as the context, the large language model base is called to generate answers for user questions, and the generated answers are returned to the user. For example, this embodiment performs knowledge tracing on the vector data selected after rearrangement, and reads the first column of the saved CSV file to obtain the large text content. For example, 5 large texts are selected, and these 5 large texts are used as the context. Combined with the user's question, the large language model base is called to generate the final answer, and the generated answer is returned to the user. For example, this embodiment establishes an empty list to store the CSV file path and number of rows corresponding to the small text (used to obtain the large text corresponding to the small text). The loop obtains the file path and number of rows from metadata according to the order of the Rerank model sorting results and adds them to the list to remove duplicates. Exit the loop until the list length is greater than 5. At this time, 5 different large texts with the highest relevance to the question can be obtained. The five large texts obtained above and the user's question are used to form a context to call the large model base to obtain the final answer to the question, which is fed back to the front end and displayed to the user.

[0079] The emergency plan knowledge question and answer method of this embodiment is further described in detail in a specific scenario below.

[0080] Scenario 1:

[0081] The civil aviation computer trading system includes three softwares: APP1, APP2 and APP3;

[0082] Knowledge document storage path: / opt / app / document / ;

[0083] The processed CSV file is stored in / opt / app / new_document / .

[0084] Knowledge document directory structure:

[0085] / opt / app / document / APP1 / Nginx Server Emergency Plan.docx

[0086] / opt / app / document / APP1 / Server Downtime Emergency Plan.docx

[0087] / opt / app / document / APP2 / Server Downtime Emergency Plan.docx

[0088] / opt / app / document / APP2 / Server Master / Slave Switching Emergency Plan.docx

[0089] / opt / app / document / APP3 / Database emergency plan.docx

[0090] Nginx server emergency plan.docx content:

[0091] 1. Nginx service restarts abnormally

[0092] Log in to the server and use SSH to log in to the server where Nginx is located. Check the status of the Nginx service: sudosystemctl status nginx. If the Nginx service is not running or the status is abnormal, try to restart the service: sudosystemctl restart nginx

[0093] 2. Server downtime processing

[0094] Contact the hardware department to try to restart the server

[0095] 3. Nginx port exception handling

[0096] Check whether the port (usually 80 or 443) that Nginx listens on is occupied: sudo netstat -tuln|grep':80\|:443'. Terminate the conflicting process: sudo kill -9 [PID]. Restart the Nginx service: sudo systemctl restartnginx.

[0097] Traverse all docx files in the / opt / app / document / folder according to the three dimensions of APP1, APP2, and APP3 to parse the text content in the files. Figure 7 This is an example of the Nginx server emergency plan knowledge analysis result obtained according to the emergency plan knowledge question and answer method of the embodiment of the present application, such as Figure 7 As shown in the figure, the first column is the large text without cutting, and the 2nd to 4th columns are the small text after cutting the large text. Figure 7 The displayed data is saved as " / opt / app / new_document / APP1 / Nginx Server Emergency Plan.csv".

[0098] Will Figure 7 2 to 4 columns of small text and its metadata (metadata content: {'file_path':' / opt / app / new_document / APP1 / Nginx server emergency plan.csv','row':1}) are added to the list named docs in the format of Document (page_content = small text, metadata = metadata). Docs are vectorized using the Embedding model and stored in the faiss vector library (<langchain_community.vectorstores.faiss.FAISSobject at0x7fc64b3b74c0> ).

[0099] Construct a vector index with the software name as the key. For example, if the software name is APP1, then the index file {'APP1_index':<langchain_community.vectorstores.faiss.FAISS object at 0x7fc64b3b74c0>} and save it locally using pickle.

[0100] The knowledge processing of APP2 and APP3 repeats the above steps and eventually forms a file named "data_index.pkl". File content:

[0101] {'APP1_index':<langchain_community.vectorstores.faiss.FAISS object at0x7f8a68395b40> ,

[0102] 'APP2_index':<langchain_community.vectorstores.faiss.FAISS object at0x7f8a3ba98640> ,

[0103] 'APP3_index':<langchain_community.vectorstores.faiss.FAISS object at0x7f8a3b7e8b80>}.

[0104] Scenario 2:

[0105] User question: "APP1 Nginx port is abnormal";

[0106] Vector database index file: data_index.pkl;

[0107] The vector index reading unit obtains the vector data by reading data_index.pkl through pickle (data_index_dict=pickle.load(data_index.pkl)).

[0108] After receiving the user question "APP1 Nginx port abnormality", the large language model base was called to optimize the problem. The optimization result was: "Question 1: How to respond to APP1 Nginx port abnormality? Question 2: How to recover from APP1 Nginx port abnormality? Question 3: How to handle APP1 Nginx port abnormality? Software: APP1".

[0109] Use data_index = data_index_dict['APP1_index'] to get the APP1 vector data. Poll questions 1 to 3 and perform vector retrieval to get the top 512 small texts (there are only three small texts in this example, but there will be tens of thousands of small texts in reality). Use the BM25 algorithm to recall the 512 results and retain the top 256 small texts.

[0110] Get the result: Embedded = ["Nginx service exception restart login server, use SSH to log in to the server where Nginx is located. Check the status of Nginx service: sudo systemctl status nginx. If the Nginx service is not running or the status is abnormal, try to restart the service: sudo systemctl restart nginx", "Nginx port exception processing confirms whether the port (usually 80 or 443) listened by Nginx is occupied: sudo netstat-tuln|grep':80\|:443'. Terminate the conflicting process: sudo kill-9 [PID]. Restart Nginx service: sudo systemctl restart nginx"], filter out the irrelevant "server downtime processing".

[0111] Use the Rerank model to re-rank the results of Embedded. The result is:

[0112] Reranked = ["Nginx port exception handling Confirm whether the port (usually 80 or 443) listened by Nginx is occupied: sudo netstat-tuln|grep':80\|:443'. Terminate the conflicting process: sudo kill-9 [PID]. Restart Nginx service: sudo systemctl restart nginx", "Nginx service exception restart login server, use SSH to log in to the server where Nginx is located. Check the status of Nginx service: sudo systemctl status nginx. If the Nginx service is not running or the status is abnormal, try to restart the service: sudo systemctl restart nginx"]. After reordering, the most relevant one is ranked first.

[0113] Create a metadata_list = []. Traverse the Reranked results (sorted, the first one has the highest score), obtain its metadata at the same time, and add the metadata to metadata_list. De-duplicate metadata_list until metadata_list has 5 different metadata. Read the large text in the CSV file by traversing the file_path and row in metadata_list (metadata_list content: ['file_path':' / opt / app / new_document / APP1 / Nginx server emergency plan.csv','row':1},'file_path':' / opt / app / new_document / APP1 / Nginx server emergency plan.csv','row':1}]) to complete knowledge tracing. Use all the large text in the above results as context and combine it with the user question to call the large language model base and return:

[0114] "The steps for handling Nginx port exceptions are as follows: Confirm whether the port (usually 80 or 443) listened by Nginx is occupied: sudo netstat-tuln|grep':80\|:443'. Terminate the conflicting process: sudo kill-9 [PID]. Restart the Nginx service: sudo systemctl restart nginx"

[0115] This is used as the final answer and returned to the dialogue front end for display to the user.

[0116] The emergency plan knowledge question and answer method and system of the embodiment of the present application have the following beneficial technical effects:

[0117] 1. Improve the efficiency and accuracy of emergency response: Through the rapid search and real-time question-answering support of the large language model, it is possible to quickly generate corresponding response strategies when a failure occurs in the civil aviation computer trading system, greatly improving the efficiency and accuracy of emergency response;

[0118] 2. Adapt to complex fault scenarios: The emergency plan knowledge data is constructed based on emergency data and multi-source information from large-scale civil aviation transaction computing systems. It has a wide coverage and can adapt to ever-changing complex and unknown fault situations, thus enhancing the system's robustness and emergency handling capabilities.

[0119] 3. Reduce reliance on manual intervention: Through automated question-and-answer functions, reduce reliance on manual intervention, reduce labor costs, provide 24 / 7 emergency support, and ensure that failures can be quickly responded to at any time;

[0120] 4. Ensure the safety and stability of civil aviation operations. By improving fault handling efficiency and reducing economic losses, it provides a strong guarantee for the safety and stability of civil aviation operations. It has broad application prospects and development potential in the civil aviation field and has important practical application value.

[0121] like Figure 8 As shown, the present application also provides a device, including a processor 310, a communication interface 320, a memory 330 for storing a processor executable computer program, and a communication bus 340. The processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 implements the above-mentioned emergency plan knowledge question and answer method by running the executable computer program.

[0122] Among them, the computer program in the memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0123] The system embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected based on actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.

[0124] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

[0125] Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that it is still possible to modify the technical solutions described in the aforementioned embodiments, or to make equivalent replacements for some of the technical features therein; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for answering questions about emergency plans, characterized in that: The method comprises: Acquire emergency plan knowledge data, cut the acquired emergency plan knowledge data, and save the cut emergency plan knowledge data as a CSV file; By vectorization, a vector database is constructed for the segmented emergency plan knowledge data, and a vector index is constructed for the vector data in the vector database; Receive and optimize user questions. When performing vector retrieval on the optimized user questions, load the corresponding vector data by reading the vector index. Reorder and select the acquired vector data, and acquire the corresponding cut emergency plan knowledge data according to the selected vector data; The acquired and segmented emergency plan knowledge data is deduplicated and selected, the corresponding large text in the CSV file is read according to the selected segmented emergency plan knowledge data, and an answer is generated for the user according to the read large text.

2. The emergency plan knowledge question and answer method according to claim 1, characterized in that: Acquire emergency plan knowledge data, and segment the acquired emergency plan knowledge data, including: Obtain the emergency plan knowledge loading path, and load the emergency plan knowledge file according to the acquired emergency plan knowledge loading path; The emergency plan knowledge data is extracted from the loaded emergency plan knowledge file, and the extracted emergency plan knowledge data is segmented.

3. The emergency plan knowledge question and answer method according to claim 1, characterized in that: The emergency plan knowledge data after cutting is saved as a CSV file according to the loading path, including: the emergency plan knowledge data after cutting is saved as a CSV file in the form of a dataframe data structure, wherein the large text obtained by cutting is used as the first column of the dataframe data structure, and the small text obtained by cutting is used as the remaining columns of the dataframe data structure.

4. The emergency plan knowledge question and answer method according to claim 1, characterized in that: A vector database is constructed for the segmented emergency plan knowledge data through vectorization, and a vector index is constructed for the vector data in the vector database, including: vectorizing the segmented emergency plan knowledge data through an Embedding model, constructing a vector database, and constructing corresponding vector indexes for the vector data according to the type of knowledge and storing them locally.

5. The emergency plan knowledge question and answer method according to claim 1, characterized in that: Receive and optimize user questions. When performing vector retrieval on the optimized user questions, load the corresponding vector data by reading the vector index, including: Receive questions from users, and use the large language model base to standardize and optimize the expression of questions based on prompt words; When performing vector retrieval on the optimized user question, the vector data of the vector database is loaded by reading the vector index stored locally to obtain the corresponding vector data.

6. The emergency plan knowledge question and answer method according to claim 1, characterized in that: The acquired vector data are reordered and selected, and corresponding emergency plan knowledge data after segmentation is acquired according to the selected vector data, including: reordering and scoring the acquired vector data using a sorting model, selecting a certain number of vector data from the sorted vector data according to the scoring, and acquiring corresponding emergency plan knowledge data after segmentation according to the selected vector data.

7. The emergency plan knowledge question and answer method according to claim 1, characterized in that: The acquired cut emergency plan knowledge data is deduplicated and selected, and the corresponding large text in the CSV file is read according to the selected cut emergency plan knowledge data, including: deduplicating the acquired cut emergency plan knowledge data, selecting a certain number of cut emergency plan knowledge data from the deduplicated data according to the scores, and reading the corresponding large text content in the CSV file according to the selected cut emergency plan knowledge data.

8. The emergency plan knowledge question and answer method according to claim 1, characterized in that: Generate answers for users based on the read large text, including: using the read large text content as context, calling the large language model base to generate answers for user questions, and returning the generated answers to the user.

9. An emergency plan knowledge question and answer system, characterized in that: The system includes a knowledge question answering server, and the knowledge question answering server includes: The emergency plan knowledge processing module is used to obtain emergency plan knowledge data, segment the acquired emergency plan knowledge data, and save the segmented emergency plan knowledge data as a CSV file; construct a vector database for the segmented emergency plan knowledge data through vectorization, and construct a vector index for the vector data in the vector database; The emergency plan knowledge question and answer module is used to receive and optimize user questions. When performing vector retrieval on the optimized user questions, the corresponding vector data is loaded by reading the vector index; the obtained vector data is reordered and selected, and the corresponding segmented emergency plan knowledge data is obtained according to the selected vector data; the obtained segmented emergency plan knowledge data is deduplicated and selected, and the corresponding large text in the CSV file is read according to the selected segmented emergency plan knowledge data, and an answer is generated for the user based on the read large text.

10. A computer device, characterized in that: The computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method according to any one of claims 1 to 8 when executing the program.

Citation Information

Patent Citations

  • Interactive emergency plan automatic generation method and device, equipment and storage medium

    CN117454852A

Cited By

  • Emergency plan generation method and device and electronic equipment

    CN120723893A

  • Water environment emergency treatment method and system and electronic equipment

    CN122332389A