Contextual query based interactive text generation method and device, equipment and medium

CN122986008APending Publication Date: 2026-10-27CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611336751.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0005]本发明的主要目的在于提供一种基于上下文查询的交互文本生成方法、装置、设备及存储介质,旨在解决现有技术难以对不完整的交互信息和多源业务数据进行关联处理,导致服务资源匹配不准确的技术问题

Benefits of technology

[0010]有益效果:本发明涉及语义解析技术领域,公开了一种基于上下文查询的交互文本生成方法、装置、设备及介质,包括:基于自然语言输入文本、前序历史对话文本和当前会话元数据生成上下文查询数据,识别查询意图并补全缺失实体信息,生成标准查询数据;基于标准查询数据进行知识检索和业务查询,并利用知识图谱进行实体关联、关系路径遍历和资源筛选,生成目标服务资源数据及融合上下文数据;基于融合上下文数据生成回复提示数据,利用语言生成模型生成初始交互文本,经业务合规校验、实体格式校验和禁止内容校验后,确定目标交互文本。本发明可应用于金融科技及医疗健康等业务场景中,通过补全交互信息并融合知识数据、业务数据和知识图谱数据,提高服务资源匹配的准确性;通过基于融合上下文生成交互文本并进行内容校验,减少不符合业务要求的文本输出,提高交互回复的可靠性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122986008A_ABST
    Figure CN122986008A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of semantic parsing, and discloses an interactive text generation method and device based on context queries, equipment and a medium, which comprises the following steps: identifying a query intention and completing missing entities based on natural language input, historical dialogue and conversation metadata, generating standard query data; performing knowledge retrieval and business query, utilizing a knowledge graph to complete entity association, relationship path traversal and resource screening, generating target service resource data and fusion context data; generating reply prompt data and initial interactive text based on the fusion context data, and determining target interactive text after business compliance, entity format and prohibited content verification. The application can be applied to financial technology and medical health business scenarios, can improve service resource matching accuracy by completing interactive information and fusing knowledge data, business data and graph data, and can improve interactive reply reliability by performing content verification on the generated text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of semantic parsing technology, and in particular to an interactive text generation method, apparatus, device, and medium based on context query. Background Technology

[0002] With the application of intelligent interaction technology in professional service scenarios, existing interaction systems typically handle historical dialogues, knowledge retrieval, business data queries, and service resource queries separately, lacking effective connections between different data. When natural language input contains ellipsis, missing information, or colloquial expressions, the system struggles to form a complete query based on historical dialogues and the current business status. It also struggles to uniformly analyze the retrieved knowledge content, dynamic business data, and the relationship with service resources, leading to inconsistencies between service resource matching results and the actual needs of the interacting user.

[0003] In the fintech sector, intelligent customer service is widely used in scenarios such as insurance claims, business progress inquiries, and service provider searches. Existing systems typically retrieve general instructions from a policy knowledge base and separately query customer information, case status, vehicle information, and geographical location from the business system, resulting in a disconnect between knowledge data and business data. When users inquire with incomplete information such as "Can I handle this now?" or "What institutions are nearby?", the system struggles to complete the query based on previous conversations and to correlate policy requirements, customer conditions, case status, and service provider qualifications, thus failing to accurately filter service resources that match the current business conditions.

[0004] In the healthcare sector, intelligent interactive systems are typically used for health consultations, appointment booking, follow-up visit guidance, and access to medical service resources. Existing systems often retrieve medical knowledge, check treatment status, and obtain medical institution information separately, making it difficult to correlate a patient's past consultation content, current treatment stage, location, and the service capabilities of the medical institution. When patients input missing symptoms, department information, or treatment stage, the system tends to return generic content based on incomplete information, failing to accurately identify medical service resources that match their current consultation needs and treatment status. Summary of the Invention

[0005] The main objective of this invention is to provide a method, apparatus, device, and storage medium for generating interactive text based on context query, aiming to solve the technical problem that existing technologies are unable to perform correlation processing on incomplete interactive information and multi-source business data, resulting in inaccurate matching of service resources.

[0006] To achieve the above objectives, the present invention provides an interactive text generation method based on context query, comprising: Receive natural language input text, obtain previous historical dialogue text and current session metadata, and generate context query data based on the natural language input text, the previous historical dialogue text and the current session metadata; Based on the context query data, the query intent is identified and missing entity information is filled in to generate standard query data; Based on the standard query data, knowledge retrieval and business queries are performed to generate knowledge retrieval data and business retrieval data. Acquire knowledge graph data, perform entity association, relationship path traversal and resource filtering based on the knowledge retrieval data, the business retrieval data and the knowledge graph data, generate target service resource data, and generate fusion context data based on the knowledge retrieval data, the business retrieval data and the target service resource data; Based on the context query data and the fused context data, response prompt data is generated, and the response prompt data is input into the language generation model to generate initial interactive text; Obtain content verification data, perform business compliance verification, entity format verification, and prohibited content verification on the initial interactive text based on the content verification data, generate content verification results, and determine the target interactive text based on the content verification results.

[0007] Furthermore, to achieve the above objectives, the present invention provides an interactive text generation apparatus based on context query, comprising: The context query generation module is used to receive natural language input text, obtain previous historical dialogue text and current session metadata, and generate context query data based on the natural language input text, the previous historical dialogue text and the current session metadata; The query standardization module is used to identify the query intent based on the context query data and fill in the missing entity information to generate standard query data. The dual-line retrieval module is used to perform knowledge retrieval and business query based on the standard query data, and generate knowledge retrieval data and business retrieval data. The knowledge graph resource matching module is used to acquire knowledge graph data, perform entity association, relationship path traversal and resource filtering based on the knowledge retrieval data, the business retrieval data and the knowledge graph data, generate target service resource data, and generate fusion context data based on the knowledge retrieval data, the business retrieval data and the target service resource data; An interactive text generation module is used to generate response prompt data based on the context query data and the fused context data, and input the response prompt data into a language generation model to generate initial interactive text. The content verification module is used to acquire content verification data, perform business compliance verification, entity format verification, and prohibited content verification on the initial interactive text based on the content verification data, generate content verification results, and determine the target interactive text based on the content verification results.

[0008] Furthermore, to achieve the above objectives, the present invention also provides a computer device, the computer device including a memory, a processor, and a context-based interactive text generation program stored in the memory and executable on the processor, wherein when the context-based interactive text generation program is executed by the processor, it implements the steps of the context-based interactive text generation method as described above.

[0009] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a context-based interactive text generation program, wherein the context-based interactive text generation program, when executed by a processor, implements the steps of the context-based interactive text generation method as described above.

[0010] Beneficial Effects: This invention relates to the field of semantic parsing technology and discloses a method, apparatus, device, and medium for generating interactive text based on contextual queries. The method includes: generating contextual query data based on natural language input text, previous historical dialogue text, and current session metadata; identifying the query intent and completing missing entity information to generate standard query data; performing knowledge retrieval and business queries based on the standard query data; and using a knowledge graph for entity association, relationship path traversal, and resource filtering to generate target service resource data and fused contextual data; generating response prompt data based on the fused contextual data; generating initial interactive text using a language generation model; and determining the target interactive text after business compliance verification, entity format verification, and prohibited content verification. This invention can be applied to business scenarios such as fintech and healthcare. By completing interactive information and fusing knowledge data, business data, and knowledge graph data, it improves the accuracy of service resource matching; by generating interactive text based on the fused context and performing content verification, it reduces text output that does not meet business requirements and improves the reliability of interactive responses. Attached Figure Description

[0011] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings: Figure 1 This is a schematic diagram of an application environment for an interactive text generation method based on context query in one embodiment of the present invention; Figure 2 This is a flowchart illustrating an embodiment of the interactive text generation method based on context query of the present invention; Figure 3 for Figure 2A detailed flowchart of step S10; Figure 4 for Figure 2 A detailed flowchart of step S20; Figure 5 for Figure 2 A detailed flowchart of step S30; Figure 6 for Figure 2 A detailed flowchart of step S40; Figure 7 for Figure 2 A detailed flowchart of step S50; Figure 8 for Figure 2 A detailed flowchart of step S60; Figure 9 This is a schematic diagram of the functional modules of a preferred embodiment of the interactive text generation device based on context query of the present invention. Figure 10 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention; Figure 11 This is another structural schematic diagram of a computer device according to one embodiment of the present invention. Detailed Implementation

[0012] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0013] The context-based interactive text generation method provided in this invention can be applied to, for example... Figure 1In this application environment, the client communicates with the server via a network. The server can generate contextual query data based on the client's natural language input text, previous historical dialogue text, and current session metadata. It identifies the query intent, completes missing entity information, and generates standard query data. Based on the standard query data, it performs knowledge retrieval and business queries, and utilizes a knowledge graph for entity association, relationship path traversal, and resource filtering to generate target service resource data and fused context data. Based on the fused context data, it generates response prompt data, uses a language generation model to generate initial interaction text, and determines the target interaction text after business compliance verification, entity format verification, and prohibited content verification. This invention can be applied to business scenarios such as fintech and healthcare. By completing interaction information and fusing knowledge data, business data, and knowledge graph data, it improves the accuracy of service resource matching; by generating interaction text based on the fused context and performing content verification, it reduces text output that does not meet business requirements, improving the reliability of interaction responses. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers. The invention will be described in detail below through specific embodiments.

[0014] Please see Figure 2 , Figure 2 This is a flowchart illustrating an embodiment of the interactive text generation method based on context query provided by the present invention. It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.

[0015] like Figure 2 As shown, the interactive text generation method based on context query proposed in this invention includes the following steps: S10, receive natural language input text, obtain previous historical dialogue text and current session metadata, and generate context query data based on the natural language input text, the previous historical dialogue text and the current session metadata; In this embodiment, the natural language input text is received by the interactive interface and can originate from text input or speech transcription results. After receiving, it is uniformly encoded, and repetitive characters without semantic function are removed, while retaining the time, location, object name, service number, and status description.

[0016] Previous dialogue text is read from the conversation log, including input and response texts from previous rounds, and arranged according to the interaction rounds. When there is a lot of dialogue content, historical segments related to the current input can be selected to avoid writing irrelevant content.

