Urban Management Special Planning System Based on Multi-Agent
By leveraging the three-layer context management and large language model service of the multi-agent planning system, the compliance and efficiency issues in urban management planning have been resolved. This has enabled the stability and consistency of long document generation, supported text and image alignment, and improved planning efficiency.
Patent Information
- Application Number
- CN202611335399.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies pose compliance risks in the preparation of urban management special plans, making it difficult to maintain data consistency across chapters and align text and image semantics. Furthermore, they lack hierarchical retrieval of regulations and in-depth utilization of local knowledge, resulting in low efficiency in planning preparation.
A multi-agent-based urban management special planning system is adopted, which combines a three-layer global context management module (permanent layer, semi-stable layer, and volatile layer) with a large language model service to achieve dynamic filtering and incremental updates of information, ensuring compliance and efficiency.
It achieves constant complexity and high efficiency in generating long documents, ensuring the professionalism and compliance of planning, avoiding information loss and logical breaks, and supporting cross-chapter contextual consistency and semantic alignment of text and graphics.
Smart Images

Figure CN123117750A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence application technology, specifically to a system for compiling urban management special plans based on multi-agent systems. Background Technology
[0002] With the acceleration of urbanization, the demand for the preparation of special urban management plans (such as household waste classification plans and emergency facility layout plans) is increasing. These planning documents are usually over a hundred pages long, involving extensive data collection, multi-level legal and standard retrieval, cross-chapter data correlation and logical connection, and final professional formatting. Traditional manual preparation methods rely on planners to review national regulations, local standards, and technical guidelines one by one. This is not only time-consuming and labor-intensive, but also subject to constraints such as the strict hierarchical structure of planning regulations (higher-level laws prevail over lower-level laws), timeliness (clause repeal and revision), and regional applicability (differences at the provincial, municipal, and district levels). Manual retrieval is prone to missing key clauses or referencing repealed regulations, leading to compliance risks in the planning scheme.
[0003] Currently, the use of large language models to assist in document generation has received widespread attention, and some studies have proposed report generation methods based on multi-agent collaboration, which automate the writing of general reports through steps such as requirements analysis, data retrieval, outline planning, and content verification. However, these solutions are mainly geared towards general scenarios, and their retrieval mechanisms rely solely on keyword similarity matching, without incorporating regulatory hierarchy weights and regional filtering, thus failing to guarantee the compliance of cited sources. Furthermore, existing systems lack a structured context inheritance mechanism when processing long, professional documents, making it difficult to maintain consistency in numerical constraints across chapters (e.g., coverage targets set in previous chapters must still be used as planning criteria in subsequent chapters); their knowledge base utilization is also relatively crude, failing to fully integrate user-accumulated research materials and historical documents.
[0004] Furthermore, the preparation of planning documents requires a large number of visual materials such as renderings and diagrams. Existing systems generally separate text generation and image generation into two independent processes, and the spatial logic of image content (such as the correspondence between facility locations and textual descriptions of areas) cannot be automatically aligned with the text descriptions. Current technology lacks a system for preparing urban management special plans that can integrate hierarchical legal retrieval, cross-chapter contextual consistency maintenance, in-depth utilization of local knowledge, and semantic alignment of text and images, making it difficult to meet the comprehensive requirements of planning preparation for professionalism, compliance, and overall efficiency. Summary of the Invention
[0005] The present invention aims to provide a multi-agent-based urban management special planning system, which realizes the intelligent generation and management of contextual information in the planning field throughout the entire process, and can meet the comprehensive requirements of planning for professionalism, compliance and overall efficiency.
[0006] The basic solution provided by this invention is: a multi-agent-based urban management special planning system, including a planning workflow engine and an intelligent context management module; The planning workflow engine responds to user-inputted planning project parameters, concurrently calls multiple retrieval services to obtain multi-source heterogeneous data, and, based on the multi-source heterogeneous data and the preset planning type configuration template, calls the large language model service to stream the planning outline and the main text of each chapter. The intelligent context management module is used to maintain a global context object with a three-layer structure. The three-layer structure includes: a permanent layer, used to store project background, planning objectives, and terminology definitions, and the data in the permanent layer cannot be automatically overwritten by subsequent chapters; a semi-stable layer, used to store key indicators and constraints, and the data in the semi-stable layer is only allowed to be updated when it is clearly determined to be from a higher authoritative source; and a volatile layer, used to store temporary discussions and intermediate process data, and the data in the volatile layer is automatically eliminated according to time or capacity thresholds. Before calling the large language model service to generate the main text of the current chapter, keywords are extracted based on the title of the current chapter or user instructions. The semantic similarity between the keywords and each field in the global context object is calculated, and a subset of fields with similarity higher than a preset threshold is retained as the generation context. After the chapter text is generated, new information that conforms to the preset data structure is extracted from it. After verification, it is written to the corresponding layer of the global context object in an incremental update manner. The incremental update includes: when the new information conflicts with the existing information, the preset authority weights of the source chapters of the two are compared. Only when the authority weight of the new information is greater than or equal to the authority weight of the existing information is the overwrite performed. Otherwise, the existing information is retained and the conflict log is recorded.
[0007] The working principle and advantages of this invention are as follows: This invention relates to a multi-agent urban management special planning system, which realizes the intelligent generation and management of contextual information in the planning field throughout the entire process, and can meet the comprehensive requirements of planning in terms of professionalism, compliance, and overall efficiency. The key points are: This invention achieves long document generation with constant complexity. Existing technologies for long document generation generally involve expanding the context window, but this leads to a linear increase in memory usage and computation time, and the model still experiences information loss in the latter half of the window. This invention employs a three-layer storage mechanism (permanent layer – semi-stable layer – volatile layer) + dynamic filtering (only including a subset of fields exceeding a preset threshold in the generation context). This ensures that each time a large model is called, only a subset of context semantically relevant to the current chapter is loaded, rather than all historical content. This significantly reduces interference from irrelevant or weakly relevant information in the input, while also significantly compressing the token consumption per call. The system maintains a constant context length (rather than linearly increasing) regardless of document length, and generation time and token consumption do not deteriorate with increasing document length. It solves the efficiency bottleneck of long document generation at the architectural level rather than the hardware level, fundamentally avoiding logical breaks caused by large model window overflow or the squeezing out of key information. This allows the system to maintain stable generation quality and response speed even as document length is continuously expanded.
[0008] Furthermore, through a three-layer progressive structure of "permanent layer—semi-stable layer—volatile layer," this invention achieves differentiated governance of contextual information based on its lifecycle and credibility. The permanent layer locks in the project background, planning objectives, and terminology definitions, ensuring that core constraints are not eroded throughout the entire development cycle, thus fundamentally preventing deviations from objectives caused by "catastrophic amnesia" in the model. The semi-stable layer is updated prudently based on "source authority weights," avoiding contamination of key indicators by ad-hoc discussions or low-quality information, and ensuring the traceability of the decision-making chain. The volatile layer automatically discards temporary data based on time and capacity thresholds, maintaining the lightweight operation of the system. This approach protects high-value information while reserving a controllable channel for dynamic information updates.
[0009] Secondly, this invention explicitly encodes industry standards into a machine-executable rule system. When newly extracted indicators or constraints conflict with existing records, the system does not simply replace the old with the new or discard the old, but makes a hierarchical decision based on the preset authority weights corresponding to the source chapters of both. The planning document has a hierarchical authority of "target chapters are higher than implementation chapters," and the weight system is strictly aligned with the chapter importance hierarchy in planning practice (planning target chapters are higher than implementation chapters). This quantifies industry standards into machine-executable judgment logic, enabling the system to automatically make decisions that conform to industry standards when data conflicts occur, without human intervention. Attached Figure Description
[0010] Figure 1 This is a schematic diagram of the system architecture of the multi-agent-based urban management special planning system of the present invention. Detailed Implementation
[0011] The following detailed explanation illustrates the specific implementation methods: Example 1 The basic implementation examples are as follows: Figure 1 As shown: The urban management special planning system based on multi-agent architecture adopts a B / S architecture and consists of four layers: front-end display layer, back-end service layer, data storage layer and external service layer.
[0012] The front-end presentation layer is developed using HTML5, CSS3, and JavaScript separately. It is responsible for providing the user interface, including the project creation and configuration interface, the planning and compilation workbench, the special research workbench, the AI drawing workbench, and the document preview and export interface. The front-end interacts with the back-end service layer through asynchronous HTTP requests (such as XMLHttpRequest or Fetch API) and receives the generated content pushed by the back-end in a streaming manner through SSE.
[0013] The backend service layer is the core implementation layer of this invention. It is built on the lightweight Python Flask web framework and adopts a modular design. Each functional module is integrated into the main program through Python's import mechanism. It includes a planning and compilation workflow engine, an intelligent context management module, a specialized workflow engine, an AI drawing engine, a RAG retrieval enhancement module, a document generation module, an points management system, and a user authentication and permission management module.
[0014] The data storage layer uses a file system and JSON structured storage to store the project configuration files, three-layer global context objects, knowledge base files and vector indexes, drawing chat history, generated images and exported documents as described in the claims, in a completely isolated manner from user space. It also stores user points data, providing data persistence support for various backend modules.
[0015] The external service layer encapsulates large language model services (e.g., Alibaba Cloud DashScope Qwen series), web and academic search services (e.g., Serper API and Dify workflow), vector embedding and reordering services (e.g., Xinference), and multiple drawing APIs (e.g., Alibaba Cloud Tongyi Wanxiang, Baidu Smart Cloud Wenxin Yige, Google Gemini, Volcano Engine Seedream, Qwen Image), allowing the backend service layer to make unified calls. It also automatically switches to a backup channel when the primary service is unavailable, thus ensuring the system's robustness and scalability. The core functional modules in each layer are described in detail below.
[0016] 1. Intelligent Context Management Module.
[0017] The intelligent context management module maintains a global context object with a three-tier structure. Specifically, the intelligent context management module maintains an independent global context object for each planning project. This object is stored in the project file as a JSON file and resides in memory during system operation for fast read and write speeds. To prevent inconsistencies between memory data and disk data, a "synchronous write to disk on each update" strategy is adopted, meaning that the updated JSON object is written to the disk file immediately after each context update operation.
[0018] The three-layer structure includes: (1) Permanent layer, used to store core information that remains stable throughout the entire planning period or can only be changed by the user. Data in the permanent layer cannot be automatically overwritten by subsequent chapters. The permanent layer contains the following fields: The project background is derived from the project description entered by the user when creating the project. Once entered, this field is automatically updated by the system and will never be overwritten; users can only manually modify it through the project settings interface.
[0019] Planning objectives are stored as an array. Each objective entry contains three subfields: text (objective description text, such as "95% category coverage by 2025"), source_chapter (source chapter, such as "1.1 General Principles"), and locked (locked flag, default value is true). Once any objective entry in the permanent layer is written, no subsequent automatic update operation in any chapter may overwrite or delete that entry. When a new chapter produces a new objective description that conflicts with an existing objective, the new description is stored as a pending confirmation item in the volatile layer, and the user is prompted to manually confirm whether to replace the objective in the permanent layer.
[0020] Terminology definitions are stored as key-value pairs. The key is the standard term used in the plan (e.g., "recyclable materials"), and the value is a description or definition of that term (e.g., "waste suitable for recycling and resource recovery"). The terminology list also has a locking property. Once an entry is written, if subsequent LLM outputs contain expressions inconsistent with the terminology list (e.g., "recyclable waste"), the system will automatically replace them with the standard term during the post-processing stage of document generation; however, the terminology list itself will not be automatically updated.
[0021] The planning area information comes from the administrative division selected by the user when creating the project, and includes at least the area name and administrative division code (e.g., "Xihu District, Hangzhou City, 330106"). This information remains unchanged throughout the project lifecycle.
[0022] (2) A semi-stable layer is used to store critical data that may be updated as the planning process progresses but should not be easily overwritten by temporary or low-quality information. Data in the semi-stable layer is only allowed to be updated when it is clearly determined to be from a higher authority source. The semi-stable layer contains the following fields: The key metrics set is stored in dictionary form. Each metric entry contains: value (numerical value, floating-point type), unit (unit, string), source_chapter (source chapter), source_weight (source authority weight, value range 0.0 to 1.0), and timestamp (timestamp for writing).
[0023] The constraint list is stored as an array. Each constraint entry contains: type (constraint type, such as "range" for numerical range constraints and "string" for text matching constraints), var (constraint variable name), min and max (for range type, representing the minimum and maximum values respectively), text (for string type, representing the constraint text description), source_chapter (source chapter), and source_weight (source authority weight).
[0024] The list of key research findings consists of the important conclusions from each chapter, used to support the argumentation logic of subsequent chapters. Each entry includes text (the research findings text), source_chapter, and confidence (a value ranging from 0.0 to 1.0).
[0025] (3) A volatile layer, used to store temporary discussion and intermediate process data, including intermediate dialogue content between users and the system, single-generation intermediate results, and candidate information to be confirmed. Data in the volatile layer is automatically discarded according to time or capacity thresholds. The volatile layer contains the following fields: Temporary dialogue cache stores the most recent 10 rounds of user-system question-and-answer interactions in chronological order. Each record contains role ("user" or "assistant"), content (dialogue content), and timestamp (time stamp).
[0026] The pending update queue stores candidate entries for information that require manual user confirmation before being written to a semi-stable or permanent layer. Each entry contains candidate_value, proposed_layer, source_chapter, and proposal_time.
[0027] Recently generated chapter content cache, which stores the titles and content summaries of the last 3 completed generated chapters, is used to support the context requirement of "connecting with the previous chapter" and avoid frequent disk reads.
[0028] The eviction rule for the volatile layer is: the temporary conversation cache evicts the earliest records in chronological order, retaining only the last 10 entries; the recently generated chapter content cache evicts entries by generation time, retaining only the last 3 chapters; the to-be-confirmed update queue is cleared immediately after user confirmation or rejection, and pending entries that have not been processed for more than 72 hours are automatically marked as "expired" and archived by the system.
[0029] Further, before the planning and compiling workflow engine invokes the large language model service to generate the main text of the current chapter, keywords are extracted according to the title of the current chapter or user instructions, the semantic similarity between the keywords and each field in the global context object is calculated, and the subset of fields with similarity higher than the preset threshold is retained as the generation context, instead of loading all the context into the input window of the LLM. The specific implementation steps are as follows: Step 1: Obtain the title of the current chapter to be generated (such as "Chapter 5 Layout Planning of Garbage Classification Collection and Transportation Facilities") and supplementary instructions input by the user (if any). Splice the chapter title and user instructions into a text string, use a dictionary-based word segmentation tool (such as the jieba word segmentation library) to perform word segmentation processing on this text string, and remove stop words (such as meaningless words like "de", "le", "zai", etc.). Count the word frequency of the remaining words, sort them in descending order by TF-IDF value, and select the top 5 to 10 words with the highest TF-IDF values as the keyword set K. For example, for the title "Chapter 5 Layout Planning of Garbage Classification Collection and Transportation Facilities", the extracted keywords may be {"garbage", "classification", "collection and transportation", "facilities", "layout", "planning"}.
[0030] Step 2: Traverse all fields in the permanent layer and the semi-stable layer of the global context object. For each field, perform semantic similarity calculation between its text content (if the field is structured data such as a dictionary or array, convert it into a JSON string before extracting the text) and the keyword set K. The semantic similarity calculation adopts a vector embedding method based on a pre-trained model, specifically as follows: Load a lightweight Chinese semantic vector model (for example, MiniLM-L12-v2, with a vector dimension of 384). Splice the keyword set K into a query statement Q, and call the model to convert it into a vector . Traverse all fields in the permanent layer and semi-stable layer of the global context, input the text content of each field into the same model to obtain a vector , calculate the cosine similarity : ; where, " " represents the vector dot product operation, "" represents the Euclidean norm of the vectors. The cosine similarity ranges from -1.0 to 1.0, with values closer to 1.0 indicating greater semantic relevance.
[0031] Step 3, preset similarity threshold (This threshold was determined through pre-experimentation using a test set containing multiple planning chapters, and it strikes an optimal balance between the generated content's BLEU-4 score and the human score for logical coherence.) Reserved The field. If the total number of characters in the retained field exceeds 3000 characters, it will be truncated to 3000 characters according to the similarity from high to low (this limit is determined based on the reasonable use of the LLM input window and experimental optimization, which ensures sufficient contextual information while reserving space for system commands and user input).
[0032] Step 4: Convert each filtered field into a natural language sentence in the format "field name:field content", and concatenate them into a coherent contextual text block as input for the "background information" section of the Prompt. For structured data (such as indicator values) in the permanent and semi-stable layers, retain the numerical values, units, and source information during formatting.
[0033] After the chapter text is generated, new information that conforms to the preset data structure is extracted from it. After verification, it is written to the corresponding layer of the global context object in an incremental update manner.
[0034] The specific implementation steps are as follows: Step 1, Information Extraction. Structured information is extracted from the chapter text using a combination of regular expressions and named entity recognition: Indicator extraction: Scans content in the text that conforms to the pattern "indicator name + value + unit". For example, if the text contains "classification coverage reaches 95%", it will be extracted as an indicator. Numerical recognition supports three formats: percentage, integer, and decimal. Unit recognition supports common planning units (such as "ton", "ten thousand tons", "square kilometer", "hectare", "ten thousand people", "hundred million yuan", "%", etc.).
[0035] Constraint Extraction: Scan the text for content that matches the "range constraint" pattern, such as identifying patterns like "not less than X", "controlled within X", and "between X and Y", and extract them as range type constraints.
[0036] Terminology extraction: Scan for professional terms that appear for the first time in the text and have a definition, such as identifying the pattern "X as referred to in this plan means..." and extracting them as term entries.
[0037] Research findings extraction: Sentences in the text containing conclusive introductory words such as "in summary," "the study shows," and "analysis concludes" are scanned and extracted as research findings entries.
[0038] Step 2, Integrity Verification. The extracted new information is verified according to the preset data structure requirements: An indicator entry must include three required fields: name (indicator name), value (value, which must be a valid floating-point number or integer), and unit (unit, which cannot be an empty string or placeholder). If any field is missing, the entry is considered incomplete.
[0039] For cases with incorrect numerical formatting (such as the word "approximately" in "approximately 95%)), attempt to remove modifiers and extract the core value. If a valid value cannot be extracted, it is determined to be a formatting error. For cases where units are missing, attempt to deduce the default unit from the preset unit mapping table based on the indicator name (such as "area" defaulting to "hectares", "population" defaulting to "ten thousand people", and "investment" defaulting to "ten thousand yuan"). If it cannot be deduced, mark the indicator as "unit pending" and store it in the variable layer for user confirmation.
[0040] Constraint entries must include type, var, and the corresponding boundary value (for range types, both min and max must be included); the absence of any field indicates incompleteness.
[0041] Information that passes verification proceeds to the next conflict resolution process, while information that fails verification is stored in the pending confirmation update queue of the volatile layer, awaiting user supplementation or correction.
[0042] Step 3, Conflict Resolution and Incremental Update. For new information that passes verification, the system determines whether it conflicts with existing information in the semi-stable or permanent layer. A conflict is defined as: two pieces of information have the same name or var field (e.g., both are "coverage"), but their values or constraint ranges are different.
[0043] The incremental update includes: when new information conflicts with existing information in terms of value, comparing the preset authority weights of the source chapters of the two, and only performing overwrite if the authority weight of the new information is greater than or equal to the authority weight of the existing information; otherwise, the existing information is retained and a conflict log is recorded.
[0044] The authority weight values are set based on the hierarchical position and content nature of the chapters in the planning document: the authority weight of the planning objective chapter (such as "General Principles" or "Planning Objectives") is 1.0; the authority weight of the current situation analysis chapter is 0.8; the authority weight of the scheme design chapter is 0.7; the authority weight of the implementation guarantee chapter is 0.6; and the authority weight of process discussions or temporary records is 0.3. These weight values are determined by planners according to the industry practice of "higher-level chapters are valued more highly than lower-level chapters, and objective chapters are valued more highly than implementation chapters" in planning practice.
[0045] When new information conflicts with existing information (with the same name or var): If the weight of the new source is greater than the weight of the existing source, overwriting is allowed, and the old value is written to the history of the volatile layer.
[0046] The new source weight equals the existing source weight: information updated using timestamps.
[0047] If the weight of the new source is less than the weight of the existing source: refuse to update, retain the old value, and log the conflict.
[0048] Conflicts with permanent layer content: Reject updates and store in the volatile layer pending user confirmation.
[0049] The new information obtained from conflict resolution is written to the corresponding layer of the global context object according to its type, and the source_chapter, source_weight, and timestamp fields of this information are updated synchronously. After writing is complete, the updated global context object is serialized into JSON format and atomically written to a disk file.
[0050] Preferably, the intelligent context management module is further provided with a dependency tracking table to record which subsequent chapters reference each context information entry. When any generated chapter is modified and its generated context information changes, the dependency tracking table locates all downstream chapters that reference the changed information entry and marks the downstream chapters as pending review.
[0051] Specifically, in this embodiment, the dependency tracking table adopts a doubly linked list structure. Each context information entry (uniquely identified by entry_id) is associated with a "referenced list," which records a list of all chapter IDs that reference that entry. Each chapter (uniquely identified by chapter_id) is associated with a "dependency list," which records a list of entry_ids of all context information entries used during its generation.
[0052] Dependency relationships are recorded as follows: each time the LLM is called to generate a chapter, the system adds a hidden tag to each piece of context information in the "Background Information" section of the Prompt. After the LLM is generated, the hidden tags in the generated content are scanned, all referenced entry_ids are extracted, the dependency relationship between the chapter and the corresponding context information entry is established, and the data is stored in the dependency tracking table.
[0053] When a user modifies a generated chapter, the following change propagation process is executed: The revised chapters are compared sentence by sentence with the original version to identify the changes, and information extraction and conflict resolution are performed again.
[0054] The newly generated context information entries are compared with the context information entries generated for the same chapter before the modification, generating a change list. For each change in the change list, the dependency tracking table is queried to find all downstream chapters that referenced the information entry during generation, forming a "set of affected chapters".
[0055] Update the status field in the metadata of each chapter in the affected chapter set to "Pending review" and display it in the project outline of the user interface with a special color (such as orange highlight) to prompt the user that "this chapter references data that has been modified and it is recommended to regenerate it".
[0056] The user interface provides a "One-click regenerate all chapters to be reviewed" button. When the user clicks this button, each chapter to be reviewed is regenerated sequentially according to the topological order of the chapter dependency graph, and the text of the newly generated chapters automatically overwrites the old versions.
[0057] If the chapter to be reviewed has been manually edited by the user (the difference is greater than 20% when comparing the current content with the original LLM output), it will not be automatically overwritten. Instead, it will continuously prompt "This chapter has been manually modified and the referenced data has changed. Please confirm whether manual adjustment is required."
[0058] Through the above design, this system can automatically propagate changes across chapters and pinpoint their impact. In traditional compilation methods, after a planner modifies data in one chapter, they must manually read through the entire document to check for other affected chapters, which is extremely inefficient and prone to omissions. This system establishes a bidirectional association between each context entry and all chapters that reference it through a "dependency tracking table." When data in an upstream chapter changes, the system can immediately query the dependency tracking table, accurately locate all affected chapters, and automatically trigger regeneration or mark them for review. This transforms the impact of data changes on the entire document from "unknown" to "precisely known," significantly reducing maintenance costs and error risks associated with later modifications and ensuring the overall consistency of the document.
[0059] 2. Plan and develop a workflow engine.
[0060] The planning workflow engine responds to user-inputted planning project parameters, concurrently calls multiple retrieval services to obtain multi-source heterogeneous data, and, based on the multi-source heterogeneous data and the preset planning type configuration template, calls the large language model service to stream the planning outline and the main text of each chapter.
[0061] The planning project parameters include project name, planning type, and planning area. In practical applications, users can create planning projects based on the project creation and configuration interface. The system loads the corresponding planning type configuration template based on the user's selected planning type. This template is a JSON file stored in the system configuration directory, and predefines the following content for each planning type: A standard outline framework, including a pre-defined chapter hierarchy and recommended titles for each chapter; A glossary of terms, containing the standard terms used in this planning type and their corresponding prohibited synonyms; The list of referenced standards includes recommended national standards, industry standards, and local regulations, with each standard assigned a hierarchical weight. Chapter dependency graph, which defines the order of data dependencies between chapters; The terminology list is used to perform terminology consistency post-processing correction on the chapter text after the chapter text is generated. When the chapter text is detected to contain the prohibited synonyms, it is automatically replaced with the corresponding standard terms in the terminology list.
[0062] The system initializes the project file (project_context.json) in the project directory, writes the background information, area information and planning type input by the user into the permanent layer, generates an empty semi-stable layer and a volatile layer, and initializes the dependency tracking table.
[0063] Furthermore, before generating the planning outline, multiple retrieval services are concurrently invoked to obtain reference materials related to the current planning task. These multiple retrieval services include at least a web search service, a legal and standards retrieval service, a local knowledge base retrieval service, and a data statistics retrieval service. Each retrieval service is executed concurrently as an asynchronous task, and each has a set timeout period. For example, the web search task has a timeout of 15 seconds; the legal and standards retrieval task has a timeout of 10 seconds; the local knowledge base retrieval task has a timeout of 8 seconds; and the data statistics retrieval task has a timeout of 12 seconds.
[0064] Through the above concurrent multi-source retrieval design, it can be ensured that the reference information received by the large language model is optimized and filtered in terms of authority, relevance and timeliness. Moreover, because there is a clear data flow relationship between the retrieval stage and the context governance stage, the improvement of retrieval quality directly and positively affects the final output of context filtering and chapter generation.
[0065] Upon timeout, the task returns an empty result and logs "XX retrieval task timed out (XX seconds)", but this does not affect other ongoing tasks. After each retrieval service returns results (including timed-out tasks), a result fusion operation is performed, which includes: Deduplication: Calculate the MinHash signature of each returned document. Documents with a signature similarity higher than the first threshold (set to 0.9 in this embodiment) are considered duplicate documents, and the document with the highest source priority is retained. In this embodiment, unique documents are retained according to the following source priority: local knowledge base (highest priority, denoted as 4) > legal base (priority 3) > data statistics base (priority 2) > web search results (priority 1). The priority values are set based on the reliability and authority of the source: user-uploaded materials for this project should be given the highest priority; laws and standards have legal effect, so they are second; statistical data has objectivity, so they are third; web search information requires further verification and has the lowest priority.
[0066] Comprehensive ranking: The deduplicated documents are ranked according to the comprehensive relevance score, which is calculated by weighting semantic similarity, source weight, and timeliness score.
[0067] Specifically, the overall score = 0.50 × semantic similarity + 0.30 × source weight + 0.20 × timeliness score.
[0068] Semantic similarity: cosine similarity is calculated by concatenating the user query with the document title and summary.
[0069] Source weights: local knowledge base 1.0, legal base 0.9, data statistics base 0.8, web search 0.6.
[0070] Timeliness Score: A score of 1.0 is given for documents published within the last 3 years (counting backwards 3 years from the current date); 0.6 for documents published between 3 and 5 years ago; 0.3 for documents published more than 5 years ago; and 0.5 for documents whose publication date cannot be determined. The document publication date is extracted from the document's metadata, web search results are obtained from the time field returned by the search engine, and regulations are obtained from the effective date field of the regulations database. The weighting coefficients of 0.50, 0.30, and 0.20 are determined using the Analytic Hierarchy Process (AHP).
[0071] Extraction: The first N (N=10 in this embodiment) documents after sorting are retained as the multi-source heterogeneous data input into the large language model service.
[0072] After the search results are merged, the outline optimization agent is invoked to generate the planning outline. The workflow of the outline optimization agent is as follows: Step 1: Load the standard outline skeleton from the planning type configuration template (e.g., the standard outline for waste sorting planning includes "1. General Provisions → 1.1 Planning Background → 1.2 Planning Basis → 1.3 Planning Period and Scope...").
[0073] Step 2: Integrate the multi-source search results, project background information, planning area information, and standard outline skeleton into a structured Prompt, and call the Large Language Model (LLM) service to generate an initial version of the outline. The Prompt contains explicit instructions, such as, "Based on the following information, please generate a planning outline that conforms to the urban management special planning compilation specifications. The outline should not exceed three levels, and the chapter titles should reflect the characteristics of the planning area and the planning type." Step 3: Utilize the outline optimization agent to optimize the initial outline. The outline optimization agent, also based on LLM, guides the LLM to analyze and optimize the outline from the following dimensions using a specific prompt: Is the logical progression between chapters reasonable (does it conform to the planning logic chain of "current situation → problem → goal → solution → implementation")? Are there any missing important planning elements (such as risk assessment, public participation, etc.)? Are the chapter titles specific, professional, and relevant to the planning area?
[0074] The optimized outline is output to the front-end interface line by line in a streaming manner, allowing users to see the generation process of each chapter title in real time. After the output is complete, users can drag and drop to adjust the order of the outline, modify the title names, add or delete chapters, and perform other operations on the interface.
[0075] After the user confirms the outline, they can initiate the text generation process for that chapter and execute the following steps: Step 1: Extract the current chapter title and any supplementary instructions the user may input, read the list of currently generated chapter content from the project directory, and dynamically filter context information related to the chapter from the global context object.
[0076] Step 2: Build and generate the Prompt. The Prompt consists of four parts: background context (from the dynamically filtered global context); the outline structure of the current chapter (including the chapter title, parent chapter title, and sibling chapter titles, used by the LLM to understand the chapter's position and role in the entire document); the content writing plan (automatically generated based on chapter titles, such as the "Current Situation Analysis" chapter should include three sub-topics: "Regional Overview," "Current Situation Data," and "Problem Diagnosis"; this writing plan comes from the chapter writing guidelines in the planning type configuration template); and formatting requirements (using Markdown format, heading levels corresponding to chapter levels, data presented in tables, key terms bolded, etc.).
[0077] Step 3: Invoke the large language model service, enable streaming output mode (stream=True), and submit the Prompt to the model. Each time a token block is received from the model, it is immediately pushed to the front end through the SSE channel, and the front end appends and displays it in the content editing area in real time.
[0078] Step 4: After generation, perform post-processing operations: terminology consistency replacement (replace prohibited words with standard terms using a glossary), data format normalization (unify "95%", "ninety-five percent", and "ninety-five percent" to "95%)", and Markdown syntax validation (ensure that heading tags and table tags are closed).
[0079] Step 5: Extract structured information (indicators, constraints, terms, research findings) from the generated text, perform integrity checks and conflict resolution, and then update the global context object incrementally.
[0080] Step 6: Save the generated chapter text (including metadata such as generation time and version number). Simultaneously, record all context information entries referenced by this chapter in the dependency tracking table.
[0081] 3. RAG search enhancement module.
[0082] The RAG retrieval enhancement module is used to perform the following operations: Perform format standardization processing on user-uploaded local knowledge base files, converting various file formats into Markdown text.
[0083] The Markdown-formatted text is segmented, with segment size and overlap window parameters set. Specifically, segmentation is prioritized at the paragraph level. If a single paragraph exceeds 500 characters, it is further divided into sentences, ensuring each text block is between 200 and 500 characters long. This guarantees that each text block contains sufficient semantic information without being overly verbose during retrieval. A 20% overlap window is maintained during segmentation to ensure contextual continuity.
[0084] An external embedding service is invoked to convert each text block into a vector, a vector index is established, and the mapping relationship between the vector index and the corresponding text block and source file path is stored.
[0085] In response to a query request, the text of the query request is converted into a query vector, the cosine similarity between the query vector and each vector in the vector index is calculated, and the preliminary search results are returned in descending order of similarity. The external Rerank service is invoked to reorder the preliminary search results based on relevance, and the final search results with relevance scores are output.
[0086] The RAG search enhancement module is also used to set up user data isolation at the project level and configure document weights; Knowledge base files uploaded by different users are stored in physically isolated directories, and the corresponding vector indexes are stored independently by user ID and project ID. When configuring document weights, users set importance weight values for different knowledge base files. These importance weight values are used as correction coefficients in the ranking process after calculating the cosine similarity. Specifically, the importance weight values range from 0.1 to 2.0, with a step size of 0.1 and a default value of 1.0. The semantics of the weight values are: a weight of 1.0 is the standard weight; a weight greater than 1.0 indicates that the content of the file receives bonus points during retrieval; a weight less than 1.0 indicates reduced importance.
[0087] 4. AI drawing engine.
[0088] The AI drawing engine is configured with multiple drawing API channels, including at least one primary channel and at least one backup channel. In this embodiment, the AI drawing engine integrates three drawing API channels: Alibaba Cloud Wanx or Google Gemini API (primary channel, generating the highest quality), Baidu Smart Cloud ERNIE-ViLG or Seedream 4.5 API (backup channel, generating faster), and Zhipu AI CogView-3 or Qwen Image API (local deployment test channel, used for internal testing and degradation scenarios). In specific applications, the drawing API channels can be replaced according to actual deployment needs.
[0089] The AI drawing engine performs the following operations: In response to a user's drawing request (including drawing prompts, drawing mode, output resolution, reference image file, etc.), the prompts and reference image data in the drawing request are parsed. The multiple drawing API channels are attempted to be called sequentially according to the preset priority (main channel > backup channel > local deployment test channel), and the channel with the next higher priority is automatically switched when the current channel call fails. When any channel returns a successful response, extract the image data from the response, compress and optimize the image data, save it to the user's project directory, and record the channel information and generation time of this drawing request. When all channel calls fail, return an error message and log the failure.
[0090] 5. Points Management System.
[0091] The points management system is responsible for the top-up, consumption, reset, and statistics of user points. The points management system is connected to the AI drawing engine and is used to perform the following operations: There are two types of points: bonus points and recharge points. Bonus points are reset at a fixed period, while recharge points are valid indefinitely.
[0092] Credit consumption is calculated independently for each drawing API channel, with different credit consumption values for each channel; for example, the primary channel costs 2 credits; the backup channel costs 1 credit; and the local deployment test channel costs 0 credits. The credit consumption values are set based on the billing prices of each API provider and the system operating cost accounting.
[0093] When executing a drawing request, the system first checks the user's points balance in the corresponding channel. If the balance is insufficient, the request is rejected and the user is prompted to recharge. After the drawing request is successfully completed, points are deducted according to the points consumption value corresponding to the currently used channel, and a transaction record containing the user ID, channel name, consumed points value, and timestamp is generated.
[0094] 6. Specialized workflow engine.
[0095] The specialized workflow engine integrates the following functional modules: The case collection agent is used to identify research topics and areas of focus through interactive question-and-answer sessions, perform intelligent searches, and generate standardized case reports that include key experiences, practices, and effectiveness evaluations.
[0096] The specific process is as follows: After the user inputs a research topic, the Agent generates three follow-up questions based on the topic (such as regional preferences, case type, and scale requirements). The user answers each question in the dialogue interface. After answering, the Agent constructs a complete query statement and calls the Serper search API. It selects 3-5 typical cases from the search results and generates a summary for each (name, location, time, methods, and results). The user can choose any case for "in-depth analysis," and the Agent performs a secondary search to generate a detailed case report (basic information → main methods → innovations → results data → lessons learned → shortcomings). The case report is saved in Markdown format to the project file.
[0097] The local research assistant agent is used to perform intent recognition and keyword extraction, conduct multi-type parallel searches, and generate research report outlines that conform to the preset research structure.
[0098] The specific process is as follows: After the user inputs their research topic, the Agent uses a finely tuned BERT binary classification model (trained on a self-built dataset containing multiple labeled data points, categorized into "case collection," "research topic," and "paper writing") to identify the intent. If determined to be "research topic," the Agent uses the LAC word segmentation tool to extract noun phrases and combines this with TF-IDF to select 3-5 core keywords. Four types of parallel searches are performed (web pages, academic, images, and news). The search results are submitted to the LLM to generate a structured research outline (review → current status identification → problem diagnosis → causal analysis → experience comparison → insights extraction). After user confirmation, the outline is generated chapter by chapter, with each chapter extracting relevant search results from a dedicated global context research channel for reference.
[0099] The paper writing agent is used to perform parallel academic searches with multiple keywords, screen and manage literature, and support chapter-by-chapter writing.
[0100] The specific process is as follows: After the user inputs the paper topic and keywords, the Agent calls the Semantic Scholar API to search for relevant academic literature. Filtering: Literature with zero citations and published more than 5 years ago is removed; duplicates are also removed, retaining the top 10 core articles. A paper outline is generated based on the literature (Introduction → Literature Review → Research Methods → Results Analysis → Discussion → Conclusion), suggesting citations for each chapter. During chapter-by-chapter generation, the complete abstracts of the cited literature are used as context input to the LLM. Upon completion, the Agent automatically generates a reference list. Each functional module shares a global context object maintained by the intelligent context management module, which contains data channel classification and statistical fields specifically for research purposes.
[0101] 7. Document generation module.
[0102] The document generation module is used to perform the following operations: convert the planning outline and chapter text generated and stored in Markdown format by the planning workflow engine into a Word document that meets the professional format requirements of urban management planning.
[0103] The conversion includes: parsing Markdown heading levels and mapping different levels of headings to Word's built-in heading styles according to a preset heading style mapping table; parsing Markdown table syntax, creating Word tables, and applying bold and shading styles to the table header rows.
[0104] Identify the ECharts JSON configuration embedded in the main text of the chapter, call the Matplotlib library to generate the corresponding chart image based on the chart type and data fields in the ECharts JSON configuration, and insert the chart image into the corresponding position in the Word document.
[0105] Perform deduplication on the main text of the chapter: calculate the hash value of each paragraph, and skip the paragraph when the hash value of a new paragraph already exists in the hash set of the paragraphs already written, and record the skip log.
[0106] 8. User authentication and permission management module.
[0107] The user authentication and permission management module adopts a dual user authentication mechanism based on Session and Single Sign-On Token.
[0108] The Session authentication process includes: after a user successfully logs in, the backend generates a Session object containing user_id, role, and login_time. The Session ID is stored in the browser's cookie and its validity period is set to 24 hours. Each time an API request is made, the backend reads the Session ID from the cookie and verifies its validity.
[0109] The single sign-on token authentication includes support for integration with third-party identity authentication systems such as WeChat Work and DingTalk. After a user is authenticated by the third-party system, the third-party system returns an authorization code. The system uses the authorization code to obtain an access token. The token adopts the JWT format and contains fields such as user_id and exp (expiration time, set to 7 days).
[0110] The user authentication and permission management module is also used to perform module-level permission control based on user roles. It adopts a data management architecture with complete isolation of user space, and physically isolates and stores the local knowledge base files, vector indexes, AI drawing history records, generated images and exported documents of different users.
[0111] The system also includes soft deletion and pseudo-deletion mechanisms. Soft deletion marks the item as deleted but preserves the original data file; soft-deleted items are hidden by default in the user interface's item list, but users can view and restore them via the "Show Deleted Items" switch. Pseudo-deletion moves the data requested for deletion to a temporary recycle directory and sets a retention period when the user permanently deletes an item (confirming deletion again after a soft deletion). Users can restore the data with one click before the retention period expires. The retention period is 30 days. After 30 days, a system scheduled task automatically cleans up the recycle directory that has exceeded the retention period and performs physical deletion.
[0112] To help understand the overall workflow of this system, the following example of a typical planning project will be used to demonstrate the complete process from user login to document export.
[0113] Input: User "Zhang Gong" logs into the system, creates the "xx Special Plan" project, selects the planning type "x Plan", and the region "xx Province - xx City - xx District". Upload three knowledge base files: "xx Current Situation Survey Report.pdf", "xx Management Regulations.docx", and "xx Statistical Data.pdf".
[0114] Phase 1 – Outline Generation: The system loads the corresponding planning configuration template and concurrently executes four types of tasks: web search, regulatory retrieval, knowledge base retrieval, and data retrieval, returning the results. The system performs deduplication (finding 3 duplicate entries, retaining the knowledge base version), performs comprehensive sorting, retains the top 10 documents, constructs a prompt, submits the LLM, and generates a planning outline containing chapters and sections. Engineer Zhang makes minor adjustments to the outline, changing "4.1 Classification Standard" to "4.1 Area A Classification Standard (Four-Classification Method)," and confirms and saves the changes.
[0115] The second stage—Chapter Generation: Zhang Gong clicks to generate "Chapter 2 Current Status Analysis". The system dynamically filters regional information, knowledge base search results, and population data from the web search from the global context. LLM generates the main text, which includes the indicator "Current coverage rate of xx in Area A is 82%". The system extracts this indicator and writes it into the semi-stable layer, with a source weight set to 0.8 (the preset weight for the current status analysis chapter). Subsequently, when generating "Chapter 3 Overall Goals", the system sets "Coverage rate to reach 95% by the end of the planning period". When generating "Chapter 4 xx System Planning", the system automatically retrieves "Current coverage rate 82%" and "Target coverage rate 95%" from the context. Based on this, LLM generates connecting content such as "Based on the current coverage rate of 82%, the target for the end of the planning period is set at 95%, requiring an additional daily processing capacity of XX tons"—achieving automatic and coherent cross-chapter data referencing.
[0116] Phase Three – AI Drawing: Zhang Gong inputs the prompt "xx rendering, modern minimalist style, daily processing capacity XX tons, surrounded by greenbelt" into the AI drawing interface, selecting a 16:9 aspect ratio and 2K resolution. The system checks the points balance, determines it is sufficient, calls the Tongyi Wanxiang API, and returns the rendering after 15 seconds, saving it in the ai_images / directory, deducting 2 points.
[0117] Phase Four – Document Export: After all chapters were generated, Mr. Zhang clicked "Export to Word". The document generation service merged the Markdown files of all chapters, performed heading level mapping, table rendering, chart generation, and deduplication (it detected that "This plan is formulated in accordance with the 'xx Prevention and Control Law'" appeared repeatedly in Chapters 1 and 7, so it automatically retained the Chapter 1 version and deleted the duplicate in Chapter 7). Approximately 10 seconds later, a Word document conforming to the planning specifications was generated, which Mr. Zhang downloaded and submitted for review.
[0118] This embodiment provides a multi-agent-based urban management special planning system, which realizes the intelligent generation and management of contextual information in the planning field throughout the entire process, and can meet the comprehensive requirements of planning for professionalism, compliance and overall efficiency.
[0119] Example 2 A multi-agent-based urban management special planning system, based on Implementation Example 1, has made the following adjustments: a spatial sorting submodule has been added to the planning workflow engine to optimize the chapter generation order based on spatial topology relationships, so as to solve the problem of spatial logical dependency breakage that may be caused by users arbitrarily selecting the chapter order.
[0120] After the user confirms the outline, the spatial sorting submodule extracts the names of geographic entities from the chapter titles and descriptions, converts them into latitude and longitude coordinate ranges using a geocoding service, and stores them in the chapter metadata. Chapters without identified geographic entities (such as comprehensive chapters like "General Principles" and "Investment Estimation") are marked as "No Spatial Dependency." The spatial sorting submodule identifies three types of spatial topological relationships: containment, adjacency, and upstream / downstream relationships, storing them in the project file for subsequent sorting processes.
[0121] The spatial sorting submodule injects spatial topology relationships into the chapter dependency graph (from the planning type configuration template) to form an extended dependency graph. The rules are as follows: If "Chapter A contains Chapter B", then add a dependency edge in the dependency graph where "Chapter A" precedes "Chapter B" (because global / macro chapters need to be generated first, and then local / micro chapters need to be generated to ensure that macro constraints are set in advance).
[0122] If "Chapter A is upstream of Chapter B", then add a dependency edge in the dependency graph that states "Chapter A" precedes "Chapter B" (because the upstream planning scheme affects the downstream constraints).
[0123] If "Chapter A is adjacent to Chapter B", no sequential relationship is required, and the two chapters can be generated in parallel.
[0124] The extended dependency graph is stored as a directed acyclic graph. When the user initiates the "Regenerate All" function, a topological sorting algorithm (Kahn's algorithm) is executed on the extended dependency graph to automatically calculate the generation order of all chapters that satisfy the dependencies. After sorting, the chapters are generated sequentially according to the topological order, and the progress bar in the user interface displays "Generating Chapter X / Y in spatial logical order".
[0125] When a user manually selects to generate a single chapter, the planning workflow engine calls the spatial sorting submodule to check if there are any incomplete prerequisite spatial dependencies for the current chapter before execution. If so, a warning pops up: "The current chapter depends on the spatial planning results of chapter XX. It is recommended to generate chapter XX first." The user can choose to force generation. The spatial sorting submodule does not directly modify the global context object in the intelligent context management module, but the determination result of spatial topology relationships (such as "A contains B") will be used as context metadata for reference by subsequent conflict resolution mechanisms.
[0126] This embodiment introduces spatial logic into the generation order control, so that the chapter generation order follows the spatial logic rules of the planning and compilation, thereby reducing cross-chapter spatial logic contradictions caused by improper order from the source.
[0127] The above descriptions are merely embodiments of the present invention. Commonly known structures and characteristics of the solutions are not described in detail here. Those skilled in the art are aware of all common technical knowledge in the field prior to the application date or priority date, are aware of all existing technologies in that field, and have the ability to apply conventional experimental methods prior to that date. Those skilled in the art can, under the guidance of this application, improve and implement this solution in combination with their own capabilities. Some typical known structures or methods should not be obstacles for those skilled in the art to implement this application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the structure of the present invention. These should also be considered within the scope of protection of the present invention, and will not affect the effectiveness of the implementation of the present invention or the practicality of the patent.
Claims
1. A multi-agent based urban management special planning system, characterized in that, This includes a planning and development workflow engine and an intelligent context management module; The planning workflow engine responds to user-inputted planning project parameters, concurrently calls multiple retrieval services to obtain multi-source heterogeneous data, and, based on the multi-source heterogeneous data and the preset planning type configuration template, calls the large language model service to stream the planning outline and the main text of each chapter. The intelligent context management module is used to maintain a global context object with a three-layer structure. The three-layer structure includes: a permanent layer, used to store project background, planning objectives, and terminology definitions, and the data in the permanent layer cannot be automatically overwritten by subsequent chapters; a semi-stable layer, used to store key indicators and constraints, and the data in the semi-stable layer is only allowed to be updated when it is clearly determined to be from a higher authoritative source; and a volatile layer, used to store temporary discussions and intermediate process data, and the data in the volatile layer is automatically eliminated according to time or capacity thresholds. Before calling the large language model service to generate the main text of the current chapter, keywords are extracted based on the title of the current chapter or user instructions. The semantic similarity between the keywords and each field in the global context object is calculated, and a subset of fields with similarity higher than a preset threshold is retained as the generation context. After the chapter text is generated, new information that conforms to the preset data structure is extracted from it. After verification, it is written to the corresponding layer of the global context object in an incremental update manner. The incremental update includes: when the new information conflicts with the existing information, the preset authority weights of the source chapters of the two are compared. Only when the authority weight of the new information is greater than or equal to the authority weight of the existing information is the overwrite performed. Otherwise, the existing information is retained and the conflict log is recorded. 2.The multi-agent based urban management special planning system according to claim 1, wherein, The multiple retrieval services include at least web search services, legal and standard retrieval services, local knowledge base retrieval services, and data statistics retrieval services. Each retrieval service is executed concurrently in an asynchronous task manner, and a timeout period is set for each service. After each search service returns results, a result fusion operation is performed, which includes: Deduplication: Calculate the MinHash signature of each returned document, determine the documents with a signature similarity higher than the first threshold as duplicate documents, and retain the document with the highest source priority; Comprehensive ranking: The deduplicated documents are ranked according to the comprehensive relevance score, which is calculated by weighting semantic similarity, source weight, and timeliness score. Extraction: The top N documents after sorting are retained as inputs of the multi-source heterogeneous data into the large language model service.
3. The urban management special planning system based on multi-agent technology as described in claim 1, characterized in that, The planning type configuration template is a JSON format file, and the following content is predefined for each planning type: A standard outline framework, including a pre-defined chapter hierarchy and recommended titles for each chapter; A glossary of terms, containing the standard terms used in this planning type and their corresponding prohibited synonyms; The list of referenced standards includes recommended national standards, industry standards, and local regulations, with each standard assigned a hierarchical weight. Chapter dependency graph, which defines the order of data dependencies between chapters; The terminology list is used to perform terminology consistency post-processing correction on the chapter text after the chapter text is generated. When the chapter text is detected to contain the prohibited synonyms, it is automatically replaced with the corresponding standard terms in the terminology list.
4. The urban management special planning system based on multi-agent technology as described in claim 1, characterized in that, It also includes a RAG retrieval enhancement module, which is used to perform the following operations: Perform format standardization processing on user-uploaded local knowledge base files, converting various file formats into Markdown text. Perform block processing on the Markdown formatted text, and set the block size and overlap window parameters; Call an external Embedding service to convert each text block into a vector, build a vector index, and store the mapping relationship between the vector index and the corresponding text block and source file path; In response to a query request, the text of the query request is converted into a query vector, the cosine similarity between the query vector and each vector in the vector index is calculated, and the preliminary search results are returned in descending order of similarity. The external Rerank service is invoked to reorder the preliminary search results based on relevance, and the final search results with relevance scores are output.
5. The urban management special planning system based on multi-agent technology according to claim 4, characterized in that, The RAG search enhancement module is also used to set up user data isolation at the project level and configure document weights; Knowledge base files uploaded by different users are stored in physically isolated directories, and the corresponding vector indexes are stored independently by user ID and project ID. When configuring document weights, users set importance weight values for different knowledge base files. These importance weight values are used as correction coefficients for sorting after calculating the cosine similarity.
6. The urban management special planning system based on multi-agent technology according to claim 1, characterized in that, It also includes an AI drawing engine, which is configured with multiple drawing API channels, including at least one primary channel and at least one backup channel. The AI drawing engine performs the following operations: In response to a user's drawing request, the prompt words and reference image data in the drawing request are parsed; The system attempts to call the multiple drawing API channels sequentially according to a preset priority, and automatically switches to the next priority channel when the current channel call fails. When any channel returns a successful response, extract the image data from the response, compress and optimize the image data, save it to the user's project directory, and record the channel information and generation time of this drawing request. When all channel calls fail, return an error message and log the failure.
7. The urban management special planning system based on multi-agent technology as described in claim 6, characterized in that, It also includes an points management system, which is connected to the AI drawing engine and is used to perform the following operations: There are two types of points: bonus points and recharge points. Bonus points are reset at a fixed period, while recharge points are valid indefinitely. The point consumption is calculated independently for each different drawing API channel, with different point consumption values corresponding to different channels. When executing a drawing request, the corresponding user's points balance in the corresponding channel is checked in advance. If the balance is insufficient, the request is rejected and the user is prompted to recharge. After the drawing request is successfully completed, the points are deducted according to the points consumption value corresponding to the currently used channel, and a transaction record containing user ID, channel name, points consumption value and timestamp is generated.
8. The urban management special planning system based on multi-agent technology according to claim 1, characterized in that, It also includes a dedicated workflow engine, which integrates the following functional modules: The case collection agent is used to identify research topics and concerns through interactive question-and-answer sessions, perform intelligent searches, and generate standardized case reports that include key experiences, practices, and effectiveness evaluations. The local research assistant agent is used to perform intent recognition and keyword extraction, conduct multi-type parallel searches, and generate research report outlines that conform to the preset research structure. Thesis writing agent is used to perform parallel academic searches with multiple keywords, screen and manage literature, and support chapter-by-chapter writing. Each functional module shares a global context object maintained by the intelligent context management module, which contains data channel classification and statistical fields specifically for research purposes.
9. The urban management special planning system based on multi-agent technology according to claim 1, characterized in that, It also includes a document generation module, which is used to perform the following operations: convert the planning outline and chapter text generated and stored in Markdown format by the planning workflow engine into a Word document that meets the professional format requirements of urban management planning; The conversion includes: parsing Markdown heading levels and mapping different levels of headings to Word's built-in heading styles according to a preset heading style mapping table; parsing Markdown table syntax, creating Word tables, and applying bold and shading styles to the table header rows; Identify the ECharts JSON configuration embedded in the main text of the chapter, call the Matplotlib library to generate the corresponding chart image according to the chart type and data fields in the ECharts JSON configuration, and insert the chart image into the corresponding position in the Word document; Perform deduplication on the main text of the chapter: calculate the hash value of each paragraph, and skip the paragraph when the hash value of a new paragraph already exists in the hash set of the paragraphs already written, and record the skip log.
10. The urban management special planning system based on multi-agent technology according to claim 1, characterized in that, It also includes a dual user authentication mechanism based on Session and Single Sign-On Token, module-level permission control based on user roles, and soft deletion and pseudo-deletion mechanisms; The soft delete is used to mark the deletion status but retain the original data file. The pseudo delete is used to move the data requested by the user to a temporary recycling directory and set a retention period. Before the retention period expires, the user can restore the data with one click.
