A multi-agent based tender intelligent generation and tender information collaboration system and method
By employing a multi-agent coordination architecture and intelligent sharding strategy, the problems of insufficient accuracy and data lag in bid information retrieval in existing bidding systems have been solved, achieving full-process automation and high efficiency in bidding business and ensuring the accuracy of data and retrieval.
Patent Information
- Application Number
- CN202611628840.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-21
- Publication Date
- 2026-11-20
AI Technical Summary
In existing bidding systems, the accuracy of bid information retrieval is insufficient, enterprise profile data is outdated, knowledge retrieval lacks re-ranking, document fragmentation strategies are simplistic, and multi-agent collaboration is lacking, resulting in low efficiency and susceptibility to errors in bidding processes.
It adopts a multi-agent coordination architecture, including a coordinating agent, an enterprise profiling module, a knowledge base construction and retrieval module, and a bidding information data management module. It achieves multi-agent collaboration by querying enterprise qualifications and performance history in real time, intelligently sharding knowledge documents, and using a dual-storage architecture and reordering model for bidding information retrieval.
It has achieved full-process automation of bidding and tendering business, improved overall efficiency, ensured the accuracy and timeliness of enterprise qualification and performance data, improved the accuracy and recall rate of retrieval, and supported the flexible deployment of embedded models on multiple platforms.
Smart Images