[0017] The current session metadata originates from request parameters, session records, and business status interfaces, and may include session identifier, interaction round, object type, location, and task status. When data with the same name exists from multiple sources, the currently valid value is selected based on the update time, and missing content is written to a missing status identifier.

[0018] The context query data adopts a field-based data structure, setting up current input fields, historical dialogue fields, and session metadata fields respectively. The three types of data are written into the corresponding fields and associated with the session identifier and interaction rounds to keep the current expression, historical content, and current state distinct.

[0019] In scenarios with few interaction rounds and a large number of requests, a session identifier is used as a cache index to read recent historical conversations and current session metadata, which is then written into a key-value data structure. Task status is associated with a version identifier, and the corresponding metadata is updated when the version changes.

[0020] In cases where the conversation lasts for a long time, business item identifiers are used to segment historical conversations. Recent content is retained as complete text, while earlier content is converted into summary data, which is then written into a labeled data sequence along with the current input and current conversation metadata.

[0021] In the fintech business, the interaction object inputs "Can it be repaired now?", historical dialogue records vehicle information and accident location, and session metadata records the current city and business status. These three types of content are written into the context query data to keep the current question related to existing business matters.

[0022] In the healthcare business field, should the input of the interactive object continue to be recorded? Historical dialogue records health data types and follow-up content, and session metadata records the current management stage and recording status. These three types of content are written into the context query data to ensure that the instructions are associated with existing health management matters.

[0023] This embodiment writes the current input, historical dialogue, and current session state into the context query data respectively, and uses session identifiers, interaction rounds, and update times to maintain data relationships. This reduces the mixing of data from different sources, improves the integrity and consistency of context information, and reduces comprehension bias caused by missing input information.

[0024] S20, based on the context query data, identify the query intent and complete the missing entity information to generate standard query data; In this embodiment, the current input, preceding dialogue, and session metadata in the context query data are semantically encoded to extract the query object, query behavior, and constraint content. The semantic classification model takes the encoding results as input and outputs intent category and intent confidence data to determine the items the interactive object wants to query and the target results.

[0025] Based on the intent category, the required entity fields are determined, and these fields are compared with the entity information already identified in the current input to obtain the missing entity information. Candidate values ​​for the missing content are searched from previous dialogues and session metadata. For the target expression, the target object is determined according to the interaction round, semantic similarity, and state consistency. When multiple candidate values ​​exist, the candidate value more closely related to the current query is selected; if it cannot be reliably determined, the missing state is retained to avoid writing uncertain content.

[0026] Standard query data uses a fixed field structure, recording the intent category, query object, query behavior, constraints, completed entity information, and missing status. Time, location, object category, and task status are written according to a unified data format, converting different representations into directly readable data content.

[0027] When the number of intent categories is clear, a semantic classification model is used to determine the intent categories, and an entity recognition model is used to output the entity type, entity value, and text position. Based on the required entity fields corresponding to the intent category, candidate values ​​are matched from the current input, preceding dialogue, and session metadata. After entity completion, the data is written into a field-based data structure.

[0028] When the input expression varies significantly, a language generation model is used to read the contextual query data and output the intent category and entity information according to a preset field structure. The output results undergo consistency checks for field type, value range, and source; entity values ​​that fail the checks are changed to missing values, and then standard query data is generated.

[0029] In the fintech business, when an interactive object inputs "Can it be repaired now?", the system combines vehicle information from the preceding dialogue with the case status in the session metadata to determine the query intent as a repair condition query. It then completes the vehicle category, location, and current business status to generate the corresponding standard query data.

[0030] In the healthcare business field, when an interactive object inputs "Does this still need to be reviewed?", the query intent is determined to be a review requirement query, based on the health monitoring items in the preceding dialogue and the follow-up stage in the session metadata. The monitoring items, current stage, and time information are then completed to generate the corresponding standard query data.

[0031] This embodiment determines the necessary entity fields based on the query intent and supplements the missing content from the current input, preceding dialogue, and session metadata, which can reduce query bias caused by colloquial expressions, omissions of reference, and incomplete information; by unifying the entity format and preserving the missing state, it can improve the completeness and consistency of standard query data.

[0032] S30, based on the standard query data, perform knowledge retrieval and business query to generate knowledge retrieval data and business retrieval data; In this embodiment, the standard query data carries query content that has been uniformly expressed, and may include query objects, query behaviors, location constraints, time constraints, object categories, and status conditions. Knowledge retrieval is geared towards text-based knowledge data. It converts the query content in the standard query data into retrieval expressions, and through keyword matching, semantic vector matching, or a combination of both, filters knowledge fragments that match the meaning of the query from the knowledge storage area, retaining the knowledge content, matching degree, and source identifier to generate knowledge retrieval data.

[0033] Business queries target structured business data, converting object identifiers, categories, locations, and status conditions from standard query data into query parameters. These parameters are then retrieved via data interfaces or database query statements, reading the corresponding object attributes and current status. The returned content undergoes checks for field names, data types, and valid status to generate business retrieval data. Knowledge retrieval data reflects knowledge information consistent with the query content, while business retrieval data reflects dynamic data corresponding to the query object. These two types of results are retained separately to prevent textual knowledge and real-time status from overlapping.

[0034] When dealing with a large amount of knowledge content and diverse textual expressions, a semantic encoding model is used to convert standard query data into query vectors. These vectors are then matched with knowledge vectors in the knowledge storage area to determine similarity. Knowledge fragments that meet the matching criteria are selected to generate knowledge retrieval data. Business queries send field-based query parameters through a standardized interface. After receiving object attribute and status data, field validation is performed to generate business retrieval data.

[0035] When knowledge content has clear classifications and keyword identifiers, keyword indexing and category conditions are used to filter the knowledge content, and the search results are arranged according to the degree of matching. When business data is distributed across multiple data sources, query requests are sent to the corresponding data sources based on the category of the query object, and the returned fields are then converted into a unified field format to generate business retrieval data.

[0036] In the fintech business sector, standard query data includes vehicle service details, location, and current business status. Knowledge retrieval obtains repair-related content from the insurance service knowledge base, while business queries retrieve vehicle category, case status, and service level from business data sources, generating knowledge retrieval data and business retrieval data respectively.

[0037] In the healthcare business domain, standard query data includes health management items, location, and current follow-up status. Knowledge retrieval obtains content related to the recording requirements from the health knowledge base, while business queries obtain object categories, task status, and service progress from health management data sources, generating knowledge retrieval data and business retrieval data respectively.

[0038] This embodiment retrieves and queries text-based knowledge data and structured business data separately, enabling the simultaneous acquisition of knowledge content that matches the query semantics and the dynamic status corresponding to the query object. By preserving the data type, source, and validity status of both types of results, it reduces information bias caused by the mixing of static knowledge and real-time business data.

[0039] S40, acquire knowledge graph data, perform entity association, relationship path traversal and resource filtering based on the knowledge retrieval data, the business retrieval data and the knowledge graph data, generate target service resource data, and generate fusion context data based on the knowledge retrieval data, the business retrieval data and the target service resource data; In this embodiment, the knowledge graph data adopts a graph structure composed of nodes, relationships, and attributes. Nodes are used to record objects, states, conditions, and service resources; relationships are used to record category associations, location associations, state associations, and service associations between nodes; and attributes are used to record resource capabilities, service scope, location, and availability. Each node and relationship is configured with a unique identifier to facilitate matching search results with objects in the graph structure.

[0040] Entity association transforms entity content in knowledge retrieval data and object information in business retrieval data into unified names, categories, and identifiers, and then performs name matching, category matching, or alias matching with graph nodes. When multiple matching nodes exist, associated nodes can be determined based on the degree of consistency in categories, attributes, and semantics. Entities that do not meet the matching conditions remain in an unassociated state.

[0041] Relational path traversal starts from the associated nodes and searches for resource nodes along the graph relationships that satisfy the query relationship type. The traversal range can be controlled by the relationship type, the number of path levels, and the node category, and duplicate nodes, invalid relationships, and paths with unsatisfactory states are excluded, forming candidate paths that can reflect the association process between objects, conditions, and resources.

[0042] Resource filtering matches candidate resource attributes based on the conditions in knowledge retrieval data and the object characteristics, location constraints, and dynamic status in business retrieval data. Resource nodes that meet the filtering criteria, along with their corresponding attributes and associated paths, are written into the target service resource data. Knowledge retrieval data, business retrieval data, and target service resource data are each written into their corresponding fields in a unified data structure to form fused context data, while retaining the source and association identifiers of each type of data.

[0043] When there are many nodes in the graph and multiple ways to write entity names, name standardization and alias indexing are used to complete entity association. After the entity name is converted into a standard name, the range of candidate nodes is narrowed down by category indexing, and then the associated nodes are determined based on the degree of attribute consistency. The relationship path traversal adopts a width traversal method with a limited number of levels, and the connection relationship is filtered according to the relationship type to keep the candidate path within the set range.

[0044] In scenarios with frequent resource status changes, a graph structure is used to maintain relatively stable node relationships, and resource availability, service capacity, and location status are stored in independent attribute tables. After traversing to obtain candidate resource nodes, the latest corresponding attribute data is read for filtering, reducing resource status deviations caused by delays in graph attribute updates. The fused context data uses field-based objects to store the three types of results, and the correspondence between data is maintained through query identifiers.

[0045] In the fintech business domain, knowledge retrieval data includes vehicle repair conditions and partner institution requirements, while business retrieval data includes vehicle type, location, and current claims status. Entity association maps vehicle type and repair items to graph nodes, and relationship path traversal searches for service institutions associated with vehicle type, repair conditions, and region. Resource filtering generates target service resource data based on institution qualifications, location, and current service status, and this data is written into the fusion context data along with knowledge content and business status.

[0046] In the healthcare business domain, knowledge retrieval data includes health management projects and service requirements, while business retrieval data includes the category of the managed object, its location, and its current follow-up status. Entity association maps management projects and object categories to graph nodes, and relationship path traversal searches for health management resources with corresponding service capabilities. Resource filtering generates target service resource data based on service scope, location, and availability, and this data is written into the fusion context data along with knowledge content and business status.

[0047] This embodiment reduces matching bias caused by name differences and multi-layered relationships by associating knowledge content and business data with graph nodes and searching for candidate resources along restricted relationship paths. By using object features, location constraints, and dynamic status to filter resource attributes, it improves the consistency between target service resources and current needs. By uniformly storing knowledge retrieval data, business retrieval data, and target service resource data, it reduces information loss caused by the fragmentation of multi-source data.

[0048] S50, based on the context query data and the fusion context data, generate response prompt data, input the response prompt data into the language generation model, and generate initial interactive text; In this embodiment, the current input, historical dialogue, and session state in the context query data are used to determine the answer target, interaction state, and expression method. The knowledge content, business status, and service resources in the fused context data are used to provide the basis for generation. After reading both types of data separately, they are written into preset fields according to the answer target, knowledge basis, business status, service resources, and response format, and the content scope, tone, and output structure are set to form response prompt data.

[0049] The response prompt data serves as input to the language generation model. It is segmented and encoded into a token sequence. Semantic relationships between fields are extracted through an embedding layer, an attention layer, and a feedforward layer. The output layer then generates text tags item by item. The generation process describes the current situation based on knowledge content and business status, generates resource information readable by the interactive object based on service resources, and adjusts the sentence order and wording according to the response format to form the initial interactive text.

[0050] When the response format is relatively fixed, a field template is used to generate response prompt data. The template sets the target field, knowledge field, status field, resource field, and response format field. The corresponding content from the context query data and the fused context data is written into each field, and then converted into model input according to the field order. The language generation model receives the text sequence after the fields have been written and outputs the initial interactive text containing business descriptions and resource information.

[0051] When the input content is long or the number of resources is large, a segmented prompt structure is adopted to reduce the use of irrelevant content. Contextual query data forms task segments, knowledge retrieval data forms knowledge segments, business retrieval data forms status segments, and target service resource data forms resource segments. Each data segment is associated with a source identifier and content priority. The language generation model determines the generation target according to the task segments, generates initial interactive text based on the remaining data segments, and controls the output length and the number of resource entries.

[0052] In the fintech business, contextual query data reflects that the interacting party is inquiring about vehicle repair arrangements. The integrated contextual data includes repair conditions, current claim status, and service provider information. Response prompt data is written with the inquiry goal, business status, and service provider information. Based on this, the language generation model generates initial interactive text containing the current processing status and available service providers.

[0053] In the healthcare business, contextual query data reflects that the interacting object is consulting about health management services. The integrated contextual data includes health knowledge, current follow-up status, and available health management resources. Response prompt data is written with the consultation details, follow-up status, and resource information. Based on this, the language generation model generates initial interactive text that matches the current management stage.

[0054] This embodiment reduces the possibility of missing information or mixing information from different sources in the generated content by writing the answer target, knowledge content, business status, and service resources into the structured response prompt data. By reading data content with clear field relationships through a language generation model, the initial interactive text can simultaneously reflect the current query requirements and resource matching results, improving the completeness and consistency of the response content.

[0055] S60, obtain content verification data, perform business compliance verification, entity format verification and prohibited content verification on the initial interactive text based on the content verification data, generate content verification results, and determine the target interactive text based on the content verification results.

[0056] In this embodiment, content verification data can be read from the verification condition storage area or configuration interface, including business compliance conditions, entity format conditions, prohibited content sets, and corresponding version information. Business compliance verification divides the initial interactive text into sentence fragments, identifies the business status, service scope, and result commitments within them, and matches them with the business compliance conditions, marking sentence fragments with inconsistent content. Entity format verification identifies entities such as name, address, contact information, time, amount, and business number, determining whether the entities meet the requirements based on character type, field length, and structural format. Prohibited content verification performs character unification and word segmentation on the text, determining whether it contains prohibited words or prohibited semantic combinations through term indexing and combined word matching. The three types of verification results are merged into a content verification result according to sentence position, recording the verification status, failure category, and corresponding text position. When all verifications pass, the initial interactive text is determined as the target interactive text; if there is failed content, the corresponding text fragments are deleted, replaced, or rewritten to form the target interactive text.

[0057] In scenarios where validation conditions are relatively stable and a fast response is required, a pre-compiled condition table is used to perform text validation. Business-permitted conditions are converted into statement matching items, entity format conditions are converted into character patterns, and content sets that are prohibited from being written to the prefix tree index are excluded. The initial interactive text is segmented into sentences and words, and then matched against the three types of data respectively, generating content validation results based on the position of the matched text.

[0058] In scenarios where validation conditions are frequently updated, validation content corresponding to different business categories is stored in a versioned configuration table. The initial interaction text loads the currently valid version according to the business category, uses a field parser to identify entities, uses a term index to check for prohibited content, and uses a status condition table to verify the business statements. Text fragments that fail are replaced according to their corresponding categories to generate the target interaction text.

[0059] In the fintech business, the initial interactive text includes claims progress, repair center address, and compensation details. Business compliance verification checks the claims status against permitted output content, entity format verification checks the institution's address and contact number, prohibited content verification identifies commitments beyond the scope of business, and fragments that fail verification are replaced to form the target interactive text.

[0060] In the healthcare business domain, the initial interaction text includes the health management stage, service provider information, and health advice. Business compliance verification checks the current management status, entity format verification checks the institution name, appointment time, and contact information, and prohibited content verification identifies definitive conclusions that are not allowed to be output. After revising the corresponding text, the target interaction text is formed.

[0061] This embodiment verifies the business content, entity format, and prohibited content of the initial interactive text, which can identify inconsistencies in business status, errors in entity structure, and prohibited information. By recording the categories and text positions that fail and revising the corresponding content accordingly, it can reduce interactive text that does not meet business requirements and improve the accuracy and usability of the target interactive text.

[0062] In one embodiment, such as Figure 3 As shown, step S10 above includes: S101, receive natural language input text, obtain session identifier data associated with the natural language input text, and determine the current interaction round data based on the session identifier data; S102, based on the session identifier data and the current interaction round data, obtain the historical dialogue records before the current interaction round, arrange the historical input text and historical reply text in the historical dialogue records according to the interaction round, and generate the previous historical dialogue text; S103, based on the session identifier data, obtain the interaction object identifier data, location data, object category data and task status data, and generate the current session metadata based on the interaction object identifier data, the location data, the object category data and the task status data; S104, Generate context structure data containing the current input field, historical dialogue field, session metadata field, session identifier field, and interaction round field; S105, write the natural language input text into the current input field, write the previous historical dialogue text into the historical dialogue field, write the current session metadata into the session metadata field, write the session identifier data into the session identifier field, and write the current interaction round data into the interaction round field, and generate context query data based on the context structure data after the data writing is completed.

[0063] In this embodiment, the natural language input text is received by the interaction interface. The text content can come from keyboard input, speech-to-text results, or message interface transmission results. After receiving, the character encoding, whitespace characters, newline characters, and repeated punctuation are standardized, while semantically meaningful content such as object names, locations, times, statuses, and business matters are retained. The natural language input text is associated with session identification data. The session identification data can be carried by the interaction request or generated based on established session connections, access tokens, or message channel identifiers. This data is used to distinguish the interaction content in different sessions and prevent the input text from multiple sessions from being mixed together.

[0064] The current interaction round data is determined based on the session identifier data and is used to mark the position of the natural language input text within the current session. The current interaction round data can use an incrementing sequence number, a time-order identifier, or a round identifier generated from the number of session records. Before determining the current interaction round data, the existing round records corresponding to the session identifier data are checked; when concurrent input exists, the current valid round can be determined based on the reception time and round version, reducing the possibility of the same round being recorded repeatedly or different inputs using the same round identifier.

[0065] Historical dialogue records are read from the session storage area based on session identifier data and the current interaction round data, with the reading scope limited to records formed before the current interaction round. Historical dialogue records include historical input text and historical response text, with each record associated with an interaction round, sending type, and formation time. When arranged by interaction round, historical input text and historical response text within the same round are paired and written into a continuous text sequence according to round order, forming the preceding historical dialogue text. In cases of missing responses, duplicate messages, or delayed writing, deduplication can be performed based on message identifiers, retaining valid records that confirm round affiliation to prevent the order of historical content from being disordered.

[0066] Interaction object identification data, location data, object category data, and task status data are read from session records, request parameters, or status data storage areas based on session identification data. Interaction object identification data distinguishes the interaction objects associated with the current session; location data records the region, coordinate range, or service area; interaction object category data records the object's category; and task status data records the progress status of the current business transaction. When multiple data sources have fields with the same name, the currently valid value can be selected based on update time, source priority, and validity status. If a field is temporarily missing, a missing status flag is written to avoid using unconfirmed data to replace the actual field value. The four types of data are written into the session metadata structure according to fixed field relationships to generate the current session metadata.

[0067] Contextual structure data is used to carry the current input, historical dialogues, session metadata, session identifier, and interaction rounds. The current input field stores the natural language input text, the historical dialogue field stores the text of previous historical dialogues, the session metadata field stores the current session metadata, the session identifier field stores the session identifier data, and the interaction round field stores the current interaction round data. Each field is configured with a field name, data type, and value state to maintain clear boundaries between data from different sources, and the correspondence between the current input and historical records is maintained through the session identifier and interaction round fields.

[0068] During data writing, field type checks and integrity checks are performed on the natural language input text, previous historical dialogue text, and current session metadata, respectively. Text content is written to text fields, structured metadata to session metadata fields, and session identifier data and current interaction round data to their corresponding identifier fields. After writing is complete, the consistency of session identifiers, the range of historical rounds, and the uniqueness of the current round are verified. Contextual structure data that passes verification is determined as context query data. Context query data consists of multiple fields, retaining the current expression, historical interaction content, and current session state, without altering the source relationships of each data item.

[0069] This embodiment associates natural language input text, historical dialogue records, and current session metadata with session identifier data, which can reduce the mixing of different session data; it limits the range of historical records and arranges historical input text and historical response text by limiting the historical record range by current interaction round data, which can maintain the temporal relationship and question-answer correspondence of dialogue content; it supplements the session state information not directly carried by a single input by writing interaction object identifier data, location data, object category data, and task status data into the current session metadata; and it improves the data integrity and correspondence accuracy between current input, historical content, and session state by generating context query data through field-based writing and consistency checks.