Figure CN123138397A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence and enterprise management software, specifically a multi-agent-based intelligent tender document generation and tender information collaboration system and method. Background Technology
[0002] Bidding and tendering is a crucial part of a company's operations. Its process is typically complex and rigorous, involving multiple interconnected yet relatively independent sub-tasks, such as tender information collection and screening, bid qualification review, tender document preparation, internal project initiation and collaboration, order approval, and management of bid bonds and financial ledgers. In existing technologies, management systems for these bidding and tendering processes are often fragmented and disjointed: tender information management systems can only provide a list of tender announcements with simple annotations, lacking in-depth analysis and intelligent filtering of announcement content; tender document generation tools are mostly simple document template fillers, unable to intelligently generate targeted and complete tender documents based on specific tender requirements and the company's own qualifications, performance, and other data; enterprise resource planning systems or financial systems independently maintain order and payment information, disconnected from the status of bidding projects. This results in the need for manual data entry and status synchronization even after winning a bid, leading to inefficiency and a high risk of errors.
[0003] Existing technical solutions suffer from the following significant technical shortcomings when performing specific tasks: First, insufficient accuracy in bid information retrieval. Traditional retrieval relies on literal keyword matching, failing to understand the user's natural language intent and the semantics behind the query. Furthermore, it cannot intelligently match retrieval results with the specific qualifications and capabilities of the bidding companies, resulting in noisy and low-relevance search results. Second, outdated enterprise profile data. Existing systems typically cache enterprise qualifications, personnel certificates, and other information in a single data table in JSON format. Manual cache refresh is required after data updates, leading to inconsistencies between the enterprise profile data obtained by upper-level applications such as artificial intelligence and actual data, affecting decision-making accuracy. Third, a lack of knowledge retrieval capabilities. Reordering is problematic. Traditional retrieval-enhanced generation systems rely solely on vector similarity for initial retrieval, failing to effectively distinguish semantically similar document fragments with significant differences in actual relevance, resulting in low-quality reference knowledge input into large language models. Fourth, document fragmentation strategies are simplistic. Existing knowledge base systems often employ mechanical fragmentation strategies with fixed lengths or fixed delimiters, neglecting the inherent structural features of documents, leading to compromised semantic integrity after fragmentation. Fifth, there is a lack of multi-agent collaboration. Existing AI assistants often adopt a direct response mode based on a single user question model, unable to decompose complex bidding tasks into multiple executable sub-tasks, nor can they extend their capabilities by calling external tools.
[0004] In summary, in current bidding and tendering scenarios, especially in environments with multiple companies, qualifications, and projects operating in parallel, manual judgment of qualification eligibility, manual combination of tender document sections, and manual synchronization of order and financial status are prone to delays and errors. Therefore, there is an urgent need to provide a multi-agent-based intelligent tender document generation and tender information collaboration system and method to overcome the shortcomings in current practical applications. Summary of the Invention
[0005] The purpose of this invention is to provide a multi-agent-based intelligent tender document generation and tender information collaboration system and method, which effectively solves the problems in the background art mentioned above.
[0006] This invention is implemented as follows: a multi-agent-based intelligent tender document generation and tender information collaboration system, comprising: The coordinating agent communicates with multiple functional agents and an external large language model to receive user input, identify user intent, observe loops by performing inference actions, call one or more of the functional agents to perform sub-tasks, and aggregate the returned results to generate a final response. The enterprise profiling module is connected to the coordinating agent and the relational database respectively. It is used to query and aggregate the enterprise's qualifications, personnel certificates and performance history information from the relational database in real time based on the enterprise identifier, generate structured enterprise profiling context text, and extract a list of matching keywords for the enterprise. The knowledge base construction and retrieval module is connected to the coordinating agent and the external vector database, respectively. It is used to intelligently segment knowledge documents to generate knowledge fragments and to store the knowledge fragments in both the relational database and the vector database using a dual-storage architecture. It is also used to respond to the retrieval request of the coordinating agent and return the most relevant knowledge fragment to the query through at least one of vector retrieval and reordering models. The bidding information data management module connects to both the coordinating agent and the external Elasticsearch cluster. It is used to construct and execute Elasticsearch queries that include a weighted list of matching keywords for the enterprise, in order to retrieve bidding information.
[0007] As a further aspect of the present invention: the functional intelligent agent includes: The tender parsing agent is used to acquire and parse the tender text and attachments, converting them into structured fields; The tender document generation agent is used to retrieve templates and materials based on the requirements of the structured announcement and generate a draft tender document; Project collaboration agent, used to create and maintain bidding projects and their schedules; The business and finance collaborative intelligent agent is used to link project status with orders, approvals, ledgers, and cash flow. An intelligent agent for matching enterprise qualifications is used to calculate the matching results between the announcement requirements and the context text of the enterprise profile; And an operation and maintenance monitoring intelligent agent, used to monitor the system's operating status and anomalies; The coordinating agent is specifically used for: Based on the current dialogue configuration, determine whether to enter Agent mode; In the Agent mode, obtain the current user's enterprise identifier; The enterprise profiling module is invoked to construct the enterprise profiling context text based on the enterprise identifier and to extract the enterprise matching keyword list; Construct prompt words that include system prompts, historical dialogues, current user messages, and contextual text of the enterprise profile; Input the prompt words and the list of available tools into the large language model to obtain the model response; If the model response includes a tool call instruction, the corresponding tool is parsed and executed, and the tool execution result is appended to the prompt word to continue looping until the model response no longer includes a tool call instruction.
[0008] As a further aspect of the present invention: the enterprise profiling module includes: The Enterprise Qualification Query Unit is used to query all non-deleted qualification records of an enterprise from the Enterprise Qualification Table in real time and format them as structured text. The personnel certificate query unit is used to query all non-deleted certificate records of an enterprise from the personnel certificate table in real time and format them into structured text. The performance history aggregation unit is used to query all non-deleted performance records of an enterprise from the performance history table in real time, and aggregate and calculate the total number of projects, the number of completed projects, the total amount of contracts, and the distribution of project types in memory, and format them into a text summary. The keyword extraction unit is used to extract keywords from the qualification records and certificate records, remove duplicates, and generate a list of keywords matching the enterprise.
[0009] As a further aspect of the present invention: the knowledge base construction and retrieval module includes: The document processing unit is used to parse knowledge documents in different formats and automatically select a segmentation strategy based on the document structure to divide the document into knowledge segments; The dual-storage writing unit is used to write the knowledge fragments into a relational database to store the full text and metadata, and to call the embedding model to convert the knowledge fragments into high-dimensional vectors and write them into a vector database, and to establish the association between the two storage units through vector record identifiers. The intelligent retrieval unit is used to respond to the retrieval request, perform vector retrieval in the vector database, and when the re-ranking function is enabled, call the re-ranking model to re-score and rank the retrieval results.
[0010] As a further aspect of the present invention: the bidding data management module includes: The bidding data acquisition unit is used to collect bidding data from external data sources and store it in a relational database. The Elasticsearch synchronization unit is used to synchronize the bidding data in the relational database to the Elasticsearch index, and to call the large language model to extract the qualification requirement information of the bidding during the synchronization process; The indicator retrieval unit is used to construct and execute Elasticsearch DSL query statements, which include: The full-text search section is used to match the user's query text against the title and content fields of the tender notice; The enterprise qualification matching section is used to perform weighted matching on the qualification requirement field of the bidding information based on the list of enterprise matching keywords. The structured filtering section is used for precise filtering of predefined fields.
[0011] This invention also provides a method for intelligent generation of tender documents and collaborative tender information based on multi-agent systems, employing the system described above, including: S1. The coordinating agent receives user input, identifies user intent, observes the loop by executing inference actions, calls one or more functional agents to execute sub-tasks, and aggregates the returned results to generate a final response; specifically including: Receive user conversation messages, including user-input text. Based on the current dialogue configuration, determine whether to enter Agent mode; In Agent mode, obtain the current user's enterprise identifier; The enterprise profiling module is invoked to construct an enterprise profiling context text in real time based on the enterprise identifier, and to extract a list of matching keywords for the enterprise from it. Construct prompt words that include system prompts, historical dialogues, current user messages, and contextual text of the enterprise profile; Execute the inference action observation loop, input the prompt words and the list of available tools into the large language model, and obtain the model response; If the model response includes a tool call command, the corresponding tool is parsed and executed, the tool execution result is appended to the prompt, and the loop continues until the model response no longer includes a tool call command, at which point the response is output as the final response. S2. The Enterprise Profile module queries and aggregates the enterprise's qualifications, personnel certificates, and performance records from the relational database in real time based on the enterprise identifier, generates structured enterprise profile context text, and extracts a list of matching keywords for the enterprise. S3. The knowledge base construction and retrieval module intelligently segments knowledge documents to generate knowledge fragments, and uses a dual storage architecture to store the knowledge fragments in both a relational database and a vector database; and, in response to a retrieval request, returns the most relevant knowledge fragment to the query through at least one of vector retrieval and reordering models. S4. The bidding information data management module constructs and executes an Elasticsearch query statement that includes a weighted list of matching keywords for the aforementioned enterprises, in order to retrieve bidding information; specifically including: Receive a bid search request, the request including the user's original query text and the company identifier; Based on the enterprise identifier, the enterprise profiling module is invoked to obtain the list of matching keywords for the enterprise; Construct an Elasticsearch DSL query statement, which includes: A full-text search component matches the user's original query text against the title and content fields of the advertisement; One enterprise qualification matching section performs weighted matching on the qualification requirement field of the bidding information based on the enterprise matching keyword list; A structured filtering section is used for precise filtering of predefined fields; Execute the DSL query statement to obtain the list of matching tagged items and the relevance score; Based on the bid ID, retrieve the complete bid details from the relational database and merge them into a bid list response.
[0012] As a further aspect of the present invention: in S3, the retrieval step specifically includes: Receive a search request that includes the text of the target search question; The target retrieval question text is converted into a query vector representation; A first-stage wide search is performed in the vector database to recall N candidate knowledge fragments, where N is greater than the final target number of returned K. Based on the identifiers of the N recalled candidate fragments, retrieve their complete text content from the relational database; The re-ranking model is invoked to re-score the semantic relevance of the complete text content of the target retrieval question and the N candidate knowledge fragments, and the K highest-scoring fragments are selected as the retrieval results.
[0013] As a further aspect of the present invention: in S3, the retrieval step specifically includes: Receive a search request that includes the text of the target search question; The target retrieval question text is converted into a query vector representation; Retrieve the top K vector records in the vector database that have the highest similarity to the query vector; Records with similarity scores below a preset threshold are filtered out, and search results are generated.
[0014] As a further aspect of the present invention: In S3, the step of intelligently segmenting knowledge documents specifically includes: Parse knowledge documents and generate raw text data; Automatic detection of fragmentation strategies is performed on the original text data to determine the target fragmentation strategy; When the target segmentation strategy is a question-and-answer-aware segmentation strategy, the title tags in the original text data are parsed, each title and its corresponding content are identified as a question-and-answer pair, and when the length of the answer text in the question-and-answer pair exceeds a preset threshold, the answer text is segmented, and each segmented answer fragment is pre-assembled with its corresponding complete question text to generate a knowledge fragment.
[0015] As a further aspect of the present invention: In S3, the step of intelligently segmenting knowledge documents specifically includes: Parse knowledge documents and generate raw text data; Automatic detection of fragmentation strategies is performed on the original text data to determine the target fragmentation strategy; When the target segmentation strategy is a semantically aware segmentation strategy, the text is recursively segmented according to priority, and overlapping processing is performed on adjacent knowledge segments to generate knowledge segments.
[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention organically integrates various processes such as tender information parsing, qualification matching, tender document generation, project collaboration, and business-finance linkage through a multi-agent collaborative architecture. It achieves fully automated processing from project opportunity discovery to final project execution and financial accounting, greatly improving the overall efficiency of bidding and tendering business and reducing delays and errors caused by manual intervention.
[0017] This invention replaces the traditional cached JSON reading method by querying and aggregating enterprise profile data from multiple business tables in a relational database in real time. This fundamentally ensures the accuracy and timeliness of enterprise qualifications, personnel certificates, and performance data on which artificial intelligence makes decisions and recommendations, avoiding incorrect matching and decision-making errors caused by data lag.
[0018] This invention effectively overcomes the shortcomings of traditional vector retrieval in terms of accuracy when dealing with semantically similar but topically different results through a two-stage retrieval re-ranking strategy of broad retrieval and fine ranking. The first stage ensures that no potentially relevant knowledge fragments are missed with a low threshold and a large recall. The second stage uses a specialized re-ranking model to perform fine semantic relevance evaluation on candidate results, significantly improving retrieval accuracy and recall. At the same time, through multi-strategy intelligent fragmentation, especially the question-answering aware fragmentation strategy based on Markdown structure, the segmented answer fragments are pre-assembled with the complete question text to ensure that each knowledge fragment still includes sufficient semantic context when retrieved individually, avoiding semantic loss caused by fragments deviating from the original document structure, and greatly improving the quality of retrieval enhancement generation.
[0019] This invention innovatively uses keywords extracted from enterprise profiles as weighted conditions in Elasticsearch for bid retrieval, enabling the search results to naturally tilt towards the enterprise's strengths and capabilities, thus achieving intelligent bid recommendation that accurately matches the enterprise's qualifications and capabilities.
[0020] The invention employs a dual-storage architecture design, namely, a traditional relational database storing full-text knowledge fragments and metadata, and a vector database storing vector representations. Bidirectional associations are established through vector record identifiers, which balances semantic retrieval capabilities and data management flexibility, supports data backup, recovery, and migration, and the vector database can be rebuilt without losing data, ensuring the reliability and maintainability of the system.
[0021] This invention supports the creation and switching of embedded models on multiple different platforms on demand through a dynamic multi-platform embedded model factory. Each knowledge base can be independently configured with an embedded model, which facilitates flexible deployment and comparative testing of models. Attached Figure Description
[0022] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0023] Figure 1 This is the local system architecture of the present invention. Figure 1 ; Figure 2 This is the local system architecture of the present invention. Figure 2 ; Figure 3 This is the local system architecture of the present invention. Figure 3 ; Figure 4This is a timing diagram of multi-agent interaction in an embodiment of the present invention; Figure 5 This is a flowchart of the method of the present invention. Detailed Implementation
[0024] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] The present invention will be further explained below with reference to specific embodiments.
[0026] Example 1: System Overall Architecture and Multi-Agent Collaborative Implementation like Figures 1-3 As shown, the present invention provides a multi-agent-based intelligent tender generation and tender information collaboration system, comprising: A multi-agent coordination module, comprising: The coordinating agent (Master Agent) is responsible for receiving user input, identifying intent, decomposing tasks, invoking sub-agents or tools, aggregating results, and generating a final response. The coordinating agent internally includes: Intent Recognition Unit: Determines user intent (such as tender search, enterprise analysis, tender document generation, etc.) based on user input text and historical dialogue context. The current version achieves this through implicit intent recognition using a large language model (the model automatically determines whether to invoke the tool based on system prompts and tool descriptions).
[0027] Task decomposition unit: Based on the identified intent, complex tasks are decomposed into multiple subtasks, each corresponding to a tool invocation. The current version achieves task decomposition through an iterative mechanism of the ReAct loop (i.e., the inference-action-observation loop) (the model determines which tool to invoke next in each round).
[0028] The ReAct loop execution engine executes a "reasoning-action-observation" loop for up to 10 rounds. In each round, it calls the large language model to determine whether a tool needs to be executed. After executing the tool, the result is appended to the prompt words to continue the loop until the final text response is generated. The engine uses non-streaming calls (ChatModel.call) to fully obtain the tool call instructions.
[0029] The results aggregation unit aggregates, formats, and sorts the execution results of multiple tools to generate a structured response. In the current version, results aggregation is implicitly performed by the large language model (the model generates a natural language response based on the tool results).
[0030] The tender notice parsing intelligent agent retrieves the tender notice text and attachments, and converts the project name, number, budget, region, procurement method, time node, and qualification conditions into structured fields.
[0031] The enterprise qualification matching agent reads the enterprise's qualifications, technical qualifications, materials, and historical records, and calculates the matching result between the announcement requirements and the enterprise's capabilities.
[0032] The project collaboration agent creates bidding projects and maintains information such as responsible persons, progress, attachments, quotations, partner companies, bidding results, and operation logs.
[0033] The operation and maintenance monitoring intelligent agent monitors announcements of anomalies, rule hits, lockouts, notes, reading feedback, task failures, and pending tasks.
[0034] The business and finance collaborative intelligent agent links project status with orders, approvals, ledgers, vouchers, security deposits, service fees, and cash flow.
[0035] Bidding Search Agent: Responsible for executing the bidding search tool (bidding_search), calling Elasticsearch to perform full-text search and enterprise qualification matching and weighting, retrieving bidding details from MySQL, and returning a list of bidding information.
[0036] Enterprise Analysis Agent: Responsible for executing enterprise analysis tools (enterprise_analyze), aggregating and calculating indicators such as bidding statistics, success rate, winning bid amount, regional distribution, and type distribution from traditional relational databases, and returning enterprise analysis reports.
[0037] Document Agent: Responsible for executing the document generation tool (current version is not fully implemented, with reserved extension interfaces), generating a draft of the bid document based on the bidding information and the company's qualifications.
[0038] The knowledge base construction and retrieval module includes: The document processing unit is responsible for acquiring knowledge documents (supporting formats such as PDF, DOCX, and Markdown), calling Apache Tika (version 1.1.2) for format parsing and content extraction, and automatically selecting a segmentation strategy (TOKEN, PARAGRAPH, MARKDOWN_QA, SEMANTIC, AUTO) based on the document type to segment the document into knowledge fragments. This document processing unit supports asynchronous execution; it returns immediately after the document is entered into the database, and the segmentation is completed in the background.
[0039] The dual-storage write unit is responsible for writing knowledge fragments to a traditional relational database (MySQL, ai_knowledge_segment table) to store the full text and metadata. It also calls an embedding model to transform the knowledge fragments into high-dimensional vectors, which are then written to a vector database (SimpleVectorStore, Qdrant, Redis, Milvus are supported). A bridge relationship between the two storage systems is established using vectorId. This dual-storage write unit supports both batch writing and incremental updates.
[0040] The intelligent retrieval unit is responsible for receiving retrieval requests, calling the embedding model to convert the query text into query vectors, performing similarity retrieval in the vector database, and optionally enabling two-stage retrieval re-ranking (first stage 4x over-ranking, second stage DashScope gte-rerank-v2 fine-tuning). It also retrieves full-text content of knowledge fragments from traditional relational databases and assembles the retrieval results. The intelligent retrieval unit supports multi-knowledge-base joint retrieval (retrieving results from each knowledge base independently and then merging them).
[0041] The enterprise profiling module includes: The Enterprise Qualification Query Unit is responsible for retrieving all non-deleted qualification records of an enterprise from the Enterprise Qualification Table (td_company_credential) in real time and formatting them as structured text. This query unit uses soft deletion filtering (deletedAt IS NULL OR '1970-01-01' OR '0000-00-00') and supports querying by enterprise ID index.
[0042] The personnel certificate query unit is responsible for retrieving all non-deleted certificate records of an enterprise from the personnel certificate table (td_technology_credential) in real time and formatting them as structured text. This query unit uses double soft deletion filtering (deletedAt + isDelete) and supports querying by enterprise ID index.
[0043] The performance history aggregation unit is responsible for querying all non-deleted performance records of a company in real time from the performance history table (td_company_material), aggregating and calculating the total number of projects, the number of completed projects, the total contract amount, the project type distribution, and a list of recent projects, formatting them as a text summary. This aggregation unit uses in-memory computing (Java Stream) and is suitable for small to medium-sized datasets (the number of performance records for a single company typically does not exceed 1000).
[0044] Keyword extraction unit: This unit is responsible for extracting a list of matching keywords from enterprise qualifications and personnel certificates, which are used for qualification matching weighting during bid search. The extraction unit performs keyword deduplication to avoid duplicate weighting.
[0045] The bidding information data management module includes: Bidding data acquisition unit: responsible for collecting bidding data from external data sources (such as the zc_notice table, raw bidding data collected by crawlers), pushing it to the tg_bidding_notice table (main database) through TergaNoticePushService, and performing field mapping and data cleaning (such as converting the price field from String to Integer).
[0046] The ES synchronization unit (BiddingEsSyncService) is responsible for synchronizing the bidding data in the tg_bidding_notice table (or zc_notice table, which can be configured) to the Elasticsearch index (bidding_notice). It supports full synchronization (used during initial initialization or reconstruction, paginated by ID cursor, 100 records per batch) and incremental synchronization (a scheduled task every 5 minutes, filtered by updatedAt). During synchronization, it calls the LLM (RequirementExtractionService) to extract qualification requirements (qualificationReqs, personnelReqs, performanceReqs, requirementKeywords) and writes them to the ES document.
[0047] The BiddingEsService unit is responsible for constructing Elasticsearch DSL queries, performing full-text search (multi_match), weighted matching of enterprise qualifications (should), and structured filtering (filter), and returning a list of bids and relevance scores. This unit supports highlighting (title and requirementKeywords fields), pagination (from / size), and sorting (defaulting to descending order of relevance score).
[0048] In a more specific example, the connections between the modules mentioned above are as follows: The output of the multi-agent coordination module is connected to the input of the knowledge base construction and retrieval module, transmitting a retrieval request (target retrieval question text and target knowledge base identifier list).
[0049] The output of the multi-agent coordination module is connected to the input of the enterprise profiling module, transmitting the enterprise identifier (companyId).
[0050] The output of the multi-agent coordination module is connected to the input of the tag data management module, transmitting tag search requests (query parameters and tool context).
[0051] The output of the enterprise profiling module is connected to the input of the multi-agent coordination module, and returns the enterprise profiling context text (memberProfileContext) and the list of matching keywords (matchKeywords).
[0052] The output of the knowledge base construction and retrieval module is connected to the input of the multi-agent coordination module, and returns a set of reference knowledge segments.
[0053] The output of the tag data management module is connected to the input of the multi-agent coordination module, and returns a tag list response (BiddingItem list).
[0054] The output of the multi-agent coordination module is connected to the large language model interface (Spring AI ChatModel), which transmits prompts and obtains model responses.
[0055] The output of the multi-agent coordination module is connected to the client push interface (SSE / WebSocket) and streams the final reply (AiChatMessageSendRespVO).
[0056] The internal connections of the knowledge base construction and retrieval module are as follows: the output end of the document processing unit is connected to the input end of the dual storage writing unit, the dual storage writing unit is connected to the traditional relational database (MySQL) and the vector database (VectorStore) respectively, and the intelligent retrieval unit is connected to the traditional relational database and the vector database respectively.
[0057] The internal connections of the bidding data management module are as follows: the output end of the bidding data acquisition unit is connected to the input end of the ES synchronization unit, the ES synchronization unit is connected to the Elasticsearch cluster, and the bidding retrieval unit is connected to the Elasticsearch cluster and the traditional relational database.
[0058] In this embodiment, the business database preferentially uses a MySQL relational database for persistent storage of structured business data such as the bidding information table `tg_bidding_notice`, the company information table `tg_company`, the company qualification table `td_company_credential`, the personnel certificate table `td_technology_credential`, the performance history table `td_company_material`, the bidding project table `bid_project`, orders, ledgers, vouchers, and cash flow records. It also includes a company materials repository for storing unstructured data such as templates and historical bidding documents required for bid document generation. Furthermore, it includes a knowledge base, employing a dual-storage architecture: a knowledge segment table `ai_knowledge_segment` in a relational database for storing full-text knowledge segments and metadata, and a vector database for storing knowledge segment vectors, which can be any of Qdrant, Milvus, Redis, or SimpleVectorStore. Finally, it includes an Elasticsearch cluster as the bidding information search engine, indexing the bidding information data and supporting high-performance full-text search and complex queries.
[0059] This system also provides various basic services and data access interfaces, including: Enterprise profiling service, responsible for building enterprise profiles in real time; The search service is responsible for building and executing Elasticsearch queries; The document parsing engine, TikaDocumentReader, version 1.1.2, is based on Apache Tika and is used to parse documents of various formats. Embedded Model Factory is used to dynamically create and manage embedded model instances for different platforms. Supported platforms include Tongyi Qianwen, Wenxin Yiyan, Zhipu GLM, MiniMax, OpenAI, Azure OpenAI, and Ollam native models. For reranking models, DashScope gte-rerank-v2, based on a cross-encoder architecture, is preferred. A process engine is used to drive business processes such as project approval. Dialogue service for managing conversation logs; Role services are used to manage AI chat role configurations; The Hundred Refinements Memory service is used to save user preferences and historical interaction information across sessions.
[0060] like Figure 4The multi-agent interaction sequence diagram shows the following interaction flow: The user sends a dialogue message through a client, i.e., a PC or a mini-program. The coordinating agent receives the message and first initializes itself, loading role configurations and tool lists from the database. The coordinating agent determines whether the current dialogue is associated with a tool; if so, it enters Agent mode. In Agent mode, the coordinating agent invokes the enterprise profile service (i.e., the enterprise profile agent) to obtain the current user's enterprise profile context and matching keywords. The coordinating agent assembles all contextual information, including system prompts, enterprise profiles, historical messages, and user questions, into prompt words. The coordinating agent begins executing the ReAct loop: it sends the prompt words and a list of available tools, including bidding search tools, enterprise analysis tools, and bidding recommendation tools, to the large language model. The large language model returns a response, which may include one or more tool invocation instructions. The coordinating agent parses the tool invocation instructions and invokes the corresponding agent or tool, for example, invoking the bidding retrieval agent to perform a bidding search. The bidding retrieval agent performs the search task and returns the results to the coordinating agent. The coordinating agent appends the tool execution results to the prompt words as a tool response message and begins the next round of the ReAct loop, sending the updated prompt words back to the large language model. If the response from the large language model no longer includes tool invocation instructions, the loop ends, and the coordinating agent pushes the final response to the client via SSE (Server-Sent Events).
[0061] Example 2: Detailed Implementation of the Multi-Agent Coordination and Identifier Retrieval Method Please refer to Figure 5 This embodiment also provides a method for intelligent generation of tender documents and collaborative tender information based on multi-agent systems, using the system described in Embodiment 1, specifically including the following steps: S1. Multi-agent Coordination and Identifier Retrieval Method: This step describes how the processor achieves intelligent identifier retrieval and matching of enterprise capabilities through a multi-agent collaborative architecture, as detailed below: Step S101: The processor receives a dialogue message from the user, the dialogue message containing user input text and a dialogue identifier.
[0062] Specifically, the processor receives the conversation message through the sendStream method of the PC-side chat interface or the sendStream method of the mini-program interface, and extracts the user input text (content field) and the conversation identifier (conversationId field). The conversation message may also include: whether to enable online search (useSearch field), whether to use context (useContext field), and a list of attachment URLs (attachmentUrls field).
[0063] In step S102, the processor queries the associated configuration of the current dialogue from a traditional relational database based on the dialogue identifier.
[0064] Specifically, the processor calls the `validateChatConversationExists` method of the dialogue service (AiChatConversationService) to query the dialogue record table (ai_chat_conversation) and obtain the following information for the current dialogue: associated AI chat role ID (roleId), associated model ID (modelId), system prompt word template (systemMessage), temperature parameter (temperature), and maximum token count (maxTokens). The processor also verifies whether the currently logged-in user ID matches the user ID to which the dialogue belongs; if they do not match, an authorization exception is thrown.
[0065] Step S103: The processor loads the role configuration parameters based on the AI chat role identifier.
[0066] Specifically, the processor calls the getChatRole method of the role service (AiChatRoleService) to query the role configuration table (ai_chat_role) for: role name (name, such as "BiaoXun Intelligent Assistant"), system prompt word template (systemMessage), list of associated knowledge base identifiers (knowledgeIds, JSON array format), and list of associated tool identifiers (toolIds, JSON array format).
[0067] Step S104: The processor determines whether the AI chat character is associated with a tool.
[0068] Specifically, the processor determines whether the associated tool identifier list (toolIds) is not empty. If a tool is associated (toolIds is not empty), the processor executes step S105 (entering Agent mode and calling the sendAgentStream method); otherwise, the processor executes step S110 (entering direct dialogue mode and calling the sendChatMessageStream method).
[0069] Step S105: In Agent mode, the processor obtains the company ID associated with the currently logged-in user.
[0070] Specifically, the processor retrieves the corresponding company information from the member user table (member_user) based on the currently logged-in user ID (obtained from SecurityFrameworkUtils.getLoginUserId) and obtains the company identifier (companyId field). If the user has not bound a company (companyId is null), this step returns an empty value, and the company profile-related logic in subsequent steps will be skipped.
[0071] Step S106: The processor queries the enterprise profile data in real time based on the enterprise identifier.
[0072] Specifically, the processor calls the `buildProfileText` method of the EnterpriseProfileService and executes the following sub-steps: In step S1061, the processor queries the enterprise name (companyName field) and unified social credit code (creditCode field) from the enterprise basic information table (tg_company) based on the enterprise identifier. If the enterprise information does not exist, the processor returns an empty string and terminates the subsequent steps.
[0073] In step S1062, the processor queries all non-deleted qualification records of the enterprise from the enterprise qualification table (td_company_credential) based on the enterprise identifier.
[0074] Specifically, the processor calls the selectListByCompanyId method of the enterprise qualification Mapper (CompanyCredentialMapper) to construct the LambdaQueryWrapperX query conditions: companyId equals the target enterprise identifier, and the deletedAt field satisfies one of the following conditions: NULL, equals '1970-01-01 00:00:00', equals '0000-00-00 00:00:00' (soft delete marker compatible with old systems), and is sorted in descending order by id.
[0075] Each qualification record includes: qualification name (name field), qualification type (productType field), issuing unit (issueUnit field), validity period (validDate field), certificate number (number field), and acquisition date (getDate field).
[0076] The processor formats the qualification record into structured text, with the format: "- Enterprise Qualification (N items):\n · Qualification Name (Type: Qualification Type), Issuing Authority: Issuing Authority, Valid Until: Validity Period\n · ...".
[0077] By querying enterprise qualification data from a relational database in real time (instead of reading from cached JSON fields), the consistency between qualification data and source data is ensured, and each qualification record is managed independently, facilitating addition, modification, and deletion operations.
[0078] In step S1063, the processor queries the personnel certificate table (td_technology_credential) for all non-deleted certificate records of the enterprise based on the enterprise identifier.
[0079] Specifically, the processor calls the selectListByCompanyId method of the personnel certificate Mapper (TechnologyCredentialMapper) to construct the LambdaQueryWrapperX query conditions: companyId equals the target enterprise identifier, the deletedAt field satisfies the soft deletion filter condition, and the isDelete field is equal to 0 or NULL (double soft deletion mechanism), and sorted in descending order by id.
[0080] Each certificate record includes: person's name (name field), person's type (type field), certificate number (certNumber field), major (major field), professional title (professionalRanks field), work experience (workExperience field), and validity period (validDate field).
[0081] The processor formats the certificate record into structured text, with the format: "- Personnel Certificates (N people):\n · Name (Personnel Type), Certificate Number: Certificate Number, Major: Major Direction, Title: Title\n · ...".
[0082] In step S1064, the processor queries all non-deleted performance records of the enterprise from the performance history table (td_company_material) based on the enterprise identifier and performs aggregate calculation.
[0083] Specifically, the processor calls the selectListByCompanyId method of the performance history mapper (CompanyMaterialMapper) to construct the LambdaQueryWrapperX query conditions: companyId equals the target company identifier, and the deletedAt field satisfies the soft deletion filter condition, and is sorted in descending order by id.
[0084] The processor performs the following aggregation calculations on the query results: Total number of items: Counts the total number of records (COUNT); Number of completed projects: Count the number of records where the isFinish field equals 1 (COUNT WHERE isFinish=1); Total Contract Amount: Sum of all price fields (SUM price), ignoring NULL values; Project type distribution: Group and count by the projectType field (GROUP BY projectType), and take the top 5 types with the most occurrences; Recent Project List: Sorted in descending order by the startDate field, the first 5 records are selected. Each record contains the project name (projectName field), contract amount (price field), and start date (startDate field).
[0085] The processor formats the aggregation result into a text summary, with the following format: "Performance Overview: N projects in total, M projects completed, total contract amount X million yuan, project type: type A (K projects), type B (J projects)..., recent projects: project name 1 (amount), project name 2 (amount)...".
[0086] In step S1065, the processor concatenates the results of steps S1061 to S1064 into a member profile context text (memberProfileContext).
[0087] Specifically, the processor is assembled in the following format: [Current User Information (Automatically Injected from Membership Client)] [Company Profile] Company Name: XXX - Unified Social Credit Code: XXX - Enterprise Qualifications (N items): • Qualification 1 (Type: Type 1), Issuing Authority: Entity 1, Valid Until: Date 1 · ... - Personnel Certificates (M people): • Name 1 (Type 1), Certificate Number: Number 1, Major: Major 1, Professional Title: Professional Title 1 · ... - Performance Overview: A total of X projects, Y of which have been completed, with a total contract value of Z million yuan... Based on the above enterprise profiles and preference information, please use intelligent matching and filtering to recommend tenders, without the need to repeatedly confirm this information.
[0088] When recommending tenders, priority should be given to projects that match the company's qualifications and have relevant performance experience.
[0089] By injecting enterprise profiles into the system prompts of the large language model in the form of structured text, the model can understand the enterprise's qualifications, capabilities, staffing, and performance when generating responses, thereby providing personalized bidding recommendations and analysis.
[0090] Step S107: The processor extracts a list of matching keywords (matchKeywords) from the enterprise profile context text.
[0091] Specifically, the processor calls the getMatchKeywords method of the EnterpriseProfileService and executes the following sub-steps: Step S1071: The processor extracts keywords from the enterprise qualification records: For each qualification record, the qualification name (name field, such as "general contracting of construction engineering"), qualification type (productType field, such as "construction"), and issuing unit (issueUnit field, such as "Ministry of Housing and Urban-Rural Development") are extracted as independent keywords; at the same time, the qualification name and qualification type are concatenated into a complete keyword (such as "general contracting of construction engineering").
[0092] Step S1072: The processor extracts keywords from the personnel certificate records: For each certificate record, the personnel name (name field), personnel type (type field, such as "Level 1 Construction Engineer"), certificate number (certNumber field), major (major field, such as "Architectural Engineering"), professional title (professionalRanks field, such as "Senior Engineer"), and project type (projectType field, such as "Municipal Engineering") are extracted as keywords.
[0093] In step S1073, the processor performs deduplication on all keywords extracted in steps S1071 and S1072 (using the distinct operation of Java Stream) to generate the final list of matching keywords for enterprises.
[0094] The list of matching keywords for enterprises is used for qualification matching weighting in subsequent tender search (as a should condition for Elasticsearch queries), so that tenders that match the qualification requirements of bidding enterprises receive higher relevance scores and improve the accuracy of search results.
[0095] Step S108: The processor constructs the prompt for ReAct mode.
[0096] Specifically, the processor constructs the message list by concatenating the parts of the prompt in the following order. <message>): (a) System Message: Pre-set role setting text (systemMessage, from the role configuration table) + enterprise profile context text (memberProfileContext, from step S106) + optional user long-term memory text (obtained from BailianMemoryService, with the search keywords "user's preferred enterprises and bidding preferences"). If BailianMemoryService returns a non-empty memory text, it is appended to the system message in the format: "\n\n[This user's long-term memory]\nMemory text\nPlease use this information naturally and do not actively mention 'according to your memory'."
[0097] (b) Historical Dialogue Section: Query the historical message list of the current dialogue (sorted in ascending order by createTime) from the message table (ai_chat_message) of the traditional relational database, and convert the historical messages into message formats: user messages are converted to UserMessage, and assistant messages are converted to AssistantMessage. When context is enabled (useContext=true), all historical messages are retained; otherwise, only the most recent N messages are retained (N is determined by configuration).
[0098] (c) Current User Message: The user-input text (content field).
[0099] (d) Knowledge Base Reference Section (when a knowledge base is associated): For each associated knowledge base identifier, perform a knowledge base retrieval (see steps S201 to S205 for details). Then, wrap each knowledge fragment in the returned set of reference knowledge fragments with a preset reference tag and concatenate them in the following format: use <reference>< / reference> The marked content serves as a reference for this conversation: <reference> Knowledge Fragment 1 Content< / reference> <reference> Knowledge Fragment 2< / reference> ... Answer requirements: - Avoid mentioning that you are from <reference>< / reference> The knowledge acquired.
[0100] (e) Online Search Results (when online search is enabled): The user's input text is sent to the online search engine (AiWebSearchClient, based on Bocha AI API) to retrieve webpage search results (up to 10 results). Each webpage record includes a title, URL, summary, or snippet. The search results are then concatenated using preset search tags in the following format: use <websearch>< / websearch> The marked content serves as a reference for this conversation: <websearch title="标题1" url="URL1"> Abstract 1< / websearch> <websearch title="标题2" url="URL2"> Abstract 2< / websearch> ... Answer requirements: - Avoid mentioning that you are from <websearch>< / websearch> The knowledge acquired.
[0101] (f) Attachment section (when a user uploads an attachment): For each attachment URL, call HttpUtil to download the attachment content, parse it into text using TikaDocumentReader, wrap it with a pre-defined attachment tag, and then concatenate the text in the following format: use <attachment>< / attachment> Mark attachments uploaded by users in conversations: <attachment> Attachment 1 Contents< / attachment> <attachment> Appendix 2 Contents< / attachment> ... Answer requirements: - Avoid mentioning <attachment>< / attachment> The encoding format of the attachment.
[0102] (g) ToolContext: The tool context injects the list of matching keywords (matchKeywords), the current user ID (memberId), and the company identifier (companyId) for use in subsequent tool calls. The key-value pairs in the tool context include: TOOL_CONTEXT_MEMBER_ID=memberId, TOOL_CONTEXT_COMPANY_ID=companyId, and TOOL_CONTEXT_MATCH_KEYWORDS=matchKeywords.
[0103] Step S109: The processor executes the ReAct loop: calling the large language model and processing tool calls.
[0104] Specifically, the processor performs the following sub-steps: In step S1091, the processor inputs the prompt (Prompt, which includes a list of messages and ChatOptions) and the list of available tools (ToolCallbacks, loaded from the toolIds configured in the role) into the large language model, calls the full response interface of the large language model (non-streaming, ChatModel.call method), and obtains the model response (ChatResponse).
[0105] Step S1092: The processor extracts the assistant message from the model response and determines whether the assistant message contains tool call instructions (ToolCalls list).
[0106] When no tool call command is included (ToolCalls is null or an empty list), the processor takes the text content (text field) of the assistant message as the final reply and executes step S112.
[0107] When a tool call instruction is included, the processor executes step S1093.
[0108] Step S1093: The processor traverses the list of tool call instructions and parses each tool call instruction to obtain the tool name (name field) and call parameters (arguments field, JSON format).
[0109] In step S1094, the processor searches for the corresponding tool instance (ToolCallback) from the list of available tools (ToolCallbacks) based on the tool name, and executes the call method of the tool, passing in the call parameters (arguments) and the tool context (ToolContext).
[0110] Specifically, when the tool name is "bidding_search", the processor executes the bid search tool (BiddingSearchByEsToolFunction, see steps S301 to S310); when the tool name is "enterprise_analyze", the processor executes the enterprise analysis tool (EnterpriseAnalyzeToolFunction); and when the tool name is "bidding_recommend", the processor executes the bid recommendation tool (BiddingRecommendToolFunction).
[0111] When the tool throws an exception, the processor catches the exception and generates an error message (such as "Tool execution failed: Exception message"), and uses the error message as the result of the tool execution.
[0112] In step S1095, the processor appends the tool execution result to the message list of the prompt word in the form of a tool response message (ToolResponseMessage), with the format: ToolResponseMessage.builder().responses([ToolResponse(toolCallId, toolName, toolResult)]).build().
[0113] In step S1096, the processor pushes tool invocation progress information to the front end in the format: Invocation Tool: Tool Name. This information is streamed to the client via SSE (Server-Sent Events) so that the user can observe the tool invocation process in real time.
[0114] Step S1097: The processor determines whether the current loop count has reached the preset maximum count (AGENT_MAX_ROUNDS, preferably 10 times).
[0115] If the maximum number of attempts is not reached, the processor returns to step S1091 to continue the loop, and inputs the updated prompt (including the tool execution result) back into the large language model; otherwise, the processor generates a fallback response (such as "\n\nSorry, I tried many times but failed to complete your request. Please describe it in a different way.") and executes step S112.
[0116] In step S110, in direct dialogue mode (without tool association), the processor performs knowledge base retrieval and network search (if any), constructs prompt words (same as step S108), calls the streaming response interface of the large language model (StreamingChatModel.stream method), and obtains streaming text output (Flux). <chatresponse>).
[0117] In step S111, the processor pushes the streaming text output to the client in real time.
[0118] Specifically, the processor extracts the content (content field) and reasoning process (reasoningContent field) from each text chunk of the streaming output, assembles it into a response object (AiChatMessageSendRespVO), and pushes it to the client via SSE streaming.
[0119] In step S112, the processor persists the text content of the final reply to the message table of a traditional relational database.
[0120] Specifically, the processor updates the assistant message log (ai_chat_message table), setting the content field to the final reply text and the reasoningContent field to the reasoning process text (if any). When the message content is empty (e.g., the user cancels the request), the processor deletes the message log.
[0121] In step S113, the processor asynchronously calls BailianMemoryService to write the user input and assistant response of this conversation into long-term memory.
[0122] Specifically, the processor calls the addMemoryAsync method of the Bailian Memory service, passing in the user ID, user input text, and assistant reply text, and asynchronously writes it to the DashScope Memory API. The long-term memory is used to save user preferences and historical interaction information across sessions, and injects system prompts in subsequent conversations through part (a) of step S108.
[0123] S2. Intelligent Knowledge Base Retrieval Method: This step describes how the processor retrieves the most relevant knowledge fragments from the knowledge base to the user's query. It supports two-stage retrieval reordering and includes the following steps: Step S201: The processor receives a retrieval request from an external source, the retrieval request containing the target retrieval question text and a list of target knowledge base identifiers (knowledgeIds).
[0124] Specifically, the retrieval request is triggered by part (d) of step S108, whereby the processor traverses the target knowledge base identifier list and performs the following retrieval process for each knowledge base identifier.
[0125] In step S202, the processor loads the corresponding knowledge base configuration parameters from the traditional relational database.
[0126] Specifically, the processor queries the knowledge base table (ai_knowledge) for: the default topK value (top_k field, such as 10), the default similarity threshold (similarity_threshold field, such as 0.7), and the embedded model identifier (embedding_model_id field, associated with the ai_model table).
[0127] In step S203, the processor calls the embedding model associated with the target knowledge base to convert the target retrieval question text into a query vector representation.
[0128] Specifically, the processor obtains or creates the corresponding embedded model instance through the dynamic factory method (AiModelFactoryImpl.getOrCreateEmbeddingModel). The dynamic factory method queries the model configuration table (ai_model) based on the embedded model identifier to obtain the platform type (platform field, such as DashScope, OpenAI, etc.), model name (model field, such as text-embedding-v2), and API key identifier (key_id field, associated with the ai_api_key table).
[0129] Based on the platform type, the processor looks up the corresponding embedded model creator from the pre-set platform factory mapping table, passes in the model name and API key, creates an embedded model instance, and caches it in the model registry (ConcurrentHashMap).
[0130] The platforms supported by the embedded models include: DashScopeEmbeddingModel (based on spring-ai-alibaba 1.1.0.0-RC2), QianFanEmbeddingModel (based on springaicommunity qianfan-starter), ZhiPuAiEmbeddingModel (official Spring AI), MiniMaxEmbeddingModel (official Spring AI), OpenAIEmbeddingModel (official Spring AI), Azure OpenAIEmbeddingModel (official Spring AI), and OllamEmbeddingModel (local model, official Spring AI).
[0131] The processor inputs the target retrieval question text into the embedding model and outputs a query vector (a float array, the dimension of which is determined by the model, such as 1536 dimensions for DashScope text-embedding-v2).
[0132] Step S204: The processor determines whether the reordering function is enabled in the current knowledge base.
[0133] Specifically, the processor checks whether the reranking model (RerankModel, preferably DashScope gte-rerank-v2) is available via Spring dependency injection (@Autowired(required = false)) and whether the configuration item spring.ai.model.rerank is not false. If the reranking model exists and is configured to be enabled, it is determined that reranking is enabled; otherwise, it is determined that reranking is not enabled.
[0134] In step S205, when reordering is enabled, the processor performs a first-stage wide search.
[0135] Specifically, the processor inputs the query vector into the vector database (VectorStore, currently SimpleVectorStore is used by default, but can be switched to Qdrant, Milvus or Redis in production environment), calls the similarity search interface (search method) of the vector database, and retrieves the top N vector records with the highest similarity to the query vector, where N = topK × preset search multiple, and the preset search multiple is preferably 4 (i.e., retrieves 4 times the number of candidate results).
[0136] In the first stage of wide search, the processor does not set a similarity threshold filtering condition (SearchRequest.builder().similarityThreshold(0.0)) in order to recall as many candidate knowledge fragments as possible and avoid missing potentially relevant results.
[0137] The vector database calculates the similarity between the query vector and each vector record in the database based on the vector distance metric (determined by the default implementation of the vector database, such as cosine similarity used by SimpleVectorStore, cosine similarity used by Qdrant, and L2 distance or inner product used by Milvus), and returns the first N records in descending order of similarity.
[0138] Each returned vector record contains: a vector record identifier (vectorId, assigned by the vector database), a similarity score (score, between 0 and 1, with higher scores indicating greater similarity), and metadata fields (containing three string fields: knowledgeId, documentId, and segmentId, used for subsequent queries of complete knowledge fragments from traditional relational databases).
[0139] Step S206: When reordering is enabled, the processor performs a second-stage fine sorting.
[0140] Specifically, the processor performs the following sub-steps: In step S2061, the processor queries the full text content (content field) of the corresponding knowledge segment from the knowledge segment table (ai_knowledge_segment) of the traditional relational database in batches, based on the segmentId of the N vector records returned in the first stage.
[0141] Step S2062, the processor assembles the target retrieval question text and the full text content of the N knowledge fragments into the input format (List) of the re-ranking model. <document>The re-ranking model is invoked (RerankModel.call method), and the re-ranking options (DashScopeRerankOptions.withTopN(topK)) are passed in. The re-ranking model then re-scores the semantic relevance between each knowledge fragment and the target retrieval question.
[0142] The re-ranking model (DashScope gte-rerank-v2) is based on a cross-encoder architecture, which can simultaneously consider the semantic interaction between the query text and the candidate text. Compared with the vector similarity calculation of the dual-encoder, it can more accurately evaluate semantic relevance.
[0143] In step S2063, the processor selects the top K knowledge fragments from the N candidate knowledge fragments in descending order of the re-scoring results, and filters out knowledge fragments with similarity scores lower than the similarity threshold (configured from step S202), generating a target knowledge fragment set (List). <aiknowledgesegmentsearchrespbo>).
[0144] This two-stage retrieval method (broad search followed by fine ranking) ensures that no potentially relevant knowledge fragments are missed by using a lower threshold and a larger recall (4 times the over-search). The second stage uses a specialized re-ranking model to perform a fine-grained semantic relevance evaluation on candidate results, ultimately outputting high-quality retrieval results. Compared to directly retrieving the top K results, the two-stage method can significantly improve retrieval precision and recall, especially in scenarios where semantics are similar but relevance differs greatly (e.g., "construction qualification" and "architectural design qualification" are semantically similar but have very different relevance).
[0145] In step S207, when reordering is not enabled, the processor performs a direct retrieval.
[0146] Specifically, the processor inputs the query vector into the vector database, retrieves the top K vector records with the highest similarity to the query vector, and filters out records with similarity scores lower than the similarity threshold to generate a set of target knowledge fragments.
[0147] In step S208, the processor queries the full text content and document name of the corresponding knowledge segment from a traditional relational database based on the segmentId of each knowledge segment in the target knowledge segment set, and assembles them into a retrieval result.
[0148] Specifically, the processor queries the knowledge segment table (ai_knowledge_segment) for each knowledge segment's content (content field) and its associated document identifier (documentId field); then it queries the document name (name field) from the document table (ai_knowledge_document). The processor then assembles the query results into a list of retrieval result objects. <aiknowledgesegmentsearchrespbo>Each record contains: knowledge segment content, document name, similarity score, and knowledge segment identifier.
[0149] Step S209: The processor updates the retrieval count of each knowledge fragment in the target knowledge fragment set to record the frequency at which each knowledge fragment is hit.
[0150] Specifically, for each hit knowledge segment, the processor increments the retrieval_count field value by 1 in the knowledge segment table (ai_knowledge_segment) of the traditional relational database by 1 (UPDATE ai_knowledge_segmentSET retrieval_count = retrieval_count + 1 WHERE id = segmentId).
[0151] By recording search queries, data support is provided for subsequent knowledge base quality analysis and knowledge fragment optimization. Administrators can identify frequently accessed knowledge fragments (which may be core knowledge points) and zero-access knowledge fragments (which may be redundant or low-quality content) based on search query statistics, thereby optimizing the knowledge base content.
[0152] In step S210, the processor returns the search results to the caller (part (d) of step S108) to construct the knowledge base reference part of the prompt words.
[0153] S3, Bid Message Search and Enterprise Capability Matching Method: This step describes how the processor executes the bid message search tool and uses enterprise matching keywords for Elasticsearch retrieval weighting. Specifically, it includes the following steps: In step S301, the processor receives a tool invocation instruction from the large language model, the instruction containing the name of the bidding search tool ("bidding_search") and invocation parameters.
[0154] Specifically, the call parameters (arguments field, JSON format) include: the user's original query text (query field, such as "help me find medical device tenders in Xiamen with a value of over 500,000 yuan"), province filter (province field, optional), city filter (city field, optional), minimum amount (priceFrom field, unit yuan, optional), maximum amount (priceTo field, unit yuan, optional), tendering method (noticeType field, such as "open tender" or "competitive negotiation", optional), publication date (publishDateFrom field, format yyyy-MM-dd, optional), publication date (publishDateTo field, format yyyy-MM-dd, optional), whether to only query tenders that have not expired (onlyActive field, default true), page number (page field, default 1), and number of pages per page (pageSize field, default 10, maximum 20).
[0155] In step S302, the processor extracts the company identifier (companyId) from the tool context.
[0156] Specifically, in part (g) of step S108, the processor has injected the enterprise identifier into the tool context (with the key TOOL_CONTEXT_COMPANY_ID), which is retrieved here via toolContext.getContext().get(TOOL_CONTEXT_COMPANY_ID). This step returns null if the tool context does not contain an enterprise identifier (e.g., the user has not bound an enterprise).
[0157] Step S303: The processor obtains a list of matching keywords (companyKeywords) based on the enterprise identifier.
[0158] Specifically, when the enterprise identifier is not null, the processor calls the getMatchKeywords method of the enterprise profile service (see step S107) to obtain the list of matching keywords for the enterprise; otherwise, the processor sets the list of matching keywords for the enterprise to an empty list.
[0159] Step S304: The processor constructs the Elasticsearch DSL query statement.
[0160] Specifically, the processor calls the buildEsQuery method of the BiddingEsService and executes the following sub-steps: Step S3041, the processor constructs the full-text search part (multi_match query): the user's original query text (query field) is used as the query term, and multi-field matching search is performed on four fields: title (title field, weight 3 times, i.e. "title^3"), content (content field, weight 1 times), qualification requirement keywords (requirementKeywords field, weight 2 times, i.e. "requirementKeywords^2"), and publisher (publishUser field, weight 1 times). The ik_smart analyzer is used for word segmentation, and the matching type is best_fields (take the field with the highest score).
[0161] DSL segment example: { "multi_match": { "query": "User query text", "fields": ["title^3", "content", "requirementKeywords^2", "publishUser"], "analyzer": "ik_smart", "type": "best_fields }} Step S3042: When the list of matching keywords for enterprises is not empty, the processor constructs the enterprise qualification matching part (should clause, as a bonus): For each enterprise matching keyword, a multi-field matching search is performed on the qualification requirement keywords (requirementKeywords field, weight 5 times, i.e., "requirementKeywords^5"), qualification requirement name (qualificationReqs.name field, weight 4 times, i.e., "qualificationReqs.name^4"), personnel certificate requirements (personnelReqs.cert field, weight 4 times, i.e., "personnelReqs.cert^4"), and qualification requirement full text (requirementText field, weight 2 times, i.e., "requirementText^2") fields, and the matching results are added to the query as a bonus (should clause).
[0162] DSL segment example (assuming there are 2 company keywords): { "multi_match": { "query": "General contracting of building construction projects", "fields": ["requirementKeywords^5", "qualificationReqs.name^4", "personnelReqs.cert^4", "requirementText^2"], "analyzer": "ik_smart }}, { "multi_match": { "query": "Level 1", "fields": ["requirementKeywords^5", "qualificationReqs.name^4", "personnelReqs.cert^4", "requirementText^2"], "analyzer": "ik_smart }} By weighting the matching of enterprise qualifications, bids that match the qualification requirements of the bidding enterprises receive a higher relevance score (the should clause increases the score but does not filter the results), thus improving the accuracy of search results. The weight settings (5x, 4x, 2x) make the score increase from qualification matching significant, but will not completely cover the basic score of full-text search.
[0163] Step S3043, the processor constructs the structured filtering part (filter clause, which does not participate in score calculation and is only used for filtering): When a province is specified (the province field is not empty), construct a bool query: the should clause contains two conditions: (1) perform an exact match on the province field (term query); (2) perform a fuzzy match on the region text field (regionText field, which is composed of province + city + district) (match query), using the ik_smart analyzer, with minimum_should_match set to 1 (either condition needs to be met).
[0164] When a city is specified (the city field is not empty), construct a bool query: the should clause contains two conditions: (1) perform an exact match on the city field; (2) perform a fuzzy match on the full text field of the region, with minimum_should_match set to 1.
[0165] When a range of amounts is specified (the priceFrom or priceTo field is not empty), a range query is constructed: the range is filtered on the budget amount (price field, unit yuan) field, priceFrom corresponds to gte (greater than or equal to), and priceTo corresponds to lte (less than or equal to).
[0166] When the bidding method is specified (noticeType field is not empty), construct a term query: perform an exact match on the bidding type (noticeType field) field.
[0167] When a date range is specified (the publishDateFrom or publishDateTo field is not empty), construct a range query: filter the range on the publish date (publishDate field, format yyyy-MM-dd).
[0168] When querying only non-expired tags (onlyActive field is true or null), construct a term query: filter on whether it has expired (isExpire field), isExpire=0 indicates that it has not expired.
[0169] DSL segment example (province + amount + not expired): { "bool": { "should": [ { "term": { "province": "Fujian"}}, { "match": { "regionText": "Fujian"}} ], "minimum_should_match": 1 }}, { "range": { "price": { "gte": 500000}}}, { "term": { "isExpire": 0}} Step S3044: The processor assembles the complete bool query: the full-text search part (step S3041) is used as the must condition (must be met and participates in the score calculation), the enterprise qualification matching part (step S3042) is used as the should condition (bonus item, participates in the score calculation but is not mandatory), and the structured filtering part (step S3043) is used as the filter condition (must be met, does not participate in the score calculation).
[0170] Complete boolean query DSL structure: { "bool": { "must": [Full-text search section], "should": [Company qualification matching section], "filter": [Structured filtering section] }} In step S305, the processor sends the Elasticsearch DSL query statement to the Elasticsearch cluster to perform a target search.
[0171] Specifically, the processor constructs a StringQuery object, passing in the DSL query statement (containing only the query part, excluding from / size / highlight), sets the pagination parameters: from = (page-1) × pageSize, size = pageSize (implemented via PageRequest.of(page-1, pageSize)), and sets the highlight parameters: highlighting the title and requirementKeywords fields, with the highlight tag being... <em> and< / em> (Implemented via HighlightQuery and HighlightField), call the Elasticsearch search interface (ElasticsearchOperations.search method) to retrieve search results (SearchHits). <biddingnoticeesdo>).
[0172] In step S306, the processor extracts a list of notice IDs and relevance scores from the Elasticsearch search results.
[0173] Specifically, the processor iterates through each hit record (SearchHit) in the search results and extracts: the notice ID (the noticeId field, corresponding to the id in the tg_bidding_notice table or the id in the zc_notice table), the relevance score (the score field, calculated by Elasticsearch), and the title highlight fragment (the highlightField("title") field, which contains...). <em>(Matching keywords wrapped in tags). The processor assembles the extracted results into a list of SearchItems.
[0174] In step S307, the processor queries the complete bidding details in batches from the bidding announcement table of the traditional relational database according to the bidding ID list.
[0175] Specifically, the processor determines the source of the notification ID: when the ES index (bidding_notice) is synchronized from the tg_bidding_notice table, the noticeId corresponds to the id in the tg_bidding_notice table; when the ES index is synchronized from the zc_notice table (see S4 for details), the noticeId corresponds to the id in the zc_notice table, and needs to be queried through the origin_notice_id field of the tg_bidding_notice table.
[0176] The processor calls the `getBiddingNoticeListByIds` method of the BiddingNoticeService (when `noticeId` is `tg_bidding_notice.id`) or the `getBiddingNoticeListByOriginNoticeIds` method (when `noticeId` is `zc_notice.id`) to batch query the following information for each bidding notice from the BiddingNotice table (`tg_bidding_notice`): title (`title` field), project number (`projectCode` field), purchasing unit (`publishUser` field), province (`province` field), and city (`ci` field). The fields for bidding documents include: ty (county), district / county (district), budget amount (price, unit: yuan), bidding type (noticeType), publication date (publishDate), bid opening time (noticeOpenTime), start time for obtaining bidding documents (getNoticeStartTime), end time for obtaining bidding documents (getNoticeEndTime), bidding status (tenderStatus, 0 = bidding in progress, 1 = bidding in progress, 2 = successful bid), status (status), PDF link (pdfUrl), whether it has expired (isExpire), and whether it has been cancelled (isCancel).
[0177] In step S308, the processor merges the Elasticsearch search results with the MySQL query results and assembles them into a list of flags response.
[0178] Specifically, the processor uses the SearchItem list as a base (keeping the order returned by Elasticsearch, i.e., descending order of relevance scores), and associates the MySQL query results with the noticeId (or origin_notice_id) to assemble the BiddingItem list. Each BiddingItem contains: Bidding ID (id field), Title (title field), Project Number (projectCode field), Procurement Unit (publishUser field), Province (province field), City (city field), District (district field), Region (region field, composed of province+city+district), Budget Amount (price field), Amount Text (priceText field, formatted as "X billion yuan" or "X ten thousand yuan" or "X yuan"), Bidding Type (noticeType field), Publication Date (publishDate field), Bidding Opening Time (noticeOpenTime field), Start / End Time for Obtaining Bidding Documents, Bidding Status (tenderStatus field), Status (status field), PDF Link (pdfUrl field), Expiration Status (isExpire field), Cancellation Status (isCancel field), Relevance Score (score field), and Highlight Title (highlightTitle field).
[0179] When a certain item cannot be found in the MySQL query results (e.g., the data in Elasticsearch and the data in MySQL are inconsistent), the processor uses the summary data (title, province, city, price, noticeType, publishDate, isExpire) in the SearchItem as a fallback solution.
[0180] In step S309, the processor serializes the flag list response into JSON format and returns it to the large language model as the tool execution result.
[0181] Specifically, the processor calls Jackson ObjectMapper to serialize the Response object (containing the fields total, pageNo, pageSize, companyId, items, and suggestion) into a JSON string, which is then returned to step S1095 as the tool execution result (toolResult).
[0182] In step S310, the processor appends the tool execution result to the prompt and continues the ReAct loop (returning to step S1091).
[0183] S4. Knowledge base construction method based on dual-storage architecture. This step describes how the processor transforms external knowledge documents into searchable knowledge fragments and simultaneously stores them in a vector database and a traditional relational database. Specifically, it includes the following steps: Step S401: The processor acquires at least one knowledge document to be processed. The source of the knowledge document includes at least one of the following: a document file downloaded from a remote address via Hypertext Transfer Protocol and a document file read from a local storage medium. The file format of the knowledge document includes at least one of the following: PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, HTML, TXT, Markdown, RTF, and EPUB.
[0184] Specifically, the processor uses a document parsing engine (TikaDocumentReader, version 1.1.2, implemented based on Apache Tika) to perform format recognition and content extraction on the knowledge documents, uniformly converting documents of different formats into plain text data to generate original text data. The document parsing engine supports automatic detection of file encoding (such as UTF-8, GBK) and automatic extraction of metadata (such as title, author, and creation time).
[0185] Step S402: The processor performs automatic detection of the fragmentation strategy on the original text data to determine the target fragmentation strategy.
[0186] Specifically, the processor performs the following sub-steps: Step S4021, the processor determines whether the original text data is in Markdown format: count the number of lines in the text that start with a second-level heading mark (##). When the number of lines is greater than a preset heading threshold (preferably 2) and the proportion of heading lines to the total number of lines is greater than a preset proportion threshold (preferably 10%), it is determined to be in Markdown format.
[0187] Step S4022: When it is determined to be in Markdown format and the number of header lines is large, the processor determines the target segmentation strategy as the question-answering aware segmentation strategy (MARKDOWN_QA).
[0188] Step S4023: When it is determined that the format is not Markdown or the number of header lines is small, the processor determines the target fragmentation strategy as a semantically aware fragmentation strategy (SEMANTIC).
[0189] In addition, the processor also supports manual selection of the following splitting strategies: mechanical splitting strategy by token number (TOKEN, using Spring AI's TokenTextSplitter) and splitting strategy by paragraph boundary (PARAGRAPH, using SemanticTextSplitter with overlap=0).
[0190] In step S403, the processor performs text segmentation on the original text data according to the target segmentation strategy to generate at least one knowledge fragment.
[0191] Specifically, depending on the strategy, the processor executes different segmentation logic: When the target sharding strategy is a question-answering-aware sharding strategy, the processor executes the following sub-steps: Step S403a-1: The processor parses the second-level heading markers (##) in the original text data and identifies the text block corresponding to each second-level heading marker as a question-answer pair. The text after the second-level heading marker (up to the next second-level heading marker or the end of the document) is the question text, and the text below the second-level heading marker to the next second-level heading marker is the answer text.
[0192] In step S403a-2, for each question-answer pair, when the length of the answer text (estimated by tokens) is less than or equal to a preset length threshold (preferably 500 tokens), the processor retains the question-answer pair as a complete knowledge fragment.
[0193] Step S403a-3: When the length of the answer text exceeds a preset length threshold, the processor performs preliminary segmentation of the answer text according to paragraph boundaries (double line breaks \n\n) to obtain at least one paragraph text; for each paragraph text, it is further segmented according to sentence boundaries (Chinese period 。, question mark ?, exclamation mark ! or English period ., question mark ?, exclamation mark !) to obtain at least one sentence text; the segmented sentence texts are merged according to a preset Token limit (preferably 500 Tokens) to generate at least one answer fragment.
[0194] In step S403a-4, the processor prepends the complete question text (i.e., the content of the second-level heading mark) to each answer fragment, so that each knowledge fragment contains the complete question context, generating at least one knowledge fragment.
[0195] By pre-setting the question context, each knowledge fragment contains sufficient semantic information for the large language model to understand after being retrieved, avoiding semantic loss caused by fragments deviating from the original document structure. For example, if the answer to "## How to apply for a construction qualification?" in the original document is segmented into multiple fragments, each fragment will be pre-set with "How to apply for a construction qualification?", enabling the model to understand the context of the fragment content.
[0196] When the target fragmentation strategy is a semantically aware fragmentation strategy, the processor executes the following sub-steps: In step S403b-1, the processor recursively performs boundary segmentation on the text according to priority: First, it attempts to use three consecutive newline characters (i.e., blank lines between paragraphs \n\n\n) as the segmentation boundary; if a single segment still exceeds the Token limit (preferably 500 Tokens) after segmentation, then two consecutive newline characters (\n\n) are used as the segmentation boundary; if it still exceeds the limit, then a single newline character (\n) is used as the segmentation boundary; if it still exceeds the limit, then sentence boundaries (Chinese period, question mark, exclamation mark or English period, question mark, exclamation mark) are used as the segmentation boundary.
[0197] In step S403b-2, the processor performs overlap processing on adjacent knowledge fragments. The number of overlapping tokens is preferably 50, so that there is a semantically coherent overlapping area between adjacent fragments.
[0198] By prioritizing recursive segmentation, each knowledge fragment is ensured to be as semantically complete as possible (prioritizing paragraph integrity), while overlapping prevents key semantic information from being truncated at the segmentation boundary. For example, if a paragraph contains "Enterprise qualifications include Class A general contracting and Class A design. Among them, Class A general contracting applies to...", and it is segmented precisely at "Class A.", overlapping by 50 tokens ensures that the next fragment contains "Among them, Class A general contracting applies to...", maintaining semantic coherence.
[0199] In step S404, the processor performs a token count estimation for each knowledge fragment and generates a corresponding token count value.
[0200] Specifically, the processor estimates the number of tokens for each knowledge fragment's text content using a token count estimator (JTokkitTokenCountEstimator, implemented based on JTokkit). For Chinese text, the estimation is approximately 1 token per character; for English text, the estimation is approximately 1.3 tokens per word. The processor also includes a built-in SimpleTokenEstimator as an alternative, used when JTokkit is unavailable.
[0201] In step S405, the processor writes the at least one knowledge segment into a traditional relational database and assigns a globally unique sequence identifier (segmentId) to each knowledge segment.
[0202] Specifically, the processor performs the following sub-steps: In step S4051, the processor generates a corresponding database record (AiKnowledgeSegmentDO) for each knowledge segment. The record includes: a knowledge segment content field (content), a knowledge segment content length field (content_length, number of characters), a knowledge base identifier field (knowledgeId, associated with the ai_knowledge table id), a document identifier field (documentId, associated with the ai_knowledge_document table id), a token count field (tokens, from step S404), a retrieval count field (retrieval_count, initial value is 0), and a status field (status, default value is 1 indicating enabled).
[0203] In step S4052, the processor inserts the database record into the knowledge segment table (ai_knowledge_segment) of the traditional relational database, and the database returns an auto-incrementing primary key as the sequence identifier (segmentId, Long type).
[0204] The full-text content and metadata of knowledge fragments are persistently stored using traditional relational databases, supporting precise SQL-based queries, statistical analysis, and data management operations (such as querying all fragments by knowledge base ID, querying all fragments by document ID, and sorting by search order).
[0205] In step S406, the processor calls the vector embedding model to convert the text content of each knowledge fragment into a high-dimensional vector representation.
[0206] Specifically, the processor performs the following sub-steps: In step S4061, the processor searches for the corresponding embedded model instance in the model registry (ConcurrentHashMap) based on the embedded model identifier (embeddingModelId, from step S202) associated with the current knowledge base. If the embedded model instance does not exist, the processor creates the embedded model instance through the dynamic factory method (AiModelFactoryImpl.getOrCreateEmbeddingModel) and caches it in the model registry.
[0207] In step S4062, the processor inputs the text content of the knowledge fragment into the embedding model and outputs the corresponding high-dimensional vector representation (embedding vector, float array). The dimension of the high-dimensional vector is determined by the selected embedding model (e.g., DashScope text-embedding-v2 is 1536-dimensional, OpenAI text-embedding-ada-002 is 1536-dimensional).
[0208] In step S407, the processor writes the high-dimensional vector representation into the vector database and establishes an association between the vector index in the vector database and the sequence identifier.
[0209] Specifically, the processor performs the following sub-steps: In step S4071, the processor writes the high-dimensional vector representation along with three metadata fields into the vector database. The three metadata fields are: knowledge base identifier (knowledgeId, String type), document identifier (documentId, String type), and knowledge fragment identifier (segmentId, String type), all of which are converted to string type to be compatible with the metadata type restrictions of different vector databases (e.g., Qdrant does not support Long type metadata).
[0210] In step S4072, the vector database returns the vector record identifier (vectorId, String type) that was successfully written.
[0211] In step S4073, the processor writes the vector record identifier (vectorId) back to the corresponding knowledge segment record in the traditional relational database (UPDATE ai_knowledge_segment SET vector_id = ? WHERE id = ?), establishing a bridge relationship between the two storage systems.
[0212] By bridging dual storage using vectorId, the retrieval phase can first retrieve vector matching results and similarity scores from the vector database, and then use vectorId (or segmentId) to retrieve the complete knowledge fragment text content from the traditional relational database. This balances the semantic matching capabilities of vector retrieval with the full-text storage and management capabilities of relational databases. Simultaneously, the traditional relational database serves as the primary data storage, supporting data backup, recovery, and migration operations, while the vector database acts as a retrieval acceleration layer, allowing for reconstruction without data loss.
[0213] This invention also provides the following referenceable business modules: bidding announcements, bidding parsing, enterprise qualifications, enterprise materials, bidding projects, bidding attachments, bidding progress, orders, ledgers, vouchers, fund flow, approval processes, AI knowledge base, and intelligent tool invocation modules. These modules can be implemented using Spring Boot services, Spring AI, MySQL database, Redis caching, Elasticsearch data analysis engine, Qdrant vector database, process engine, and AI services.
[0214] The present invention also provides the following alternative implementations, including: Qualification matching algorithms can employ rule matching, keyword matching, vector semantic matching, or a hybrid scoring method. Tender documents can be generated using template filling, search-enhanced generation, or semi-automatic generation after manual confirmation. Workflow linkage can be achieved using a built-in state machine or an external BPM workflow engine.
[0215] In summary, the present invention has the following advantages: Multi-agent coordination architecture: Through a coordinating agent (Master Agent), multiple sub-agents such as tender information retrieval, enterprise analysis, and tender document generation are managed in a unified manner. The ReAct loop mode (up to 10 rounds of tool calls) is used to realize the automatic decomposition and execution of complex tasks. Compared with a single LLM directly responding, it can handle more complex bidding and tendering scenarios.
[0216] Real-time enterprise profile injection: Enterprise data is queried in real time from the enterprise qualification table, personnel certificate table, and performance history table (instead of reading from cached JSON), and assembled into an enterprise profile context text injection with large language model hints to ensure data consistency. Moreover, the data for the three dimensions of qualification, certificate, and performance comes from independently managed relation tables, which facilitates independent maintenance and access control.
[0217] Enterprise qualification matching weighted retrieval: Extract qualification and certificate keywords from enterprise profiles and use them as should conditions for weighted matching (5x, 4x, 2x weights) when searching for Elasticsearch tags. This improves the matching degree between search results and enterprise capabilities. Compared with pure keyword matching, it can more accurately recommend tags that match enterprise qualifications.
[0218] Dual storage architecture bridged with vectorId: Traditional relational databases store full-text knowledge fragments and metadata, while vector databases store vectors and metadata. A two-way association is established through vectorId, balancing semantic retrieval capabilities and data management flexibility. It supports data backup, recovery, and migration, and the vector database can be rebuilt without losing data.
[0219] Two-stage retrieval re-ranking: The first stage performs broad recall with 4 times the over-retrieval volume (without a threshold), and the second stage uses the DashScope gte-rerank-v2 re-ranking model (based on a cross-encoder architecture) to finely evaluate relevance and select the top K, which significantly improves retrieval accuracy, especially in scenarios where the semantics are similar but the relevance is different.
[0220] Multi-strategy document intelligent segmentation: Provides 5 segmentation strategies (TOKEN, PARAGRAPH, MARKDOWN_QA, SEMANTIC, AUTO). The optimal strategy is selected by automatically detecting the document type (based on title tag statistics). The MARKDOWN_QA strategy solves the problem of semantic loss of knowledge fragments by using the context of the preceding question. The SEMANTIC strategy ensures semantic integrity by using priority recursive segmentation (three line breaks → double line breaks → single line breaks → sentence boundaries) and overlap processing (50 tokens).
[0221] Dynamic Multi-Platform Embedded Model Factory: Creates embedded model instances on demand through the factory pattern, supporting 7 platforms (Tongyi Qianwen, Wenxin Yiyan, Zhipu GLM, MiniMax, OpenAI, Azure OpenAI, Ollam). Each knowledge base can be independently configured with embedded models, which are dynamically loaded at runtime, facilitating model switching and A / B testing.
[0222] The definitions of some terms used in the embodiments of this invention are shown in Table 1: Table 1. Glossary of Terms
[0223] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; 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 or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.< / em> < / biddingnoticeesdo> < / aiknowledgesegmentsearchrespbo> < / aiknowledgesegmentsearchrespbo> < / document> < / chatresponse> < / message>
Claims
1. A multi-agent-based intelligent tender document generation and tender information collaboration system, characterized in that, include: The coordinating agent communicates with multiple functional agents and an external large language model to receive user input, identify user intent, observe loops by performing inference actions, call one or more of the functional agents to perform sub-tasks, and aggregate the returned results to generate a final response. The enterprise profiling module is connected to the coordinating agent and the relational database respectively. It is used to query and aggregate the enterprise's qualifications, personnel certificates and performance history information from the relational database in real time based on the enterprise identifier, generate structured enterprise profiling context text, and extract a list of matching keywords for the enterprise. The knowledge base construction and retrieval module is connected to the coordinating agent and the external vector database, respectively. It is used to intelligently segment knowledge documents to generate knowledge fragments and to store the knowledge fragments in both the relational database and the vector database using a dual-storage architecture. It is also used to respond to the retrieval request of the coordinating agent and return the most relevant knowledge fragment to the query through at least one of vector retrieval and reordering models. The bidding information data management module connects to both the coordinating agent and the external Elasticsearch cluster. It is used to construct and execute Elasticsearch queries that include a weighted list of matching keywords for the enterprise, in order to retrieve bidding information.
2. The system according to claim 1, characterized in that, The functional intelligent agent includes: The tender parsing agent is used to acquire and parse the tender text and attachments, converting them into structured fields; The tender document generation agent is used to retrieve templates and materials based on the requirements of the structured announcement and generate a draft tender document; Project collaboration agent, used to create and maintain bidding projects and their schedules; The business and finance collaborative intelligent agent is used to link project status with orders, approvals, ledgers, and cash flow. An intelligent agent for matching enterprise qualifications is used to calculate the matching results between the announcement requirements and the context text of the enterprise profile; And an operation and maintenance monitoring intelligent agent, used to monitor the system's operating status and anomalies; The coordinating agent is specifically used for: Based on the current dialogue configuration, determine whether to enter Agent mode; In the Agent mode, obtain the current user's enterprise identifier; The enterprise profiling module is invoked to construct the enterprise profiling context text based on the enterprise identifier and to extract the enterprise matching keyword list; Construct prompt words that include system prompts, historical dialogues, current user messages, and contextual text of the enterprise profile; Input the prompt words and the list of available tools into the large language model to obtain the model response; If the model response includes a tool call instruction, the corresponding tool is parsed and executed, and the tool execution result is appended to the prompt word to continue looping until the model response no longer includes a tool call instruction.
3. The system according to claim 1, characterized in that, The enterprise profiling module includes: The Enterprise Qualification Query Unit is used to query all non-deleted qualification records of an enterprise from the Enterprise Qualification Table in real time and format them as structured text. The personnel certificate query unit is used to query all non-deleted certificate records of an enterprise from the personnel certificate table in real time and format them into structured text. The performance history aggregation unit is used to query all non-deleted performance records of an enterprise from the performance history table in real time, and aggregate and calculate the total number of projects, the number of completed projects, the total amount of contracts, and the distribution of project types in memory, and format them into a text summary. The keyword extraction unit is used to extract keywords from the qualification records and certificate records, remove duplicates, and generate a list of keywords matching the enterprise.
4. The system according to claim 1, characterized in that, The knowledge base construction and retrieval module includes: The document processing unit is used to parse knowledge documents in different formats and automatically select a segmentation strategy based on the document structure to divide the document into knowledge segments. The dual-storage writing unit is used to write the knowledge fragments into a relational database to store the full text and metadata, and to call the embedding model to convert the knowledge fragments into high-dimensional vectors and write them into a vector database, and to establish the association between the two storage units through vector record identifiers. The intelligent retrieval unit is used to respond to the retrieval request, perform vector retrieval in the vector database, and when the re-ranking function is enabled, call the re-ranking model to re-score and rank the retrieval results.
5. The system according to claim 1, characterized in that, The bidding data management module includes: The bidding data acquisition unit is used to collect bidding data from external data sources and store it in a relational database. The Elasticsearch synchronization unit is used to synchronize the bidding data in the relational database to the Elasticsearch index, and to call the large language model to extract the qualification requirement information of the bidding during the synchronization process; The indicator retrieval unit is used to construct and execute Elasticsearch DSL query statements, which include: The full-text search section is used to match the user's query text against the title and content fields of the tender notice; The enterprise qualification matching section is used to perform weighted matching on the qualification requirement field of the bidding information based on the list of enterprise matching keywords. The structured filtering section is used for precise filtering of predefined fields.
6. A method for intelligent generation of tender documents and collaborative tender information based on multi-agent systems, employing the system described in any one of claims 1 to 5, characterized in that, include: S1. The coordinating agent receives user input, identifies user intent, observes the loop by executing inference actions, calls one or more functional agents to execute sub-tasks, and aggregates the returned results to generate a final response; specifically including: Receive user conversation messages, including user-input text. Based on the current dialogue configuration, determine whether to enter Agent mode; In Agent mode, obtain the current user's enterprise identifier; The enterprise profiling module is invoked to construct an enterprise profiling context text in real time based on the enterprise identifier, and to extract a list of matching keywords for the enterprise from it. Construct prompt words that include system prompts, historical dialogues, current user messages, and contextual text of the enterprise profile; Execute the inference action observation loop, input the prompt words and the list of available tools into the large language model, and obtain the model response; If the model response includes a tool call command, the corresponding tool is parsed and executed, the tool execution result is appended to the prompt, and the loop continues until the model response no longer includes a tool call command, at which point the response is output as the final response. S2. The Enterprise Profile module queries and aggregates the enterprise's qualifications, personnel certificates, and performance records from the relational database in real time based on the enterprise identifier, generates structured enterprise profile context text, and extracts a list of matching keywords for the enterprise. S3. The knowledge base construction and retrieval module intelligently segments knowledge documents to generate knowledge fragments, and uses a dual-storage architecture to store the knowledge fragments simultaneously in a relational database and a vector database; and, in response to a retrieval request, returns the most relevant knowledge fragment to the query through at least one of vector retrieval and reordering models. S4. The bidding information data management module constructs and executes an Elasticsearch query statement that includes a weighted list of matching keywords for the aforementioned enterprises, in order to retrieve bidding information; specifically including: Receive a bid search request, the request including the user's original query text and the company identifier; Based on the enterprise identifier, the enterprise profiling module is invoked to obtain the list of matching keywords for the enterprise; Construct an Elasticsearch DSL query statement, which includes: A full-text search component matches the user's original query text against the title and content fields of the advertisement; One enterprise qualification matching section performs weighted matching on the qualification requirement field of the bidding information based on the enterprise matching keyword list; A structured filtering section is used for precise filtering of predefined fields; Execute the DSL query statement to obtain the list of matching tagged items and the relevance score; Based on the bid ID, retrieve the complete bid details from the relational database and merge them into a bid list response.
7. The method according to claim 6, characterized in that, In S3, the retrieval steps specifically include: Receive a search request that includes the text of the target search question; The target retrieval question text is converted into a query vector representation; A first-stage wide search is performed in the vector database to recall N candidate knowledge fragments, where N is greater than the final target number of returned K. Based on the identifiers of the N recalled candidate fragments, retrieve their complete text content from the relational database; The re-ranking model is invoked to re-score the semantic relevance of the complete text content of the target retrieval question and the N candidate knowledge fragments, and the K highest-scoring fragments are selected as the retrieval results.
8. The method according to claim 6, characterized in that, In S3, the retrieval steps specifically include: Receive a search request that includes the text of the target search question; The target retrieval question text is converted into a query vector representation; Retrieve the top K vector records in the vector database that have the highest similarity to the query vector; Records with similarity scores below a preset threshold are filtered out, and search results are generated.
9. The method according to claim 6, characterized in that, In S3, the specific steps for intelligent fragmentation of knowledge documents include: Parse knowledge documents and generate raw text data; Automatic detection of fragmentation strategies is performed on the original text data to determine the target fragmentation strategy; When the target segmentation strategy is a question-and-answer-aware segmentation strategy, the title tags in the original text data are parsed, each title and its corresponding content are identified as a question-and-answer pair, and when the length of the answer text in the question-and-answer pair exceeds a preset threshold, the answer text is segmented, and each segmented answer fragment is pre-assembled with its corresponding complete question text to generate a knowledge fragment.
10. The method according to claim 6, characterized in that, In S3, the specific steps for intelligent fragmentation of knowledge documents include: Parse knowledge documents and generate raw text data; Automatic detection of fragmentation strategies is performed on the original text data to determine the target fragmentation strategy; When the target segmentation strategy is a semantically aware segmentation strategy, the text is recursively segmented according to priority, and adjacent knowledge segments are overlapped to generate knowledge segments.