[0070] In one embodiment, such as Figure 4 As shown, step S20 above includes: S201, extract target expression data, behavior expression data and constraint expression data from the natural language input text in the context query data, and determine the query intent based on the target expression data, the behavior expression data, the constraint expression data and the preceding historical dialogue text in the context query data; S202, extract explicit entity information and instruction expression data from the natural language input text in the context query data, and extract candidate entity information from the previous historical dialogue text and current session metadata in the context query data; S203, based on the query intent and the explicit entity information, determine the missing entity information, match the missing entity information with the candidate entity information by entity category, and match the index expression data with the candidate entity information by semantic index to generate entity completion information; S204, based on the entity completion information, complete the missing entity information in the natural language input text, and reconstruct the completed natural language input text based on the query intent, the explicit entity information and the entity completion information, to generate standard query data.

[0071] In this embodiment, noun phrases, action words, and conditional components are identified from the current input content of the context query data. Target expression data, behavioral expression data, and constraint expression data are generated based on word position, syntactic dependencies, and semantic roles. Target expression data records the objects or matters involved in the query; behavioral expression data records the meanings of actions such as consultation, inquiry, processing, and change; and constraint expression data records time, location, category, status, scope, and quantity conditions. When multiple targets or behaviors exist, their corresponding relationships and recognition credibility are preserved separately to avoid merging different query items.

[0072] Goal expression data, behavior expression data, and constraint expression data, along with previous historical dialogue text, are used to determine the query intent. When the current input is complete, the intent category is determined based on the combination of goal and behavior. When the current input contains omitted or extended expressions, discussed matters, recently confirmed objects, and incomplete interactions are retrieved from previous historical dialogue text to determine whether the current input belongs to a continued query, condition supplementation, object change, or status confirmation. When multiple candidate intents are satisfied simultaneously, the query intent is determined based on semantic similarity, interaction round distance, and constraint consistency, and the intent credibility is recorded.

[0073] Explicit entity information is identified from the natural language input text, including the object name, category, location, time, status, and identifier content that appear directly in the text. It refers to pronouns, omitted objects, and phrases with retrospective meaning, and associates them with their corresponding text locations. Candidate entity information is obtained from previous historical dialogue text and current session metadata. Each candidate entity is associated with entity category, source location, formation time, and current valid status, used to distinguish between confirmed content in historical dialogues and current status content in session metadata.

[0074] Missing entity information is determined based on the difference between the entity fields required by the query intent and the explicit entity information. For example, if the query intent requires object, location, and status, but the natural language input text only contains object, then location and status are identified as missing entity information. Missing entity information is matched with candidate entity information according to entity category, excluding candidate content that does not match the category or whose valid status is not met. The specified delivery data is semantically matched with candidate entity information based on semantic proximity, interaction round distance, syntactic relationship, and state consistency to determine the candidate entity corresponding to the specified delivery.

[0075] Entity category matching results and semantic pointer matching results together form entity completion information. Entity completion information records the location to be completed, the entity value to be completed, the entity category, the data source, and the matching reliability. When multiple candidate entities exist, the candidate entity with the same category, the closest to the current round, and consistent with the query intent is selected; if the candidate result cannot meet the matching conditions, the missing state is retained to avoid writing entity content that cannot be confirmed.

[0076] Based on entity completion information, missing entity values ​​are written to the corresponding positions in the natural language input text, and the specified representation is replaced with an explicit entity name. Query intent, explicit entity information, and entity completion information are used to adjust the arrangement of objects, behaviors, and constraints, converting abbreviations, time formats, location formats, and status names into a unified format to generate standard query data. Standard query data may include standard query text, or it may include query intent fields, entity fields, constraint fields, and entity source fields, ensuring semantic integrity and field consistency in the query content.

[0077] This embodiment can reduce intent deviation caused by omitted expressions and continuous dialogue by distinguishing the target, behavior, and constraint content from the current input and determining the query intent by utilizing previous historical dialogues; it can improve the accuracy of supplementing missing entity information by identifying explicit entities, indications, and candidate entities from the current input, historical dialogues, and session metadata, and completing the completion based on entity category and semantic indication; and it can improve the completeness and consistency of query content by generating standard query data by unifying entity names, constraint formats, and content arrangement relationships.

[0078] In one embodiment, such as Figure 5 As shown, step S30 above includes: S301, extract query text data and business query entity data from the standard query data. The business query entity data includes interactive object identification data, object category data, location constraint data, and task status constraint data. S302, the query text data is converted into a query feature vector using a semantic coding model, and a knowledge retrieval request is generated based on the query feature vector; S303, write the interaction object identifier data into the interaction object identifier field, write the object category data into the object category field, write the location constraint data into the location field, and write the task status constraint data into the task status field to generate a business query request. S304, Generate query identifier data, write the query identifier data into the knowledge retrieval request and the business query request respectively, and send the knowledge retrieval request to the vector database and the business query request to the business data source in parallel. S305, receive the candidate knowledge data set and semantic matching data returned by the vector database based on the knowledge retrieval request, and receive the interactive object feature data and dynamic business status data returned by the business data source based on the business query request, wherein each candidate knowledge data is associated with the corresponding semantic matching data, and the candidate knowledge data set, the interactive object feature data and the dynamic business status data are associated with the query identifier data. S306, based on the query identifier data, determine the candidate knowledge data set corresponding to the same standard query data, the interactive object feature data corresponding to the same standard query data, and the dynamic business status data corresponding to the same standard query data. Based on the preset knowledge filtering conditions and the semantic matching data, filter the candidate knowledge data set to obtain knowledge retrieval data. Then, associate the interactive object feature data and the dynamic business status data with the business query entity data to generate business retrieval data.

[0079] In this embodiment, the query content in the standard query data is divided into query text data and business query entity data according to the data purpose. Query text data preserves the semantic relationships between query objects, query behaviors, and constraint content, and is used for knowledge content matching. Business query entity data stores interaction object identifier data, object category data, location constraint data, and task status constraint data in a field-based format, and is used to determine the query objects and query scope of business data. During the division process, structured content is read based on field identifiers to avoid directly using the complete text used for semantic retrieval as business interface parameters.

[0080] The semantic encoding model receives query text data, segments and encodes the text, generates term representations through the embedding layer, extracts the association information between the query object, behavior, and constraints through the semantic encoding layer, and generates a fixed-length query feature vector using the aggregation layer. After dimensionality checking and numerical normalization, the query feature vector is written into a knowledge retrieval request. The knowledge retrieval request can also include the retrieval scope, the number of results returned, and matching conditions, enabling the vector database to perform vector matching within a specified knowledge set.

[0081] Business query requests use a pre-defined field structure. Interaction object identifier data is written to the interaction object identifier field, object category data to the object category field, location constraint data to the location field, and task status constraint data to the task status field. After fields are written, the field type, value format, and required field status are checked to avoid writing incorrect data. Location constraint data can use region identifiers, coordinate ranges, or service ranges; task status constraint data can use status identifiers or status ranges, with the specific format consistent with the query interface of the business data source.

[0082] Query identifier data is used to associate knowledge retrieval requests and business query requests generated from the same standard query data. Query identifier data can be formed based on session identifiers, interaction rounds, and request generation time, and written separately to each request. The two requests are sent in parallel. The vector database retrieves knowledge data based on query feature vectors, while the business data source reads object attributes and dynamic states based on field-based query conditions. Parallel sending does not alter the independent data structures of the two requests; the query identifier data maintains the hierarchical relationship between the returned results.

[0083] The vector database matches query feature vectors with knowledge vectors, returning a set of candidate knowledge data and semantic matching data. Each candidate knowledge data is associated with its corresponding semantic matching data, which records vector proximity, matching order, and knowledge source identifier. The business data source returns interaction object feature data and dynamic business status data. The interaction object feature data records object category, service attributes, or configuration attributes, while the dynamic business status data records current task progress, resource status, or status update time. The candidate knowledge data set, interaction object feature data, and dynamic business status data are all associated with query identifier data to prevent the results from being mixed due to concurrent requests.

[0084] Query identifier data is used to identify the data combination corresponding to the same standard query data from multiple returned results. The candidate knowledge data set is filtered according to preset knowledge filtering conditions, which may include semantic matching range, knowledge validity status, knowledge category, and number of returns. Candidate knowledge data that meets the filtering conditions forms knowledge retrieval data, retaining the corresponding semantic matching data and source information. Interactive object feature data and dynamic business status data are associated with business query entity data according to field names and data types to form business retrieval data, ensuring that query conditions, object attributes, and current status remain consistent.

[0085] This embodiment divides standard query data into query text data and business query entity data, which can respectively meet the data requirements of semantic retrieval and field-based business queries. By generating query feature vectors through a semantic encoding model and forming business query requests based on field-based query conditions, it can simultaneously obtain knowledge content that matches the meaning of the query and dynamic data corresponding to the query object. By associating query identification data with requests and returned results, and forming knowledge retrieval data and business retrieval data based on knowledge filtering conditions and field relationships, it can reduce the mixing of concurrent query results and the entry of invalid knowledge data into the retrieval results, and improve the accuracy of the correspondence between the two types of data.

[0086] In one embodiment, such as Figure 6 As shown, step S40 above includes: S401, Obtain knowledge graph data, wherein the knowledge graph data includes graph node data, graph relationship data, and resource attribute data; S402, extract knowledge entity data, relationship type data and resource filtering condition data from the knowledge retrieval data, and extract interaction object identification data, object category data, interaction object feature data, location constraint data and dynamic business status data from the business retrieval data; S403, the interactive object identification data and the knowledge entity data are respectively associated with the graph node data to generate associated graph node data, and the starting graph node data corresponding to the interactive object identification data is determined from the associated graph node data based on the object category data, and the associated graph node data corresponding to the knowledge entity data is determined as constraint graph node data. S404, based on the relationship type data, target graph relationship data is filtered from the graph relationship data. Starting from the initial graph node data, based on the target graph relationship data, relationship path traversal is performed in the knowledge graph data to generate candidate relationship path data. Candidate resource node data that has a connection relationship with the constraint graph node data is determined from the candidate relationship path data. S405, obtain candidate resource attribute data corresponding to the candidate resource node data from the resource attribute data; based on the resource filtering condition data, perform condition matching between the interaction object feature data, the location constraint data, and the dynamic business status data and the candidate resource attribute data to generate a resource matching result; filter target resource node data from the candidate resource node data based on the resource matching result; select target resource attribute data corresponding to the target resource node data from the candidate resource attribute data; select target relationship path data corresponding to the target resource node data from the candidate relationship path data; and generate target service resource data based on the target resource node data, the target resource attribute data, and the target relationship path data. S406, generate a context data structure containing a knowledge context field, a business context field, and a resource context field; write the knowledge retrieval data into the knowledge context field; write the business retrieval data into the business context field; write the target service resource data into the resource context field; and generate fused context data based on the context data structure after the data writing is completed.

[0087] In this embodiment, knowledge graph data is read from the graph data storage area. Graph node data records objects such as interactive objects, knowledge entities, state entities, and service resources. Graph relationship data records category relationships, service relationships, location relationships, and status relationships between nodes. Resource attribute data records service range, resource capabilities, location range, and availability status. Each node and relationship is configured with an identifier, category, and valid status. Resource attribute data is associated with the corresponding resource node to support node location, relationship traversal, and attribute reading.

[0088] In knowledge retrieval data, knowledge entity data represents the objects involved in the retrieval content, relation type data limits the node relationships to be queried, and resource filtering condition data represents the attribute requirements that the target resource must meet. In business retrieval data, interaction object identifier data locates the current interaction object, object category data restricts the corresponding node category, interaction object feature data describes object attributes, location constraint data limits the resource area, and dynamic business status data records the current task status and resource usage conditions. All data is read according to field identifiers, and the source identifier and data validity status are retained.

[0089] Interactive object identifier data is matched with graph node data for identifier and category matching, while knowledge entity data is matched with graph node data for name, alias, or semantic matching. When the matching results meet preset association conditions, associated graph node data is generated. Object category data is used to exclude nodes with inconsistent categories from the associated nodes corresponding to the interactive object and to determine the starting graph node data. The associated nodes corresponding to knowledge entity data reflect the knowledge objects or condition objects that resource matching needs to satisfy, and are therefore determined as constraint graph node data.

[0090] The relation type data is matched with the relation categories in the graph relation data. Relationships that meet the requirements of relation category, relation direction, and valid status are formed into target graph relation data. Relationship path traversal starts from the initial graph node data and visits adjacent nodes layer by layer according to the connection direction indicated by the target graph relation data, excluding duplicate nodes, invalid relations, and paths exceeding the traversal range. The traversal results record the node identifiers, relation identifiers, and connection order, forming candidate relation path data.

[0091] Resource nodes in the candidate relationship path data that are connected to constraint graph node data form candidate resource node data. The connection can be represented as a candidate resource node being located in a path connecting the starting graph node and the constraint graph node, or it can be represented as a candidate resource node being directly connected to the constraint graph node through the target graph relationship data. The candidate resource node data retains the corresponding candidate relationship path identifier, ensuring that the resource node corresponds to its associated basis.

[0092] Candidate resource attribute data is read from the resource attribute data based on the candidate resource node identifier. Resource filtering condition data is used to determine the attribute items to be compared, and the interaction object feature data, location constraint data, and dynamic business status data are converted into corresponding filtering conditions. The interaction object feature data is matched with the applicable object attributes of the resource; the location constraint data is matched with the resource location or service range; and the dynamic business status data is matched with the resource availability status and task status requirements. All matching results are written to the resource matching results, which record the condition fulfillment status and the corresponding resource node identifier.

[0093] Based on the resource matching results, target resource node data that meets the filtering criteria is selected from the candidate resource node data, and target resource attribute data with the same resource node identifier as the target resource node data is selected from the candidate resource attribute data. Candidate relationship path data is filtered according to resource node identifiers to obtain the target relationship path data corresponding to the target resource node data. The target resource node data, target resource attribute data, and target relationship path data are then associated according to their resource node identifiers to generate target service resource data, ensuring that each service resource simultaneously possesses resource content, resource attributes, and relationship path information.

[0094] The context data structure includes knowledge context fields, business context fields, and resource context fields. Knowledge retrieval data is written to the knowledge context fields, business retrieval data is written to the business context fields, and target service resource data is written to the resource context fields. During the writing process, the consistency of field types, query identifiers, and resource node identifiers is checked, and the source and relationships of various types of data are preserved. The context data structure after data writing is completed forms the fused context data.

[0095] This embodiment associates knowledge entities and interactive objects with graph nodes and uses relationship types to limit the traversal range, which can reduce the impact of differences in entity names and irrelevant relationships on resource search. By combining interactive object characteristics, location constraints, and dynamic business status to match candidate resource attributes, it can improve the consistency between target service resources and current needs. By writing knowledge retrieval data, business retrieval data, and target service resource data into a context data structure with clear field boundaries, it can maintain the correspondence between multi-source data and reduce information loss caused by data dispersion.

[0096] In one embodiment, such as Figure 7 As shown, step S50 above includes: S501, determine the answer target data and interaction status data based on the natural language input text and previous historical dialogue text in the context query data; S502, extract from the fusion context data the knowledge basis data corresponding to the knowledge retrieval data, the interaction object feature data and dynamic business status data corresponding to the business retrieval data, and the service resource data corresponding to the target service resource data; S503, obtain a set of prompt word templates, select a target prompt word template from the set of prompt word templates based on the interaction object feature data and the interaction state data, determine the response tone data, and determine the response structure data based on the response target data; S504, the answer target data, the interaction object feature data, the knowledge basis data, the dynamic business status data, the service resource data, the reply tone data, and the reply structure data are respectively written into the answer target field, interaction object feature field, knowledge basis field, dynamic business status field, service resource field, reply tone field, and reply structure field of the target prompt word template to generate prompt word content data; S505, Arrange the field content in the prompt word content data according to the reply structure data, generate the arranged prompt word content data, generate model instruction data based on the reply tone data, and generate reply prompt data based on the model instruction data and the arranged prompt word content data; S506, the reply prompt data is input into the language generation model, and the language generation model generates initial interactive text based on the model instruction data and the arranged prompt word content data in the reply prompt data.

[0097] In this embodiment, the natural language input text and previous historical dialogue text are read according to the interaction round, sender identifier, and text position. The items requiring a response in the current round are determined from the current input, and the response target data is generated by combining the confirmed objects, unfinished items, and follow-up questions from the historical dialogue. Interaction state data records the semantic state of the current interaction, which may include new question posed, continuation of the previous question, condition supplementation, object change, and result confirmation. When determining the interaction state data, semantic matching is performed between the current input and the target objects, behavioral content, and constraint content in the historical dialogue, and the connection relationship between the two is determined based on the matching results.

[0098] The knowledge context field, business context field, and resource context field in the integrated context data store content from different sources. Knowledge basis data is read from the fields corresponding to the knowledge retrieval data, used to record knowledge content and source information related to the answer target. Interaction object feature data and dynamic business status data are read from the fields corresponding to the business retrieval data, recording object category, object attributes, and current task status, respectively. Service resource data is read from the fields corresponding to the target service resource data, used to record resource name, resource attributes, and resource relationship information. During the reading process, the attribution relationship of each data item is verified based on the query identifier and field identifier to prevent data generated by different queries from being written into the same response prompt data.

[0099] The prompt word template set consists of multiple templates with preset fields and content formats. Each template can be associated with an applicable object category, interaction state, tone type, and output structure. Interaction object feature data is used to determine the applicable object of the template, while interaction state data is used to determine the interaction method required for the current response. Templates that meet both conditions are selected as the target prompt word template. When multiple candidate templates exist, the target prompt word template can be determined based on the degree of matching of object features, the degree of matching of interaction state, and template priority. Response tone data is determined based on the interaction object feature data and interaction state data, and is used to record the intensity of wording, sentence type, and expression tendency. Response structure data is determined based on the target response data, and is used to record the arrangement of knowledge descriptions, status descriptions, and resource information in the response.

[0100] The target data, interaction object characteristic data, knowledge basis data, dynamic business status data, service resource data, response tone data, and response structure data are written into the corresponding fields of the target prompt word template. Before writing the fields, the data type, field length, and content completeness are checked. If a field is missing, a missing status indicator is written to prevent unconfirmed content from being replaced with a presumed value. After the fields are written, the fixed content in the target prompt word template, together with the content of each field, forms the prompt word content data, ensuring clear data boundaries for the answer target, knowledge basis, business status, and resource content.

[0101] The response structure data is used to determine the order and hierarchy of the fields in the prompt content data. Content directly related to the answer objective is configured in the corresponding positions. Knowledge base, dynamic business status, and service resources are arranged according to the order indicated by the response structure data, generating the arranged prompt content data. The response tone data is converted into model instruction data that the model can read. The model instruction data may include language style, sentence length, word intensity, and output format requirements. The model instruction data and the arranged prompt content data are combined according to a preset input format to form the response prompt data.

[0102] After receiving response prompt data, the language generation model converts the model instruction data and the arranged prompt word content data into a labeled sequence. This sequence is then processed through an embedding layer to form a text representation. Semantic relationships between the response objective, knowledge base, business status, and service resources are established through an attention layer and a feedforward layer. The output layer determines the generation format based on the model instruction data and generates text content item by item based on the arranged prompt word content data. The generated result retains knowledge content, dynamic status, and service resource information related to the response objective, forming the initial interactive text.

[0103] This embodiment determines the answer target and interaction state from contextual query data, and reads knowledge basis, interaction object characteristics, dynamic business status and service resources from fused contextual data, which can reduce the inconsistency between the response content and the current query requirements; by selecting target prompt word templates based on interaction object characteristics and interaction state, and writing them into each data item respectively, it can maintain the field boundaries and correspondence between content from different sources; by arranging content through response structure data and using response tone data to generate model instruction data, the language generation model can generate initial interactive text according to a clear content scope and expression form, improving the completeness and consistency of the response content.

[0104] In one embodiment, such as Figure 8 As shown, step S60 above includes: S601, Obtain content verification data and security response data, wherein the content verification data includes business compliance condition data, entity format condition data and prohibited content data; S602, extract business statement data and entity content data from the initial interactive text, and determine the business statement location data corresponding to the business statement data and the entity content location data corresponding to the entity content data; S603, based on the business compliance condition data, the entity format condition data, and the prohibited content data, perform business compliance verification, entity format verification, and prohibited content verification on the business statement data, the entity content data, and the initial interaction text, respectively, generate business compliance verification results, entity format verification results, and prohibited content verification results, and determine the prohibited content location data corresponding to the prohibited content verification results; S604, Based on the business compliance verification result, the entity format verification result, the prohibited content verification result, the business statement location data, the entity content location data, and the prohibited content location data, a content verification result is generated, which includes verification status data, failure type data, and failure text location data; S605, when the verification status data indicates that the verification has passed, the initial interactive text is determined as the target interactive text; when the verification status data indicates that the verification has failed, the security response content is determined from the security response data based on the failure type data, and the text content indicated by the failure text position data in the initial interactive text is replaced with the security response content to generate the target interactive text; S606, Output the target interactive text.

[0105] In this embodiment, content verification data is read from the verification data storage area. Business compliance condition data, entity format condition data, and prohibited content data are associated with applicable categories, validity status, and version information, respectively. Business compliance condition data records the allowed output business status, service scope, conditional relationships, and result range; entity format condition data records entity categories, character composition, field length, and delimiter format; prohibited content data records prohibited terms, prohibited semantic combinations, and corresponding matching ranges. Security response data saves replacement content according to the failure type, enabling text fragments that fail verification to be corrected using content consistent with the failure reason.

[0106] The initial interactive text is divided into multiple sentence fragments based on punctuation positions and semantic boundaries. From these fragments, business objects, business behaviors, conditional content, status content, and result content are identified to form business statement data. Entity content data is identified from the initial interactive text and may include object name, address, contact information, time, amount, and business number. Both business statement position data and entity content position data are recorded using character start positions, character end positions, and sentence identifiers. When the text undergoes character unification or word segmentation, the positional mapping before and after the transformation is preserved to prevent validation results from pointing to incorrect text locations.

[0107] Business compliance verification, based on business compliance condition data, combines and matches the objects, behaviors, conditions, states, and results in the business statement data. If the business state is inconsistent with the permitted state, the service scope exceeds the permitted scope, or the result content lacks necessary conditions, a failure status is generated, and the failure category and corresponding business statement location data are recorded. If the business statement data meets the applicable category and condition relationships, a pass status is generated.

[0108] Entity format validation selects the appropriate entity format condition data based on the entity category, checking the character type, length, number of fields, delimiters, and composition order of the entity content data. For example, contact information can be checked for the number of digits and area code structure; addresses can be checked for the region field and detailed location field; and time can be checked for the date composition and value range. The validation results are correlated with the entity content location data, enabling format errors to be located to the specific entity.

[0109] The prohibited content validation process performs character unification and word segmentation on the initial interactive text, and then performs term matching, compound word matching, and semantic matching based on the prohibited content data. Term matching is used to identify explicitly prohibited content, compound word matching is used to identify prohibited meanings composed of multiple scattered terms, and semantic matching is used to identify text fragments that retain the same prohibited meaning after word replacement. When prohibited content is detected, the corresponding character range is recorded, generating prohibited content location data.

[0110] Business compliance verification results, entity format verification results, and prohibited content verification results are associated based on text location. When any verification result is "failed," the verification status data records "verification failed," the failure type data records the corresponding verification category, and the failure text location data is selected from business statement location data, entity content location data, or prohibited content location data. When multiple failure locations overlap, the overlapping areas are merged; when the same location corresponds to multiple failure types, the corresponding failure type is retained according to the preset processing priority to form the content verification result.

[0111] When the verification status data indicates a successful verification, the initial interactive text is directly determined as the target interactive text. When the verification status data indicates a failed verification, a security response is selected from the security response data based on the failure type data, and the replacement range is determined according to the failure text position data. If multiple replacement ranges exist, replacement is performed from right to left based on character position to avoid positional shifts in later texts due to changes in the length of the preceding text. After replacement, the punctuation and sentence connections between text fragments are checked, the target interactive text is generated, and sent through the interactive output interface.

[0112] This embodiment can identify inconsistencies in business status, incorrect entity structure, and prohibited semantic content by separately verifying business statements, entity formats, and prohibited content; by recording the character positions corresponding to each verification result and merging overlapping ranges, it can improve the accuracy of locating failed content; by selecting safe response content based on the failure type and replacing it according to the text position, it can reduce the continued output of content that does not meet business conditions and improve the accuracy and usability of the target interactive text.

[0113] In one embodiment, in a car insurance claims interaction scenario, the interacting object has previously reported an accident and provided information such as vehicle type, accident location, and repair needs in multiple rounds of dialogue. The current input is "Can I get it repaired now?" and "Are there any suitable repair shops nearby?" The interaction server receives the natural language input text, determines the current interaction round based on session identifier data, reads previous historical input and response texts, generates the preceding historical dialogue text, and obtains the interacting object identifier, location, high-level customer category, and damage assessment completion status from the business data source to generate the current session metadata. The natural language input text, preceding historical dialogue text, and current session metadata are respectively written into the context structure data to form context query data.

[0114] The system identifies targets, behaviors, and constraints such as repair shops, destinations, nearby locations, and suitability for the current vehicle from the natural language input text. It also combines this with previous dialogue history to determine the query intent: confirming repair conditions and matching service providers. The current vehicle in the natural language input refers to delivery, while vehicle type, location, and case status are missing entity information. Based on historical dialogue and current session metadata, candidate entity information such as a high-end brand vehicle, target city, high-level customer, and completed damage assessment are obtained. Entity category matching and semantic targeting matching are then performed, reconstructing the query content into standard query data containing vehicle type, location, customer type, case status, and repair needs.

[0115] The complete query content in the standard query data forms the query text data, while the interactive object identifier, object category, location constraints, and task status constraints form the business query entity data. The semantic encoding model uses embedding to convert the query text data into query feature vectors and generate a knowledge retrieval request. The business query entity data is written into the corresponding fields to generate the business query request. Both requests are associated with the same query identifier data and are sent to the vector database and business data source respectively. The vector database returns candidate knowledge data and semantic matching data from insurance terms, claims FAQs, and requirements from partner repair shops. The business data source returns interactive object feature data such as vehicle category, customer service level, current case status, and location, as well as dynamic business status data. After filtering, knowledge retrieval data and business retrieval data are generated respectively.

[0116] The knowledge graph data includes nodes and their relationships, such as vehicle category, case status, repair conditions, service providers, service qualifications, and geographical location. Interaction object identifiers and knowledge entities are associated with graph nodes. Interaction object nodes are identified as the starting graph nodes, while nodes corresponding to brand repair qualifications, repair availability after damage assessment, and partner institution requirements are identified as constraint graph nodes. Relationship paths are traversed along service, qualification, and location relationships to obtain candidate service providers. Candidate resource attributes are matched based on vehicle category, target city, case status, institution qualifications, cooperation status, and availability, excluding institutions with mismatched qualifications, excessive distance, or currently unavailable for booking, generating target service resource data. Knowledge retrieval data, business retrieval data, and target service resource data are written into knowledge context fields, business context fields, and resource context fields, respectively, generating fused context data.

[0117] Based on the context query data, the target response is determined to be explaining whether repair is currently possible and providing information on available service providers. Interaction status data is determined based on the continuous follow-up questions. Repair conditions, customer category, case status, and target service provider information are retrieved from the fused context data. A target template is selected from the Prompt template set based on the high-level customer category and the current interaction status, ensuring a professional, clear, and reassuring response tone, and defining the response structure including case status, repair conditions, service provider information, and appointment instructions. All data is written to the corresponding fields in the target template to generate response prompt data, which is then input into an LLM (Large Language Model) to generate the initial interaction text.

[0118] After the initial interaction text is generated, the case status description, repair conditions description, service provider name, address, and contact information are extracted. Business compliance checks include verifying for unconditional compensation or statements that any service provider can perform repairs. Entity format checks verify the address and contact information formats. Prohibited content checks for absolute commitments and prohibited service provider information. If the verification passes, the initial interaction text becomes the target interaction text; if it fails, a safety response is selected based on the failure type, replacing the corresponding text fragment. The final output indicates that the current case has been assessed, vehicle repair can be arranged, and lists partner service providers that meet the vehicle category, location, and service qualification requirements. It also indicates that the specific compensation scope is subject to the insurance terms, assessment results, and subsequent review.

[0119] In one embodiment, a context-based interactive text generation apparatus is provided, which corresponds one-to-one with the context-based interactive text generation method described in the above embodiments. (Refer to...) Figure 9 , Figure 9This is a schematic diagram of the functional modules of a preferred embodiment of the interactive text generation device based on context query of the present invention. The interactive text generation device based on context query includes: a context query generation module 10, a query standardization module 20, a dual-line retrieval module 30, a graph resource matching module 40, an interactive text generation module 50, and a content verification module 60. Detailed descriptions of each functional module are as follows: The context query generation module 10 is used to receive natural language input text, obtain previous historical dialogue text and current session metadata, and generate context query data based on the natural language input text, the previous historical dialogue text and the current session metadata; The query standardization module 20 is used to identify the query intent based on the context query data and fill in the missing entity information to generate standard query data. The dual-line retrieval module 30 is used to perform knowledge retrieval and business query based on the standard query data, and generate knowledge retrieval data and business retrieval data. The knowledge graph resource matching module 40 is used to acquire knowledge graph data, perform entity association, relationship path traversal and resource filtering based on the knowledge retrieval data, the business retrieval data and the knowledge graph data, generate target service resource data, and generate fusion context data based on the knowledge retrieval data, the business retrieval data and the target service resource data; The interactive text generation module 50 is used to generate response prompt data based on the context query data and the fused context data, and input the response prompt data into the language generation model to generate initial interactive text. The content verification module 60 is used to acquire content verification data, perform business compliance verification, entity format verification, and prohibited content verification on the initial interactive text based on the content verification data, generate content verification results, and determine the target interactive text based on the content verification results.

[0120] In one embodiment, the context query generation module 10 is specifically used for: Receive natural language input text, obtain session identifier data associated with the natural language input text, and determine the current interaction round data based on the session identifier data; Based on the session identifier data and the current interaction round data, obtain the historical dialogue records before the current interaction round, arrange the historical input text and historical reply text in the historical dialogue records according to the interaction round, and generate the previous historical dialogue text; Based on the session identifier data, obtain the interaction object identifier data, location data, object category data, and task status data, and generate the current session metadata based on the interaction object identifier data, the location data, the object category data, and the task status data; Generate contextual structure data that includes the current input field, historical dialogue field, session metadata field, session identifier field, and interaction round field; The natural language input text is written to the current input field, the previous historical dialogue text is written to the historical dialogue field, the current session metadata is written to the session metadata field, the session identifier data is written to the session identifier field, and the current interaction round data is written to the interaction round field. Context query data is generated based on the context structure data after the data writing is completed.

[0121] In one embodiment, the query standardization module 20 is specifically used for: Target expression data, behavioral expression data, and constraint expression data are extracted from the natural language input text in the context query data. The query intent is determined based on the target expression data, the behavioral expression data, the constraint expression data, and the preceding historical dialogue text in the context query data. Explicit entity information and pointer expression data are extracted from the natural language input text in the context query data, and candidate entity information is extracted from the previous historical dialogue text and current session metadata in the context query data. Based on the query intent and the explicit entity information, the missing entity information is determined, the missing entity information is matched with the candidate entity information by entity category, and the index expression data is matched with the candidate entity information by semantic index to generate entity completion information; The missing entity information in the natural language input text is completed based on the entity completion information, and the completed natural language input text is reconstructed based on the query intent, the explicit entity information, and the entity completion information to generate standard query data.

[0122] In one embodiment, the dual-line retrieval module 30 is specifically used for: Extract query text data and business query entity data from the standard query data. The business query entity data includes interactive object identification data, object category data, location constraint data, and task status constraint data. The query text data is converted into a query feature vector using a semantic coding model, and a knowledge retrieval request is generated based on the query feature vector. Write the interaction object identifier data into the interaction object identifier field, write the object category data into the object category field, write the location constraint data into the location field, and write the task status constraint data into the task status field to generate a business query request. Generate query identifier data, and write the query identifier data into the knowledge retrieval request and the business query request respectively. Send the knowledge retrieval request to the vector database and the business query request to the business data source in parallel. The system receives a set of candidate knowledge data and semantic matching data returned by the vector database based on the knowledge retrieval request, and receives interactive object feature data and dynamic business status data returned by the business data source based on the business query request. Each set of candidate knowledge data is associated with the corresponding semantic matching data, and the set of candidate knowledge data, the interactive object feature data, and the dynamic business status data are associated with the query identifier data. Based on the query identifier data, a set of candidate knowledge data, interactive object feature data, and dynamic business status data corresponding to the same standard query data are determined. The candidate knowledge data set is filtered based on preset knowledge filtering conditions and the semantic matching data to obtain knowledge retrieval data. The interactive object feature data and the dynamic business status data are then associated with the business query entity data to generate business retrieval data.

[0123] In one embodiment, the map resource matching module 40 is specifically used for: Acquire knowledge graph data, which includes graph node data, graph relationship data, and resource attribute data; Knowledge entity data, relationship type data, and resource filtering condition data are extracted from the knowledge retrieval data, and interactive object identification data, object category data, interactive object feature data, location constraint data, and dynamic business status data are extracted from the business retrieval data. The interactive object identifier data and the knowledge entity data are respectively associated with the graph node data to generate associated graph node data. Based on the object category data, the starting graph node data corresponding to the interactive object identifier data is determined from the associated graph node data. The associated graph node data corresponding to the knowledge entity data is determined as the constraint graph node data. Based on the relationship type data, target graph relationship data is filtered from the graph relationship data. Starting from the initial graph node data, the relationship path is traversed in the knowledge graph data based on the target graph relationship data to generate candidate relationship path data. Candidate resource node data that has a connection relationship with the constraint graph node data is determined from the candidate relationship path data. Candidate resource attribute data corresponding to the candidate resource node data is obtained from the resource attribute data. Based on the resource filtering condition data, the interaction object feature data, the location constraint data, and the dynamic business status data are matched with the candidate resource attribute data to generate a resource matching result. Based on the resource matching result, target resource node data is filtered from the candidate resource node data. Target resource attribute data corresponding to the target resource node data is selected from the candidate resource attribute data, and target relationship path data corresponding to the target resource node data is selected from the candidate relationship path data. Target service resource data is generated based on the target resource node data, the target resource attribute data, and the target relationship path data. Generate a context data structure containing a knowledge context field, a business context field, and a resource context field. Write the knowledge retrieval data into the knowledge context field, the business retrieval data into the business context field, and the target service resource data into the resource context field. Generate fused context data based on the context data structure after the data writing is completed.

[0124] In one embodiment, the interactive text generation module 50 is specifically used for: Based on the natural language input text and previous historical dialogue text in the context query data, the target response data and interaction status data are determined. Extract knowledge basis data corresponding to the knowledge retrieval data, interaction object feature data and dynamic business status data corresponding to the business retrieval data, and service resource data corresponding to the target service resource data from the fusion context data; Obtain a set of prompt word templates, select a target prompt word template from the set of prompt word templates based on the interaction object feature data and the interaction state data, determine the response tone data, and determine the response structure data based on the response target data; The target answer data, the interaction object feature data, the knowledge basis data, the dynamic business status data, the service resource data, the response tone data, and the response structure data are respectively written into the target prompt word template's target answer field, interaction object feature field, knowledge basis field, dynamic business status field, service resource field, response tone field, and response structure field to generate prompt word content data; Arrange the field content in the prompt word content data according to the reply structure data to generate the arranged prompt word content data, generate model instruction data based on the reply tone data, and generate reply prompt data based on the model instruction data and the arranged prompt word content data. The response prompt data is input into a language generation model, which then generates initial interactive text based on the model instruction data and the arranged prompt word content data in the response prompt data.

[0125] In one embodiment, the content verification module 60 is specifically used for: Acquire content verification data and security response data, wherein the content verification data includes business compliance condition data, entity format condition data, and prohibited content data; Extract business statement data and entity content data from the initial interaction text, and determine the business statement location data corresponding to the business statement data and the entity content location data corresponding to the entity content data. Based on the business compliance condition data, the entity format condition data, and the prohibited content data, business compliance verification, entity format verification, and prohibited content verification are performed on the business statement data, the entity content data, and the initial interaction text, respectively, generating business compliance verification results, entity format verification results, and prohibited content verification results, and determining the prohibited content location data corresponding to the prohibited content verification results; A content verification result is generated based on the business compliance verification result, the entity format verification result, the prohibited content verification result, the business statement location data, the entity content location data, and the prohibited content location data. The content verification result includes verification status data, failure type data, and failure text location data. When the verification status data indicates that the verification has passed, the initial interactive text is determined as the target interactive text; when the verification status data indicates that the verification has failed, the security response content is determined from the security response data based on the failure type data, and the text content indicated by the failure text position data in the initial interactive text is replaced with the security response content to generate the target interactive text. Output the target interactive text.

[0126] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides determination and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When executed by the processor, the computer program implements the functions or steps of a context-based query-based interactive text generation method on the server side.

[0127] In one embodiment, a computer device is provided, which may be a client, and its internal structure diagram may be as follows: Figure 11 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides determination and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with an external server via a network connection. When executed by the processor, the computer program implements client-side functions or steps of a context-based interactive text generation method.

[0128] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps: Receive natural language input text, obtain previous historical dialogue text and current session metadata, and generate context query data based on the natural language input text, the previous historical dialogue text and the current session metadata; Based on the context query data, the query intent is identified and missing entity information is filled in to generate standard query data; Based on the standard query data, knowledge retrieval and business queries are performed to generate knowledge retrieval data and business retrieval data. Acquire knowledge graph data, perform entity association, relationship path traversal and resource filtering based on the knowledge retrieval data, the business retrieval data and the knowledge graph data, generate target service resource data, and generate fusion context data based on the knowledge retrieval data, the business retrieval data and the target service resource data; Based on the context query data and the fused context data, response prompt data is generated, and the response prompt data is input into the language generation model to generate initial interactive text; Obtain content verification data, perform business compliance verification, entity format verification, and prohibited content verification on the initial interactive text based on the content verification data, generate content verification results, and determine the target interactive text based on the content verification results.

[0129] In one embodiment, a computer-readable storage medium is provided, which may be non-volatile or volatile, and a computer program is stored thereon. When the computer program is executed by a processor, it performs the following steps: Receive natural language input text, obtain previous historical dialogue text and current session metadata, and generate context query data based on the natural language input text, the previous historical dialogue text and the current session metadata; Based on the context query data, the query intent is identified and missing entity information is filled in to generate standard query data; Based on the standard query data, knowledge retrieval and business queries are performed to generate knowledge retrieval data and business retrieval data. Acquire knowledge graph data, perform entity association, relationship path traversal and resource filtering based on the knowledge retrieval data, the business retrieval data and the knowledge graph data, generate target service resource data, and generate fusion context data based on the knowledge retrieval data, the business retrieval data and the target service resource data; Based on the context query data and the fused context data, response prompt data is generated, and the response prompt data is input into the language generation model to generate initial interactive text; Obtain content verification data, perform business compliance verification, entity format verification, and prohibited content verification on the initial interactive text based on the content verification data, generate content verification results, and determine the target interactive text based on the content verification results.

[0130] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0131] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0132] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0133] It should be noted that any AI models, software tools, or components not belonging to this company appearing in the embodiments of this application are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this application has been authorized (with the knowledge and consent) by the relevant parties or has been fully authorized by all parties, and the executing entity may obtain it through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.

[0134] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions 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 invention, and should all be included within the protection scope of the present invention.

Claims

1. A method for generating interactive text based on context query, characterized in that, Includes the following steps: Receive natural language input text, obtain previous historical dialogue text and current session metadata, and generate context query data based on the natural language input text, the previous historical dialogue text and the current session metadata; Based on the context query data, the query intent is identified and missing entity information is filled in to generate standard query data; Based on the standard query data, knowledge retrieval and business queries are performed to generate knowledge retrieval data and business retrieval data. Acquire knowledge graph data, perform entity association, relationship path traversal and resource filtering based on the knowledge retrieval data, the business retrieval data and the knowledge graph data, generate target service resource data, and generate fusion context data based on the knowledge retrieval data, the business retrieval data and the target service resource data; Based on the context query data and the fused context data, response prompt data is generated, and the response prompt data is input into the language generation model to generate initial interactive text; Obtain content verification data, perform business compliance verification, entity format verification, and prohibited content verification on the initial interactive text based on the content verification data, generate content verification results, and determine the target interactive text based on the content verification results.

2. The interactive text generation method based on context query as described in claim 1, characterized in that, The system receives natural language input text, acquires previous historical dialogue text and current session metadata, and generates context query data based on the natural language input text, the previous historical dialogue text, and the current session metadata, including: Receive natural language input text, obtain session identifier data associated with the natural language input text, and determine the current interaction round data based on the session identifier data; Based on the session identifier data and the current interaction round data, obtain the historical dialogue records before the current interaction round, arrange the historical input text and historical reply text in the historical dialogue records according to the interaction round, and generate the previous historical dialogue text; Based on the session identifier data, obtain the interaction object identifier data, location data, object category data, and task status data, and generate the current session metadata based on the interaction object identifier data, the location data, the object category data, and the task status data; Generate contextual structure data that includes the current input field, historical dialogue field, session metadata field, session identifier field, and interaction round field; The natural language input text is written to the current input field, the previous historical dialogue text is written to the historical dialogue field, the current session metadata is written to the session metadata field, the session identifier data is written to the session identifier field, and the current interaction round data is written to the interaction round field. Context query data is generated based on the context structure data after the data writing is completed.

3. The interactive text generation method based on context query as described in claim 1, characterized in that, Based on the context query data, the query intent is identified and missing entity information is completed to generate standard query data, including: Target expression data, behavioral expression data, and constraint expression data are extracted from the natural language input text in the context query data. The query intent is determined based on the target expression data, the behavioral expression data, the constraint expression data, and the preceding historical dialogue text in the context query data. Explicit entity information and pointer expression data are extracted from the natural language input text in the context query data, and candidate entity information is extracted from the previous historical dialogue text and current session metadata in the context query data. Based on the query intent and the explicit entity information, the missing entity information is determined, the missing entity information is matched with the candidate entity information by entity category, and the index expression data is matched with the candidate entity information by semantic index to generate entity completion information; The missing entity information in the natural language input text is completed based on the entity completion information, and the completed natural language input text is reconstructed based on the query intent, the explicit entity information, and the entity completion information to generate standard query data.

4. The interactive text generation method based on context query as described in claim 1, characterized in that, Based on the aforementioned standard query data, knowledge retrieval and business queries are performed to generate knowledge retrieval data and business retrieval data, including: Extract query text data and business query entity data from the standard query data. The business query entity data includes interactive object identification data, object category data, location constraint data, and task status constraint data. The query text data is converted into a query feature vector using a semantic coding model, and a knowledge retrieval request is generated based on the query feature vector. Write the interaction object identifier data into the interaction object identifier field, write the object category data into the object category field, write the location constraint data into the location field, and write the task status constraint data into the task status field to generate a business query request. Generate query identifier data, and write the query identifier data into the knowledge retrieval request and the business query request respectively. Send the knowledge retrieval request to the vector database and the business query request to the business data source in parallel. The system receives a set of candidate knowledge data and semantic matching data returned by the vector database based on the knowledge retrieval request, and receives interactive object feature data and dynamic business status data returned by the business data source based on the business query request. Each set of candidate knowledge data is associated with the corresponding semantic matching data, and the set of candidate knowledge data, the interactive object feature data, and the dynamic business status data are associated with the query identifier data. Based on the query identifier data, a set of candidate knowledge data, interactive object feature data, and dynamic business status data corresponding to the same standard query data are determined. The candidate knowledge data set is filtered based on preset knowledge filtering conditions and the semantic matching data to obtain knowledge retrieval data. The interactive object feature data and the dynamic business status data are then associated with the business query entity data to generate business retrieval data.

5. The interactive text generation method based on context query as described in claim 1, characterized in that, Acquire knowledge graph data, perform entity association, relationship path traversal, and resource filtering based on the knowledge retrieval data, the business retrieval data, and the knowledge graph data, generate target service resource data, and generate fusion context data based on the knowledge retrieval data, the business retrieval data, and the target service resource data, including: Acquire knowledge graph data, which includes graph node data, graph relationship data, and resource attribute data; Knowledge entity data, relationship type data, and resource filtering condition data are extracted from the knowledge retrieval data, and interactive object identification data, object category data, interactive object feature data, location constraint data, and dynamic business status data are extracted from the business retrieval data. The interactive object identifier data and the knowledge entity data are respectively associated with the graph node data to generate associated graph node data. Based on the object category data, the starting graph node data corresponding to the interactive object identifier data is determined from the associated graph node data. The associated graph node data corresponding to the knowledge entity data is determined as the constraint graph node data. Based on the relationship type data, target graph relationship data is filtered from the graph relationship data. Starting from the initial graph node data, the relationship path is traversed in the knowledge graph data based on the target graph relationship data to generate candidate relationship path data. Candidate resource node data that has a connection relationship with the constraint graph node data is determined from the candidate relationship path data. Candidate resource attribute data corresponding to the candidate resource node data is obtained from the resource attribute data. Based on the resource filtering condition data, the interaction object feature data, the location constraint data, and the dynamic business status data are matched with the candidate resource attribute data to generate a resource matching result. Based on the resource matching result, target resource node data is filtered from the candidate resource node data. Target resource attribute data corresponding to the target resource node data is selected from the candidate resource attribute data, and target relationship path data corresponding to the target resource node data is selected from the candidate relationship path data. Target service resource data is generated based on the target resource node data, the target resource attribute data, and the target relationship path data. Generate a context data structure containing a knowledge context field, a business context field, and a resource context field. Write the knowledge retrieval data into the knowledge context field, the business retrieval data into the business context field, and the target service resource data into the resource context field. Generate fused context data based on the context data structure after the data writing is completed.

6. The interactive text generation method based on context query as described in claim 1, characterized in that, Based on the context query data and the fused context data, response prompt data is generated. The response prompt data is then input into a language generation model to generate initial interactive text, including: Based on the natural language input text and previous historical dialogue text in the context query data, the target response data and interaction status data are determined. Extract knowledge basis data corresponding to the knowledge retrieval data, interaction object feature data and dynamic business status data corresponding to the business retrieval data, and service resource data corresponding to the target service resource data from the fusion context data; Obtain a set of prompt word templates, select a target prompt word template from the set of prompt word templates based on the interaction object feature data and the interaction state data, determine the response tone data, and determine the response structure data based on the response target data; The target answer data, the interaction object feature data, the knowledge basis data, the dynamic business status data, the service resource data, the response tone data, and the response structure data are respectively written into the target prompt word template's target answer field, interaction object feature field, knowledge basis field, dynamic business status field, service resource field, response tone field, and response structure field to generate prompt word content data; Arrange the field content in the prompt word content data according to the reply structure data to generate the arranged prompt word content data, generate model instruction data based on the reply tone data, and generate reply prompt data based on the model instruction data and the arranged prompt word content data. The response prompt data is input into a language generation model, which then generates initial interactive text based on the model instruction data and the arranged prompt word content data in the response prompt data.

7. The interactive text generation method based on context query as described in claim 1, characterized in that, Obtain content verification data, perform business compliance verification, entity format verification, and prohibited content verification on the initial interactive text based on the content verification data, generate content verification results, and determine the target interactive text based on the content verification results, including: Acquire content verification data and security response data, wherein the content verification data includes business compliance condition data, entity format condition data, and prohibited content data; Extract business statement data and entity content data from the initial interaction text, and determine the business statement location data corresponding to the business statement data and the entity content location data corresponding to the entity content data. Based on the business compliance condition data, the entity format condition data, and the prohibited content data, business compliance verification, entity format verification, and prohibited content verification are performed on the business statement data, the entity content data, and the initial interaction text, respectively, generating business compliance verification results, entity format verification results, and prohibited content verification results, and determining the prohibited content location data corresponding to the prohibited content verification results; A content verification result is generated based on the business compliance verification result, the entity format verification result, the prohibited content verification result, the business statement location data, the entity content location data, and the prohibited content location data. The content verification result includes verification status data, failure type data, and failure text location data. When the verification status data indicates that the verification has passed, the initial interactive text is determined as the target interactive text; when the verification status data indicates that the verification has failed, the security response content is determined from the security response data based on the failure type data, and the text content indicated by the failure text position data in the initial interactive text is replaced with the security response content to generate the target interactive text. Output the target interactive text.

8. An interactive text generation device based on context query, characterized in that, The context-based interactive text generation device includes: The context query generation module is used to receive natural language input text, obtain previous historical dialogue text and current session metadata, and generate context query data based on the natural language input text, the previous historical dialogue text and the current session metadata; The query standardization module is used to identify the query intent based on the context query data and fill in the missing entity information to generate standard query data. The dual-line retrieval module is used to perform knowledge retrieval and business query based on the standard query data, and generate knowledge retrieval data and business retrieval data. The knowledge graph resource matching module is used to acquire knowledge graph data, perform entity association, relationship path traversal and resource filtering based on the knowledge retrieval data, the business retrieval data and the knowledge graph data, generate target service resource data, and generate fusion context data based on the knowledge retrieval data, the business retrieval data and the target service resource data; An interactive text generation module is used to generate response prompt data based on the context query data and the fused context data, and input the response prompt data into a language generation model to generate initial interactive text. The content verification module is used to acquire content verification data, perform business compliance verification, entity format verification, and prohibited content verification on the initial interactive text based on the content verification data, generate content verification results, and determine the target interactive text based on the content verification results.

9. A computer device, characterized in that, The computer device includes a memory, a processor, and a context-based interactive text generation program stored in the memory and executable on the processor, wherein the context-based interactive text generation program, when executed by the processor, implements the steps of the context-based interactive text generation method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a context-based interactive text generation program, which, when executed by a processor, implements the steps of the context-based interactive text generation method as described in any one of claims 1-7.