Long text generation method and device, equipment and medium
By leveraging the collaborative work of a multi-agent system, utilizing architecture outline data and global summary data, combined with fragment blueprint data and quality analysis from review agents, the problems of logical incoherence and cognitive fragmentation in long text generation were solved, achieving high-quality long text generation.
Patent Information
- Application Number
- CN202511664709.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-03-03
AI Technical Summary
Existing technologies suffer from problems such as logical incoherence, contradictions, and collapse of the image of the core analysis object in long text generation. The rigid pipeline mode of multi-agent systems leads to cognitive breaks and poor generation quality.
A multi-agent system is adopted, including a master agent, a collaborative decision-making agent, a writing agent, and a review agent. Through the collaborative work of architecture outline data, global summary data, and fragment blueprint data, the logical coherence and consistency of text fragments are ensured. The review agent is used to conduct content quality analysis and simulates advanced cognitive abilities for dynamic reflection and correction.
It significantly improves the logical coherence and consistency of long texts, generates high-quality long texts, avoids cognitive breaks, and ensures the overall quality and coherence of the text.
Smart Images

Figure CN121598901A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to methods, apparatus, devices and media for generating long texts. Background Technology
[0002] Long text generation is a highly challenging task in the field of artificial intelligence. While existing Large Language Models (LLMs) excel at generating fluent short texts, they commonly suffer from problems such as logical inconsistencies, contradictions, and a breakdown in the portrayal of the core analytical subject when creating long texts like scripts, novels, analytical reports, and engineering documents. To address this issue, related technologies have attempted to decompose the long text generation task using Multi-Agent Systems (MAS). However, this approach often employs a rigid pipeline model, which can easily lead to "cognitive breaks," resulting in poor-quality long texts. Summary of the Invention
[0003] This application provides a method, apparatus, device, and medium for generating long text to solve at least one of the aforementioned technical problems.
[0004] According to one aspect of the embodiments of this application, a long text generation method is provided, the method comprising: The target topic is input into the master control agent to generate a summary, resulting in architecture outline data and global summary data. The architecture outline data is used to indicate the architecture of the long text and the order of each text segment in the long text. During the generation of each text segment in the order of the segments, a blueprint is generated based on the collaborative decision-making agent using the current global summary data as context information to obtain the segment blueprint data of the corresponding text segment. The current global summary data of non-first text segments is obtained by updating the global summary data based on the preceding text segments. Based on the writing agent, the current global summary data and the corresponding fragment blueprint data are used as context information to generate content and obtain the initial text fragment of the corresponding text fragment. Based on the review agent, the current global summary data and the corresponding fragment blueprint data are used as benchmark information to perform content quality analysis and obtain the quality analysis results of the corresponding initial text fragments. The initial text segment indicated by the quality analysis results is identified as the corresponding text segment of the long text.
[0005] According to another aspect of the embodiments of this application, a long text generation apparatus is provided, the apparatus comprising: The summary generation module is used to input the target topic into the master intelligent agent to generate a summary, and obtain architecture outline data and global summary data. The architecture outline data is used to indicate the architecture of the long text and the order of each text segment in the long text. The blueprint generation module is used to generate blueprints based on the collaborative decision-making agent and the current global summary data as context information during the generation of each text segment in the order of the segments, so as to obtain the segment blueprint data of the corresponding text segment. The current global summary data of non-first text segments is obtained by updating the global summary data based on the preceding text segments. The fragment generation module is used to generate content based on the writing agent, using the current global summary data and the corresponding fragment blueprint data as context information, to obtain the initial text fragment of the corresponding text fragment. The review module is used to perform content quality analysis based on the review agent, using the current global summary data and the corresponding fragment blueprint data as benchmark information, to obtain the quality analysis results of the corresponding initial text fragment. The determination module is used to determine the initial text fragment indicating that the quality analysis result has passed as the corresponding text fragment of the long text.
[0006] According to one aspect of the embodiments of this application, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to implement the above-described long text generation method.
[0007] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, the storage medium storing at least one instruction, the at least one instruction being loaded and executed by a processor to implement the above-described long text generation method.
[0008] According to one aspect of this application, a computer program product is provided, the computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the above-described long text generation method.
[0009] The technical solution provided in this application can bring the following beneficial effects: The technical solution of this application constructs a multi-agent system comprising a master control agent, a collaborative decision-making agent, a writing agent, and a review agent. The master control agent generates an outline, obtaining architecture outline data and global summary data, and then sequentially generates text fragments based on the fragment order indicated by the architecture outline data. In this process, the collaborative decision-making agent uses the global summary data as contextual information to generate fragment blueprint data and updates the global summary information accordingly, ensuring the accuracy and timeliness of the context, thereby ensuring the quality of the fragment blueprint data and the fragments output by the writing agent. Furthermore, the review agent uses the current global summary data and corresponding fragment blueprint data as benchmark information to perform content quality analysis on the output of the writing agent, obtaining quality analysis results. This review feedback mechanism simulates advanced cognitive abilities such as long-term planning, dynamic reflection, and global correction, avoiding "cognitive breaks," significantly improving the logical coherence and long-term consistency of the generated text, and achieving high-quality long-text output.
[0010] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a schematic diagram of the runtime environment of a long text generation method provided in one embodiment of this application; Figure 2 This is a flowchart illustrating a long text generation method provided in one embodiment of this application; Figure 3 This is a system framework diagram provided in one embodiment of this application; Figure 4 This is a flowchart illustrating another long text generation method provided in one embodiment of this application; Figure 5 This is a flowchart illustrating another long text generation method provided in one embodiment of this application; Figure 6 This is a framework diagram of another system provided in one embodiment of this application; Figure 7 This is a schematic diagram of a text fragment generation process provided in one embodiment of this application; Figure 8 This is a block diagram of a long text generation apparatus provided in one embodiment of this application; Figure 9 This is a structural block diagram of a computer device provided in one embodiment of this application; Figure 10 This is a structural block diagram of an electronic device provided in one embodiment of this application. Detailed Implementation
[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0014] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of the embodiments of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the present application described herein can be implemented in orders other than those illustrated or described herein. Thus, features defined with "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments, unless otherwise stated, "a plurality of" means two or more. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.
[0015] To make the objectives, technical solutions, and advantages disclosed in the embodiments of this application clearer, the embodiments of this application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of this application and are not intended to limit the embodiments of this application.
[0016] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be noted that all data used in the embodiments of this application has been fully authorized by the relevant parties before use.
[0017] Before introducing the specific implementation methods of this application, the relevant technical terms will be explained below.
[0018] LLM (Large Language Model): refers to a deep learning model trained on massive amounts of text data; MAS (Multi-Agent System): A computing system consisting of multiple agents interacting in an environment; Cognitive Fracture: In a rigid, linear multi-agent workflow, the lack of effective feedback and correction mechanisms leads to a disconnect between planning, writing, and review processes, resulting in the accumulation and amplification of early errors.
[0019] Long text generation places extremely high demands on artificial intelligence systems, requiring not only fluent writing but also consistent overall logic and coherent plot. Related technologies for long text generation mainly fall into two categories: single large-scale language model (SLAM) generation and pipelined multi-agent generation. The single large-scale language model (SLAM) directly employs a powerful pre-trained language model (such as GPT-4) to generate a complete long story in one go using a complex prompt containing all story elements. This approach relies on the model's emergent capabilities to handle planning and consistency issues, but the autoregressive generation mechanism of a single LLM makes it more focused on the fluency of local text, lacking effective long-term memory and global planning capabilities. This results in a "short-sighted" problem, easily leading to "getting lost in the middle" phenomena, causing serious defects such as plot inconsistencies and character settings. Pipeline multi-agent systems (Pipeline MAS) decompose the writing task into multiple agents, executing them in a fixed order. For example, one agent first generates a complete story outline, and then another agent writes the full text based on the outline. This approach attempts to reduce complexity through task decomposition. Works like Re3 and Doc employ similar "planning-writing" models. However, the rigid pipeline structure of this pipeline MAS approach severs the dynamic feedback between planning and writing during the creative process. Any minor flaws in the planning stage are amplified in the subsequent writing stage, and the downstream agent cannot correct these early planning flaws and errors. This "cognitive disconnect" leads to the one-way propagation of errors, ultimately resulting in long texts that are even less logically coherent than a single LLM approach.
[0020] To resolve at least one of the problems mentioned above, please refer to Figure 1 This diagram illustrates an operating environment provided by an embodiment of this application under an exemplary implementation. The operating environment may include a terminal 01 and a server 02. Embodiments of this application may be implemented independently in terminal 01 or server 02, or jointly in conjunction with terminal 01 and server 02. In practical applications, terminal 01 and server 02 may be directly or indirectly connected via wired or wireless communication, and this application does not impose any limitations on this connection.
[0021] Terminal 01 includes, but is not limited to, mobile phones, PC terminals such as computers, smart voice interaction devices, smart home appliances, in-vehicle terminals, game consoles, e-book readers, multimedia playback devices, wearable devices, and other electronic devices.
[0022] Server 02 can provide backend services for Terminal 01. Server 02 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to realize data computing, storage, processing, and sharing. Cloud technology can be applied to various fields, such as medical cloud, cloud IoT, cloud security, cloud education, cloud conferencing, artificial intelligence cloud services, cloud applications, cloud calling, and cloud social networking. Cloud technology is based on the cloud computing business model, which distributes computing tasks across a resource pool composed of a large number of computers, enabling various application systems to obtain computing power, storage space, and information services as needed. The network providing resources is called the "cloud." From the user's perspective, resources in the "cloud" are infinitely scalable, readily available, on-demand, and expandable, with payment based on usage. As a provider of fundamental cloud computing capabilities, a cloud resource pool (referred to as a cloud platform, generally called IaaS (Infrastructure as a Service)) platform is established. Various types of virtual resources are deployed in the resource pool for external customers to choose from. The cloud resource pool mainly includes: computing devices (virtualized machines containing operating systems), storage devices, and network devices. Optionally, server 02 can simultaneously provide backend services to multiple terminals 01.
[0023] In this embodiment of the application, terminal 01 or server 02 can deploy a multi-agent system, as shown in the reference. Figure 3The multi-agent system may include a master control agent 101, a collaborative decision-making agent 102, a writing agent 103, a review agent 104, and a shared memory system 105. The master control agent 101 acts as the overall commander or director of long text generation, responsible for macro-level control and generating architecture outline data and global summary data. The collaborative decision-making agent 102 is used to plan and make decisions for text fragment generation tasks based on the aforementioned architecture outline data and global summary data, forming fragment blueprint data. The writing agent 103 generates text fragments based on the global summary data and fragment blueprint data. The review agent 104, as the quality control core, reviews text fragments using fragment blueprint data and global summary data to obtain quality analysis results, thereby instructing the text fragments to pass or be corrected. The shared memory system 105, as the information hub, is the sole true source of the long text narrative state, storing architecture outline data, global summary data, fragment blueprint data, and generated text fragments for the aforementioned modules to read. Among them, the generated text fragments can form an evolutionary manuscript, which serves as the orthodox text of the text content, representing the objective facts of the narrative world, and is gradually constructed as each fragment is finalized.
[0024] Specifically, a multi-agent system can execute the following long text generation method: The target topic is input into the controlling agent for summary generation, yielding architecture outline data and global summary data. The architecture outline data indicates the long text architecture and the order of text segments within the long text. During the generation of each text segment in segment order, a collaborative decision-making agent generates a blueprint using the current global summary data as context information, obtaining the segment blueprint data for the corresponding text segment. The current global summary data for non-first text segments is updated based on the preceding text segments. A writing agent generates content using the current global summary data and the corresponding segment blueprint data as context information, obtaining the initial text segment for the corresponding text segment. A review agent performs content quality analysis using the current global summary data and the corresponding segment blueprint data as benchmark information, obtaining the quality analysis result for the corresponding initial text segment. The initial text segment whose quality analysis result indicates it has passed is determined as the corresponding text segment of the long text.
[0025] Furthermore, it is understandable that Figure 1 The example shown is merely an application environment for a long text generation method. This application environment may include more or fewer nodes, and this application does not impose any restrictions here.
[0026] The following describes a long text generation method provided in this application, which can be applied to terminals or servers, in conjunction with the aforementioned operating environment. Figure 2This is a flowchart illustrating a long text generation method provided in an embodiment of this application. This application provides method operation steps as shown in the embodiments or flowcharts, but based on conventional or non-inventive methods, more or fewer operation steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or server product execution, the method can be executed in the order shown in the embodiments or drawings, or in parallel (e.g., in a parallel processor or multi-threaded processing environment). Please refer to... Figure 2 The long text generation method provided in this application embodiment may include the following steps S201-S209: S201: Input the target topic into the master intelligent agent to generate a summary, and obtain the architecture outline data and global summary data.
[0027] Specifically, the target topic describes the core idea or central issue of the long text to be generated. It can be submitted by relevant users or automatically generated by the system. For example, if the long text to be generated is a long story, the target topic could be something like, "A genius engineer from a future interstellar civilization is reincarnated into a world full of steampunk and alchemy, where he tries to recreate his advanced technology using more primitive local methods."
[0028] Specifically, the master agent, acting as the macro-control center of the multi-agent system, manages and regulates the fragment loop of long text generation, maintains the global narrative state, and strategically guides the content development of the long text. Upon receiving the target topic, the master agent generates a summary based on preset summary generation instructions, obtaining architectural outline data and global summary data, which are then stored in a shared memory system.
[0029] Specifically, the framework outline data is used to indicate the structure of a long text and the order of its various text segments. It can be a structured representation of the expected development of the content, including high-level goals for each text segment and scene-by-scene plans, serving as an authoritative guide for long text generation. The framework outline data can specifically include the core concept, content synopsis, element settings, structural arrangement, and practical details of the long text. Understandably, the content of the framework outline data differs for different types of long texts and can be specifically set based on the long text type. For example, the core concept of a long story can include story type, tone, and theme; the content synopsis can include the main plot and descriptions of specific stages, such as a chain structure containing "beginning-development-climax-ending" and related summaries, as well as possible subplots; element settings can include world background, character settings, and a hierarchy / rule system; the structural arrangement can include volume / chapter outlines, allocating the main plot to specific text segments (chaps), planning the rhythm of each part, and setting key events, practical details, etc. Details can include the expected word count, target audience, and opening highlights; alternatively, the core concept of the analysis report can include the technical field, report type, and theme; the content outline can include descriptions of specific stages and the main ideas, such as a chain structure and related summaries of each specific stage including "Introduction-Abstract-Background-Main Body-Conclusion-References"; element settings can include the definition of the report's analysis object, the equipment used in the report, and report writing standards; structural arrangements can include a volume / chapter outline, allocating the main ideas to specific text segments (chaps), and planning the core of each part; practical details can include the expected word count, the proportion of each stage, and the target audience. Understandably, different types of long texts can have different structural outline data and global summary data, and are not limited to the examples above.
[0030] Specifically, the master control agent can also provide trigger instructions for specific stages to the collaborative decision-making agent based on the architecture outline data, so as to trigger the collaborative decision-making agent to make planning decisions for text segments in the corresponding stage, such as generating trigger instructions for planning a certain text segment in the background introduction stage of a long story, and sending it to the collaborative decision-making agent.
[0031] Specifically, the global summary data is used to indicate the concise content and summary of the long text to be generated in the current stage, and to provide the current context information of the long text. In the initialization stage, that is, before text fragments are formed, the global summary data is obtained by the master agent expanding the content of the target topic. After the text fragments are generated, the global summary data is updated based on the content of the text fragments, realizing the dynamic updating of the background information of the long text.
[0032] S203: During the generation of each text segment in the order of segments, a blueprint is generated based on the collaborative decision-making agent, using the current global summary data as context information, to obtain the segment blueprint data of the corresponding text segment.
[0033] Specifically, the long text generation process is carried out iteratively by text segments (such as chapters). Based on the segment order indicated by the architecture outline data, the master agent triggers the generation process of all text segments in the long text one by one, and in the generation process of each text segment, it triggers each agent to perform corresponding task operations.
[0034] Specifically, during the blueprint generation process, the collaborative decision-making agent reads the current global summary data from the shared memory system to serve as context information for blueprint generation of the corresponding text fragment, which refers to the text fragment that needs to be generated at the moment.
[0035] Specifically, the current global summary data for the first text segment is the global summary data generated by the main control agent based on the target topic. The current global summary data for subsequent text segments is obtained by updating the global summary data based on previous text segments, where the previous text segments are all text segments generated before the text segment to be generated. In some embodiments, the current global summary data includes an integrated summary of all currently generated text segments. Preferably, the current global summary data may further include a segment summary of the previous text segment to improve the coherence between the current text segment and the previous text segment.
[0036] Specifically, fragment blueprint data is used to guide the system planning and design of corresponding text fragments. In some embodiments, fragment blueprint data includes fragment outline data and object configuration data for the corresponding text fragment. The fragment outline data describes the chronological sequence of "content units" that constitute the content of the corresponding text fragment, specifically describing the specific steps, sequences, and key actions of the fragment's internal development, serving as an "action guide" driving content development. The object configuration data, as a dynamic knowledge base, covers object description information for each text subject object. This object description information describes the attributes, relevant background knowledge, relationships with other objects, etc., of the text subject object. The text subject object is the main analysis or description object in a long text. For example, in a long story, the text subject object is a character, and the object description information is a character profile, used to describe the character's inherent traits, motivations, backstory, and constantly changing relationships, etc. In an analysis report, the text subject object can be an analysis object, such as a certain type of people or a certain type of asset, and the object description information is an object profile, which can be used to describe the analysis object's inherent traits, background knowledge, and relationship network, etc. Understandably, different types of long texts can have different text subject objects and object description information, not limited to the examples above.
[0037] In a possible implementation, the collaborative decision-making agent includes a planning agent and an object agent. For each text segment, using the current global summary data as context information, the planning agent generates a segment outline, and the object agent describes the text object, resulting in corresponding segment outline data and object configuration data. This further decomposes the blueprint generation task. Accordingly, referencing... Figure 4 S203 may include S301-S305: S301: For each text segment, based on the planning agent, a segment outline is generated using the current global summary data and the object configuration data corresponding to the preceding text segment as context information, to obtain the segment outline data of the corresponding text segment.
[0038] Specifically, the planning agent adopts a just-in-time planning (JIT) mode, invoked by the master agent and guided by the architecture outline data. Before the start of each chapter, the master agent issues a trigger command for the current text segment based on the architecture outline data (such as specific stages like the "beginning," "development," "climax," and "ending" of a long story), initiating the planning agent to execute relevant tasks. At the beginning of each text segment, the planning agent reads the current global summary data and previously generated object configuration data from the shared memory system as information indicators, generating a detailed and structured segment outline for the corresponding text segment. This just-in-time planning method ensures the flexibility of text content planning, allowing subsequent text segments to be adjusted based on the generated content.
[0039] Understandably, for the first text segment, the current global summary data is the global summary data generated in S201, that is, the global summary data generated by the main control agent based on the target topic, and the object configuration data corresponding to the preceding text segment is empty. For subsequent text segments, the current global summary data is obtained by updating the global summary data in S201 by combining the generated text segments, and the object configuration data corresponding to the preceding text segment is obtained by the object agent based on the detailed outline data of the preceding segment to describe the text objects, that is, it includes the object description information of all text subject objects in the preceding text segment.
[0040] Accordingly, the detailed outline data of the first text segment is generated using the global summary data as contextual information. For the first text segment, the global summary data is input into the planning agent to generate the segment outline, resulting in the detailed outline data of the first text segment. This detailed outline data covers all text subject objects appearing in the first text segment.
[0041] Furthermore, for non-first text segments of a long text, the object configuration data corresponding to the preceding text segments is obtained by updating the object configuration data of the first text segment based on the segment outline data of each preceding non-first text segment. After obtaining the segment outline data of each text segment, the current object configuration data is updated based on the segment outline data. This process is repeated to enable the object configuration data to be dynamically updated, maintain consistency with the generated document, and provide detailed object description information for subsequent text generation.
[0042] Specifically, the current global summary data and the object configuration data corresponding to the preceding text fragments are input into the planning agent to generate fragment outlines, resulting in detailed fragment outline data for the corresponding non-first text fragments. Understandably, the currently generated detailed fragment outline data may involve changes to the information of the original text subject objects, such as character blackening or expansion of analysis object information, and may also include new text subject objects, such as new characters or new analysis objects. Therefore, it is necessary to update the object configuration data corresponding to the preceding text fragments based on the detailed fragment outline data to ensure the continuity and consistency of the text content.
[0043] In one example, the instruction text input for the planning agent to generate fragment outlines could be: You are a top-notch, imaginative story planner. Your task is to design a detailed, structured outline for the next chapter of a novel.
[0044] You must plan carefully based on the global summary data and existing role profiles (object configuration data).
[0045] **Global Summary Data:** {global_summary} **Current Main Character Profiles:** {characters} **Your task:** Generate a JSON object containing the following fields as a detailed execution outline in the next chapter.
[0046] 1. `chapter_goal` (string): Summarize the core narrative goal of this chapter in one sentence.
[0047] 2. `scene_by_scene_outline` (list of strings): An ordered list, each item describing a key event, location, and atmosphere of a scene.
[0048] 3. `character_focus` (object list): Lists all the **main characters** who appear or are mentioned in detail in this chapter. Each object should contain a `name` key.
[0049] 4. `minor_characters_in_scene` (List of objects): Lists all minor characters appearing in this chapter. Each object must contain a `name` and a `description` key. Even if a character has appeared before, it must be provided again.
[0050] 5. `new_character_descriptions` (List of objects): If you are introducing a **new major character**, provide its description and importance here. Each object must contain a `name`, a `description`, and `importance: "major"`.
[0051] 6. `next_chapter_hook` (string): Describe in one or two sentences the suspense or hook left at the end of this chapter to entice the reader to continue reading.
[0052] **Output Format:** It only returns the raw JSON object, without any surrounding text or markdown formatting.
[0053] **For example:** json {{ "chapter_goal": "Have Detective Wang Han obtain the crucial clue 'Data Ghost' from informant Lily, and at the end, encounter a warning attack that makes him realize the danger." "scene_by_scene_outline": [ Scene 1: Detective Wang Han finds his informant Lily's underground shop under the neon lights of a rainy night. Scene 2: The two sides engaged in a conversation filled with probing and coded language, with Wang Han exchanging an old object for information. Scene 3: Lily reveals her warning about the 'data ghost' and hands him an encrypted chip. A silent bartender wipes glasses nearby. Scene 4: As Wang Han left, he was briefly detected and scanned by a drone as a warning. ], "character_focus": [ {{ "name": "Wang Han" }}, {{ "name": "Lily" }} ], "minor_characters_in_scene": [ {{ "name": "Bartender", "description": "A taciturn bartender with a prosthetic arm." }} ], "new_character_descriptions": [ {{ "name": "Lily", "description": "A mysterious information dealer working on the black market, who only cares about money but seems to know many secrets." "importance": "major }} ], "next_chapter_hook": "Although Wang Han obtained the chip, he also exposed his whereabouts. How can he crack the chip while evading detection?" }} ``` Now, let's create a detailed blueprint for the next chapter.
[0054] S303: Based on object-oriented intelligent agents, text objects are described using the current global summary data and the fragment outline data of the corresponding text fragments as context information, and the object configuration data of the corresponding text fragments is obtained.
[0055] Specifically, the object agent is responsible for managing the lifecycle of all text subject objects (such as roles, analysis objects, algorithms used in software engineering documents, etc.) and creating detailed object description information for each text subject object. After the fragment outline data of each text segment is generated, the previously generated object configuration data is updated in conjunction with the fragment outline data, thereby realizing the creation of object descriptions for newly added text subject objects and / or the updating of object descriptions for historical text subject objects.
[0056] Specifically, the object configuration data of the corresponding text fragment includes the object description information of the text subject objects involved in the previously generated fragment outline data and the currently generated fragment outline data. That is, it covers the existing historical text subject objects and the newly added text subject objects in the current fragment outline data, so as to realize the dynamic updating of the object configuration data.
[0057] Furthermore, the object configuration data for the first text fragment includes object description information for each text subject object corresponding to the first text fragment. This object configuration data is generated with the global summary data and the fragment outline data of the first text fragment as contextual information. In this way, for the first text fragment, the outline and object configuration are created using the global summary data as content guidance, realizing the generation of the first blueprint data for long text generation, so as to facilitate the content extension and expansion of subsequent text fragments.
[0058] Specifically, the global summary data and the detailed outline data of the first text segment are input into the object agent. Using the global summary data and the detailed outline data as background information and guidance, object descriptions are performed for each text subject object involved in the detailed outline data of the first text segment, resulting in object configuration data for the first text segment. This object configuration data includes the object description information for each text subject object corresponding to the first text segment. In other words, each text subject object corresponding to the first text segment is equivalent to all text subject objects involved in the detailed outline data of the first segment.
[0059] Specifically, the object configuration data for non-first text segments is obtained by updating the object configuration data of preceding text segments using the current global summary data and the segment outline data of the corresponding non-first text segments as context information. Thus, for other text segments after the first text segment, outline creation and object configuration updates are performed using the latest global summary data and the object configuration data updated based on the segment outline data generated previously. This achieves blueprint data generation that combines previously generated content, ensuring the logical correlation, content consistency, and object consistency between each text segment and its predecessors, thereby improving the quality of long text generation.
[0060] In specific implementation, the current global summary data and the detailed outline data of the corresponding non-first text fragments can be input into the object agent as information guidance to update the object configuration data corresponding to the previous text fragments, thereby obtaining the object configuration data for the non-first text fragments to be generated. This object data update can involve describing each text subject object in the currently generated detailed outline data to obtain the object description information for each newly added text subject object, and adding it to the object configuration data of the previous text fragments; and / or, based on the currently generated detailed outline data and the current global summary data, updating the object description information of the historical text subject objects corresponding to the previous text fragments to achieve iterative description information of historical text subject objects.
[0061] In one example, the instruction text input for instructing the object agent to describe the object can be: You are a character (text body object) creation expert. Based on the provided brief description, create a detailed character profile in JSON format.
[0062] **The role to be created:** - Name: {character_name} - Description: {character_description} **Your task:** Expand upon the description to create a rich character profile. The profile should be a JSON object containing the following keys: - `name`: The character's name.
[0063] - `age`: Approximate age of the character.
[0064] - `occupation`: The role or main role of the character.
[0065] - `appearance`: A detailed description of their appearance.
[0066] - `personality`: Main personality traits, habits, and behaviors.
[0067] - `background`: A brief history of the character's life before the story takes place.
[0068] - `motivation`: What motivates the characters? What are their main goals? **Output Format:** Return only the raw JSON object, enclosed in `json ...`, without any other text.
[0069] S305: Generate fragment blueprint data for the corresponding text fragment based on fragment outline data and corresponding object configuration data.
[0070] Specifically, fragment blueprint data is determined based on the fragment outline data and object configuration data corresponding to the text fragment to be generated, and stored in the shared memory system. Thus, in this embodiment, the blueprint generation task is decomposed into fragment outline generation task and object description task, refining the granularity of task decomposition, and realizing the separate generation, expansion and updating of object descriptions. This ensures the consistency of outline logic between fragments while also helping to ensure the coherence of the main object in the entire text narrative.
[0071] S205: Based on the writing agent, the content is generated using the current global summary data and the corresponding fragment blueprint data as context information to obtain the initial text fragment of the corresponding text fragment.
[0072] In a possible implementation, the writing agent is used to convert the structured fragment outline data generated by the planning agent into text fragments. That is, it receives the fragment outline data of the text fragment to be generated, uses the object configuration data and the current global summary data as relevant background information, and generates the complete text of the text fragment.
[0073] Specifically, the current global summary data and the fragment blueprint data of the corresponding text fragment generated in S203 are input into the writing agent. Using the current global summary data and object configuration data as background information, the fragment outline data is transformed into fragment content, thus obtaining the initial text fragment. In this way, the writing agent, combined with the context information in the shared memory system, "translates" the fragment outline data into specific text, generating the initial text fragment.
[0074] In one example, the instruction text input for the writing agent to generate text fragments could be: You are an experienced literary writer, skilled at creating novels that are natural, fluent, and rich in literary merit. Your task is to create a chapter of vivid and realistic novel content.
[0075] **Global Story Summary (Long-Term Background):** {global_summary} **Recent Chapter Summary (Short-Term Background):** {recent_summary} **Character Profiles (including aliases) for this Chapter:** json {characters} ``` **Chapter Blueprint:** json {detailed_plan} ``` **Core Writing Principles:** 1. **Show, Don't Tell**: Instead of directly describing the emotional state (e.g., "He is angry"), show it through actions, dialogue, and details (e.g., "He clenched his fists, and his knuckles turned white").
[0076] 2. **Natural Dialogue:** Dialogue should be appropriate to the character's identity and the context, avoiding overly formal, written expressions. Use conversational and natural language.
[0077] 3. **Sensory Details**: Incorporate specific sensory descriptions (sight, hearing, smell, touch) to make the scene more three-dimensional.
[0078] 4. **Natural Psychological Activities:** The psychological activities of the characters should be consistent with their personalities, avoiding being too straightforward or didactic.
[0079] 5. **Avoid AI-sounding tone:** Avoid using formulaic expressions and repetitive sentence structures; strive for linguistic diversity and naturalness.
[0080] **Specific Improvement Points:** - **Naturalize the conversation:** Avoid repetitive words like "said" or "asked," and use a wider range of conversational verbs (such as "whisper," "roar," "chuckle," etc.). - **Sentence Structure Variety:** Combine long and short sentences, and avoid excessive use of sentences beginning with "he / she". - **Specific details:** Use concrete, vivid details to avoid abstract descriptions. - **Subtle Expression of Emotions:** Emotional expression should be subtle and restrained, revealed through details. - **Pace Control**: Adjust the narrative pace according to the needs of the scene; fast pace for tense scenes, slow pace for lyrical scenes. **Word Count Requirement:** Chapter content should be substantial, with a minimum of 800 words.
[0081] **Clean Output:** Do not add any extra comments, notes, or descriptions. Output only the chapter title (as a Markdown H2 heading) and the complete chapter content.
[0082] **Output Example:** Chapter 1: Silence and Undercurrents On the training ground, the blazing sun baked the bluestone slabs until they were scorching hot, sending up swirling plumes of steam. The young men sweated profusely, their fighting spirit swirling and creating a series of whooshing sounds... Now, please create chapter content titled "{chapter_title}".
[0083] S207: Based on the review agent, content quality analysis is performed using the current global summary data and corresponding fragment blueprint data as benchmark information to obtain the quality analysis results of the corresponding initial text fragments.
[0084] Specifically, the review agent is the system's "quality control center," embodying the critical ability of revision. After the writing agent generates the initial text document, it calls upon the review agent to conduct a rigorous quality assessment, comparing the initial text document with the context information in the shared memory system, and outputting structured quality analysis results. The quality analysis results are used to indicate whether a fragment passes or fails, and carry text feedback data to guide revision.
[0085] Specifically, in response to the generation of the initial text fragment, the review agent retrieves the current global summary data and corresponding fragment blueprint data from the shared memory system. It then rigorously compares the received initial text fragment with the current global summary data and corresponding fragment blueprint data (including current object configuration data and fragment outline data) to achieve quality auditing. In some implementations, S207 may include S401-S403: S401: Input the current global summary data, fragment blueprint data and initial text fragment into the review agent. Using the current global summary data and fragment blueprint data as the reference information, perform fragment blueprint execution degree detection based on blueprint execution detection instructions, global content consistency detection based on consistency detection instructions and expression quality detection based on writing quality detection instructions on the initial text fragment, and obtain execution degree results, consistency results and expression quality results respectively. S403: Generate quality analysis results based on execution results, consistency results, and expression quality results.
[0086] Specifically, pre-defined instruction templates can be used for blueprint execution detection, consistency detection, and writing quality detection instructions. Based on these templates, the current global summary data, and fragment blueprint data, blueprint execution detection, consistency detection, and writing quality detection instructions are generated respectively. The blueprint execution detection instruction instructs the degree of execution of the initial text fragment against the corresponding fragment blueprint data. This determines whether the initial text fragment fully and accurately implements all the planning points in the fragment outline data, and whether there are any content deviations (such as plot deviations or research direction shifts), i.e., whether the generated content strictly follows the fragment outline plan. The consistency detection instruction instructs the consistency of the initial text fragment's content, including but not limited to logical inconsistency detection and object continuity detection. The former determines whether the content (such as plot) development conforms to causal relationships, maintains coherence with existing content, and has logical loopholes. The latter determines whether the object display conforms to the object description in the object configuration data, such as whether the character's words and actions match their established personality and motivation. The writing quality detection instruction instructs the quality of the initial text fragment's writing style, considering the richness of the text's description, the naturalness of the dialogue, and the control of the narrative rhythm. Accordingly, performance results may include performance scores and corresponding performance issue feedback; consistency results may include consistency scores and corresponding consistency issue feedback; and expression quality results may include expression quality scores and corresponding expression quality issue feedback. In some cases, quality analysis results may be structured feedback reports to encompass all of the above results.
[0087] In this way, the initial text fragments are not directly adopted. Instead, the draft is reviewed by a review agent from the perspectives of consistency, performance, and writing quality, using global summary data and blueprint data as contextual information. This enables dynamic reflection and avoids the amplification of early errors.
[0088] S209: The initial text segment indicating that the quality analysis results have passed is identified as the corresponding text segment of the long text.
[0089] Specifically, if all the results in the quality analysis meet the preset quality conditions, the current initial text fragment is indicated to have passed the review, the current process ends, the initial text fragment is confirmed as the final text fragment, and is formally written into the "evolution document" section of the shared memory system.
[0090] In summary, the technical solution of this application constructs a multi-agent system comprising a master agent, a collaborative decision-making agent, a writing agent, and a review agent. The master agent generates an outline, obtaining architecture outline data and global summary data, and then sequentially generates text fragments based on the fragment order indicated by the architecture outline data. During this process, the collaborative decision-making agent uses the global summary data as contextual information to generate fragment blueprint data and updates the global summary information accordingly, ensuring the accuracy and timeliness of the context, thereby ensuring the quality of the fragment blueprint data and the fragments output by the writing agent. Furthermore, the review agent uses the current global summary data and corresponding fragment blueprint data as benchmark information to perform content quality analysis on the output of the writing agent, obtaining quality analysis results. This review feedback mechanism simulates advanced cognitive abilities such as long-term planning, dynamic reflection, and global correction, avoiding "cognitive breaks," significantly improving the logical coherence and long-term consistency of the generated text, and achieving high-quality long-text output.
[0091] In a possible implementation, the quality analysis results indicating failure include text feedback data for the corresponding initial text segment. This text feedback data describes the quality problem, its cause, and the location of the text segment where the problem is identified. In some cases, the text feedback data may also include suggestions for document revision. Accordingly, refer to... Figure 5 The method may also include: S211: If the quality analysis result indicates that the writing agent fails, the text feedback data is used as the text revision instruction for the writing agent. The corresponding initial text segment is corrected to obtain the corrected text segment. S213: Based on the review agent, the current global summary data and the corresponding fragment blueprint data are used as benchmark information to perform content quality analysis on the corresponding corrected text fragments and obtain updated quality analysis results. S215: The corrected text fragment indicating that the updated quality analysis results have passed is identified as the corresponding text fragment.
[0092] Specifically, a template for manuscript correction instructions can be preset. Text feedback data is then populated into this template to generate correction instructions. The writing agent, guided by this feedback data, makes partial corrections or rewrites the entire text, generating corrected text fragments. These corrected text fragments are then re-entered into the review agent for content quality analysis, triggering a new round of evaluation. If the evaluation passes, the corrected text fragment is officially recognized. In this way, textual feedback data from the writing agent is used to correct textual issues and re-execute content quality analysis, enabling the system to dynamically self-correct and improve the quality of text fragments.
[0093] In some implementations, the method further includes S217: if the updated quality analysis result indicates failure, repeat the steps of segment correction and content quality analysis until the corresponding quality analysis result indicates success, and obtain the corresponding text segment.
[0094] Specifically, if a revised text fragment fails the review again, based on the updated quality analysis results and text feedback data, it re-enters the text revision process of the writing agent. The output of this revised text then re-enters the review agent for content quality analysis, thus continuously executing the "generation -> reflection -> revision" cycle until the quality analysis result of the revised text fragment indicates approval, resulting in the corrected text fragment. In some cases, a first threshold can be set; if the number of times the quality analysis result indicates failure exceeds this threshold, an error is reported and relevant personnel are notified to revise. In this way, through the unique cognitive hierarchical architecture of the multi-agent system, and the iterative revision and review by the writing and review agents, the core challenges in long text generation tasks are effectively solved, ultimately producing high-quality text that is logically rigorous, consistently accurate, and creative.
[0095] In other embodiments, the method further includes S219-S211: S219: If the updated quality analysis result indicates failure, the text feedback data carried by the updated quality analysis result shall be used as the blueprint revision instruction of the collaborative decision-making agent to correct the corresponding fragment blueprint data and obtain the updated fragment blueprint data. S221: Based on the updated fragment blueprint data, repeat the content generation step and content quality analysis step for the corresponding text fragment, and obtain the corresponding text fragment if the corresponding quality analysis result indicates that it passes. Specifically, if the corrected text fragment still fails to pass, the system determines that the problem may originate from a deeper level and automatically reverts to the blueprint generation process of the first-stage collaborative decision-making agent to fundamentally correct the problem. This is a correction mode based on cascading correction and reverting mechanism that achieves precise positioning and step-by-step reverting, which greatly improves computational efficiency and correction effect.
[0096] Specifically, the process can begin by executing n cycles of writing agent revision followed by review agent revision, based on the aforementioned S217. If the quality analysis result output by the review agent still fails after n cycles, it reverts to the collaborative decision-making agent, revising the fragment blueprint data based on the latest quality analysis result's text feedback data. Specifically, it can revert to the planning agent for detailed outline revision and the collaborative object agent for object configuration data revision. Then, based on the revised fragment blueprint data, the writing agent rewrites the initial text fragment and executes the review agent's content quality analysis process. If successful, the text fragment is obtained; otherwise, it reverts to the writing agent for revision, and so on, implementing a cascading revert mechanism to achieve a revised text fragment that passes review. In some cases, a second threshold is set. If the number of revisions to the fragment blueprint data exceeds the second threshold and the quality analysis result still indicates failure, an error is reported and relevant personnel are notified.
[0097] Specifically, the master agent can first generate a planning trigger instruction for the first text fragment, so that the collaborative decision-making agent can execute the blueprint generation of the first text fragment; after generating the corresponding fragment blueprint data, it generates a writing trigger instruction to trigger the writing agent to generate content; and after obtaining the initial text fragment of the corresponding text fragment, it generates a review trigger instruction to enable the review agent to perform content quality analysis, and then triggers the storage or correction process of the text fragment based on the quality analysis results, thereby executing the generation cycle of the next text fragment.
[0098] In one example, the instruction text input for the review agent to perform a third-stage review (content quality analysis) could be: You are a senior novel editor. Your task is to evaluate whether the **chapter drafts** faithfully implement the **chapter outlines** and are consistent with the **overall summary**.
[0099] **Global Story Summary:** {global_summary} **Chapter Outline:** json {chapter_plan} ``` **Character Profiles for This Chapter:** json {characters} ``` **Chapter Draft Content:** --- {chapter_content} --- **Review Task - Phase Three: Chapter Draft Quality Check** Please carefully check the following aspects: **A. Detailed Implementation (Most Important)** 1. **Goal Achievement:** Has the core objective set in `chapter_goal` been achieved? 2. **Scene Integrity**: Are all scenes in `scene_by_scene_outline` fully rendered? 3. **Character Appearance**: Did all the characters in `character_focus` and `minor_characters_in_scene` appear as planned? 4. **Suspense Setting:** Did the suspense of `next_chapter_hook` appear at the end of the chapter? **B. Global Consistency** 5. **Consistent Background:** Does the chapter content align with the world view and past events outlined in the global summary? 6. **Role Consistency**: Do the character's behavior and dialogue match the personality and motivation settings in their profile? 7. **Logical Coherence**: Is there a reasonable cause-and-effect relationship between the events within the chapter? **C. Writing Quality** 8. **Full Description:** Are the descriptions of the scenes, characters, and actions vivid and detailed? 9. **Natural Dialogue:** Does the dialogue match the characters' identities and personalities? 10. **Pace Control**: Is the narrative pace reasonable (not dragging or rushing)? **Output Format:** Please return a JSON object containing the following fields: json {{ "is_compliant": true / false, "confidence": 0.0-1.0, "execution_score": {{ "goal_achievement": 0-10, "scene_completeness": 0-10, "character_presence": 0-10, "hook_effectiveness": 0-10 }}, "consistency_score": {{ "background_consistency": 0-10, "character_consistency": 0-10, "logic_coherence": 0-10 }}, "quality_score": {{ "description_richness": 0-10, "dialogue_naturalness": 0-10, "pacing": 0-10 }}, "issues": [ {{ "category": "Detailed outline execution / Overall consistency / Writing quality", "type": "Specific problem type", "severity": "critical / major / minor", "description": "Detailed problem description", "location": "The approximate location where the problem occurred (e.g., scenario 2)", "suggestion": A suggested modification }} ], "missing_elements": [ List the elements required in the outline but missing from the draft. ], "overall_assessment": "Overall evaluation (2-3 sentences)", "rewrite_guidance": "Specific guidance for WriterAgent if rewriting is required." }} ``` **Judgment Criteria:** - If any `critical` level issues exist, `is_compliant` must be `false`. - If any item in `execution_score` is below 6, `is_compliant` should be set to `false`. - If the `missing_elements` list is not empty, `is_compliant` must be `false`. Now, please begin the review.
[0100] In a possible implementation, after S209, S215 or S221, the method further includes S501: inputting the currently generated text fragment into the master agent to update the summary content of the current global summary data, and using the updated global summary data as context information for the next text fragment generation process.
[0101] Specifically, in response to the generation of the current text fragment, the controlling agent reads the current global summary data and the currently generated text fragment from the shared memory system, understands the content of the text fragment to update the current global summary data, and thus incorporates the core content of the new text fragment to provide the latest global context for all subsequent agents. The updated global summary data serves as the "current global summary data" used when generating the next text fragment, thus enabling the multi-agent system to enter the cyclical generation process of the next text fragment. Based on the architecture outline data, it triggers the blueprint generation stage of the next text fragment, repeating the generation steps of the previous text fragment until the entire long text creation is completed. In this way, the long text generation process is transformed from a linear, irreversible pipeline into a dynamic, self-correcting cognitive process, thereby ensuring the high quality of the final generated text.
[0102] In a possible implementation, after S209, S215 or S221, the method further includes S503: updating the object description of the current object configuration data by the input object agent of the currently generated text fragment, and using the updated object configuration data as context information for the next text fragment generation process.
[0103] Specifically, after generating all text segments of the long text based on the architecture outline data, the long text is obtained, which is arranged according to the text architecture and segment order in the architecture outline data.
[0104] In summary, by designing a novel cognitive process-based long text generation method, through its unique cognitive hierarchical architecture and "generation-reflection-correction" cycle, the multi-agent system is endowed with advanced cognitive capabilities such as long-term planning, dynamic reflection, and global correction. This effectively solves the core challenges of existing technologies in long text generation tasks and ultimately produces high-quality text that is logically rigorous, consistent over the long term, and creative.
[0105] In one embodiment, reference Figure 6 The multi-agent system applied to long text generation methods is based on a cognitive hierarchy architecture. It can include a cognitively hierarchical agent module consisting of a cascaded master agent, planning agent, object agent, writing agent, and review agent. The master agent is responsible for scheduling and coordination, the planning agent for real-time planning, the object agent for object description and object archiving, the writing agent for content generation, and the review agent for review and correction, simulating different cognitive processes in writing. A shared memory system establishes a dynamic knowledge base shared by all agents, storing architecture outline data, fragment outline data, object configuration data, and global summary data. It can also store the evolved manuscript formed from text fragments, serving as the sole source of facts for system generation and correction, ensuring information consistency. The review agent drives a closed-loop workflow; the initial text fragments generated by the writing agent must undergo rigorous review by the review agent. If problems are found, text feedback data is generated and the text is returned for modification. This process is repeated, forming a "generation-reflection-correction" cycle to ensure the text fragment quality meets standards. Through the collaborative work of the above modules, this invention transforms the long text generation process from a linear, error-prone pipeline into a dynamic cognitive system with self-correcting capabilities, thereby significantly improving the logical coherence and long-term consistency of the generated text.
[0106] It should be noted that the agents in this application can be constructed based on large language models, such as Gemini-2.5-Flash. Different agents can use the same large language model or different large language models. Each agent can directly use a pre-trained model, or it can be obtained by fine-tuning the pre-trained model based on training samples. Training samples can include sample long texts and sample tags. Sample tags can include architecture outline tags and global summary tags for the master agent, detailed outline tags for the planning agent, object description tags for the object agent, and various analysis result tags for the review agent. Training can be carried out using a local freeze method or a system-wide adjustment method, which can be implemented based on requirements and existing technologies. No specific restrictions are imposed here.
[0107] To verify the effectiveness of the aforementioned technical methods, this application uses a long-story generation task and compares them with two representative baseline models. Evaluation metrics include coherence and consistency, with LLM (Limited Ledger Model) serving as the evaluator, scoring from 0 to 10.
[0108] - Baseline Model 1 (Single Agent): Uses a powerful single LLM to generate full text with a single prompt.
[0109] - Baseline Model 2 (Pipeline MAS): Uses the same multiple agents as in this invention (master agent, collaborative decision-making agent, and writing agent, but without an auditing agent), organized into a rigid, feedback-free linear pipeline.
[0110] - This invention: Employs a multi-agent structure and a "generation-reflection-correction" cycle based on the cognitive hierarchical architecture proposed in this paper.
[0111]
[0112] Table 1: Main experimental results (%), bold numbers indicate best performance.
[0113] As shown in Table 1, the method of this invention has significant advantages compared to the other two baseline models: 1. Significantly effective in addressing core pain points: Compared to Pipeline MAS, this invention achieves an absolute improvement of 5.0 points in logical coherence (from 4.0 to 9.0), proving that the "generate-reflect-correct" cycle effectively overcomes the "cognitive discontinuity" problem. Compared to Single Agent, this invention achieves an absolute improvement of 4.0 points in long-term consistency (from 2.0 to 6.0), proving that the architecture of this invention effectively solves the memory and consistency defects of a single model.
[0114] 2. Outperforming the baseline across the board: This invention achieved the highest or tied highest scores in all four dimensions, with an average score (8.25) far exceeding the two baseline models. This demonstrates the effectiveness of simulating human cognitive processes by freeing the writing agent's creativity by entrusting the cognitive burden of maintaining consistency to a dedicated reflection loop, allowing it to better focus on enhancing the vividness and interest of the text.
[0115] The above embodiments employ a mechanism of reviewing and reverting text fragments after initial text fragment output, achieving excellent long text writing results. To further improve the quality of long text generation, some embodiments may implement a three-stage cascading review and correction mechanism, namely: a first stage; a second stage: object reliability review; and a third stage: content quality review, wherein the third stage is similar to the aforementioned embodiments. Accordingly, S301 may specifically include S601-S605: S601: For each text segment, input the current global summary data and the object configuration data corresponding to the previous text segment into the planning agent to generate the segment outline and obtain the initial detailed outline data; S603: Based on the review agent, the outline quality analysis is performed on the corresponding initial outline data using the current global summary data as the benchmark information to obtain the outline analysis results; S605: The initial outline data indicated by the outline analysis results is determined as the segment outline data of the corresponding text segment.
[0116] Specifically, in the initial stage of each text segment generation process, the planning agent reads the current global summary data and the object configuration data corresponding to the previous text segment from the shared memory system to perform the segment outline generation operation for the current text segment, thereby obtaining the initial detailed outline data. The initial detailed outline data generation process for the first and non-first text segments is described above and will not be repeated here.
[0117] Specifically, after generating initial outline data, the review agent is triggered to read the current global summary data to guide the execution of outline quality analysis. For example, the outline quality analysis for a long story may include the following dimensions: plot coherence, world-building consistency, timeline plausibility, causality, and foreshadowing. The outline analysis results indicate whether the initial outline data passes or fails, and include outline feedback data indicating outline issues. If the indication passes, the current initial outline data is identified as fragment outline data, triggering the object agent's object description operation and storing it in the shared memory system. Thus, the first-stage outline review achieves planning consistency verification, ensuring the correctness of the long text's macro-structure and preventing subsequent work from being built on an incorrect foundation.
[0118] In some implementations, the outline analysis results indicating failure include outline feedback data corresponding to the initial outline data, and the method further includes S607-S611: S607: If the outline analysis results indicate that the outline is not approved, the outline feedback data shall be used as the outline revision instruction for the planning agent, and the corresponding initial outline data shall be modified to obtain the revised outline data. S609: Based on the review agent, the current global summary data is used as the benchmark information to perform outline quality analysis on the corresponding revised outline data, and the updated outline analysis results are obtained. S611: The revised outline data indicated by the updated outline analysis results is identified as the fragment outline data of the corresponding text segment.
[0119] Specifically, a template corresponding to the outline revision instruction can be preset, and the outline revision instruction can be generated based on the template and outline feedback data. This allows the planning agent to perform detailed outline revisions based on the problem feedback and revision suggestions in the outline feedback data, making partial corrections or complete rewritings of the initial detailed outline data. If the obtained revised detailed outline data meets the quality requirements and passes the review, it is identified as fragment detailed outline data. Conversely, if the data fails, the process reverts to the planning agent, and the revised detailed outline data is further revised based on the outline feedback data in the latest outline analysis results. This process is repeated until the revised detailed outline data passes the review and is used as fragment detailed outline data. In some cases, a third threshold can be set. If the number of revisions to the initial detailed outline data reaches the third threshold and still fails the review, an error is reported and relevant personnel are notified.
[0120] Thus, during the generation of each text fragment, after receiving the corresponding trigger command, the planning agent generates a detailed initial outline based on the global summary data and object configuration data in the shared memory system. This outline is not immediately used for writing but is first submitted to the review agent. The review agent conducts the first stage of review of the initial outline data, rigorously checking its consistency with the global summary data and assessing whether there are any issues such as conflicting worldview settings, disordered timelines, unreasonable causal relationships, or omission of key foreshadowing. If the review finds logical flaws at the planning level, the initial outline data will be rejected, along with feedback or modification suggestions, requiring the planning agent to re-plan. This ensures the correctness of the long text content in terms of macro-structure and avoids the amplification of early errors in subsequent writing and text fragment generation processes.
[0121] In one example, the instruction text input for instructing the review agent to conduct the first stage of review could be: You are a meticulous story logic reviewer. Your task is to evaluate the consistency between the **chapter outlines** and the **overall story summary**.
[0122] **Global Story Summary:** {global_summary} **Chapter Outline:** json {chapter_plan} ``` **Review Task - Phase 1: Planning Consistency Check** Please carefully check the following aspects: 1. **Plot Coherence**: Does the `chapter_goal` of this chapter align with the overall direction of the story? Are there any abrupt jumps in plot? 2. **Worldview Consistency:** Do the scene settings and background elements conform to the established worldview? 3. **Timeline Reasonableness**: Is the chronological order of events reasonable? 4. **Causal Relationship**: Does the event planned in this chapter have a reasonable antecedent (from the global summary)? 5. **Foreshadowing and Echoes:** Did we overlook the important unresolved clues mentioned in the overall summary? **Output Format:** Please return a JSON object containing the following fields: json {{ "is_consistent": true / false, "confidence": 0.0-1.0, "issues": [ {{ "type": "Plot coherence / Worldview consistency / Timeline plausibility / Causality / Foreshadowing and echoing", "severity": "critical / major / minor", "description": "Detailed problem description", "suggestion": A suggested modification }} ], "overall_assessment": "Overall evaluation (1-2 sentences)" }} ``` **Judgment Criteria:** - If any critical issues exist, `is_consistent` must be `false`. - If there are more than two major-level issues, `is_consistent` should be `false`. - `confidence` indicates your level of confidence in this judgment. Now, please begin the review.
[0123] After the detailed outline data of the current text segment passes the first stage review, there may be changes in the information of existing text main objects or the addition of new text main objects, which will trigger the creation or update of object configuration data. Accordingly, in some implementations, 303 may include S701-S705: S701: For each text segment, input the current global summary data and the segment outline data of the corresponding text segment into the object agent to describe the text object and obtain the initial configuration data; S703: Based on the review agent, the description quality analysis of the initial description information of newly added text subjects is performed using the current global summary data and the object description information of historical text subjects as benchmark information, and the object analysis results of each initial description information are obtained. S705: The initial description information indicated by the object analysis results is determined as the object description information of the corresponding newly added text subject object.
[0124] Specifically, the initial configuration data includes object description information of historical text main objects corresponding to previous text fragments and initial description information of newly added text main objects in the fragment outline data of the corresponding text fragment. The generation method of object configuration data for the first and non-first text fragments is described above and will not be repeated here. After obtaining the initial configuration data, the review agent is triggered to read the current global summary data and the initial configuration data. Using the current global summary data and the object description information of the current historical text main objects, the agent guides the execution of description quality analysis of the initial description information of each newly added text main object, analyzing the reliability information such as the description rationality and necessity of the newly added text objects. For example, the description quality analysis of a long story may include the following dimensions: character necessity, character rationality, character conflict, character depth, naming rationality, etc. The description analysis results are used to indicate whether the initial description information passes or fails, and include description feedback data indicating description problems. If the indication passes, the current initial description information is determined as the object description information of the corresponding newly added text main object and stored in the shared memory system. Thus, through the second-stage object reliability review, the reliability and description quality of core objects in the long text are ensured.
[0125] In some implementations, the analysis results indicating failed objects include descriptive feedback data for the corresponding newly added text subject object, and the method further includes steps S707-S711: S707: If the object analysis result fails, use the description feedback data as the description revision instruction for the object agent, perform description information correction on the corresponding initial description information, and obtain the corrected description information; S709: Based on the review agent, the current global summary data and the object description information of the main objects in the historical text are used as the benchmark information to perform description quality analysis on the corrected description information and obtain updated object analysis results. S711: The updated object analysis results indicate that the corrected description information has been approved, and this information is then used as the object description information for the corresponding newly added text subject object.
[0126] Specifically, a template corresponding to the outline revision instruction can be described, and a description revision instruction can be generated based on this template and description feedback data. This allows the object agent to execute object description corrections based on the problem feedback and revision suggestions in the description feedback data, performing partial corrections or a complete rewrite of the initial description information. If the obtained corrected description information meets the quality requirements and passes the review, it is identified as the object description information for the corresponding newly added text subject. Conversely, if the quality is not met, the process reverts to the object agent, further correcting the description information based on the description feedback data in the latest description analysis results. This cycle continues until the corrected description information passes the review and is used as the corresponding object description information. In some cases, a fourth and fifth threshold can be set. If the number of corrections to the initial description information reaches the fourth threshold and still fails the review, the newly added text object is deleted. If the number of corrections exceeds the fifth threshold, an error is reported and relevant personnel are notified.
[0127] Specifically, if the description feedback data indicates that the newly added text subject object needs to be removed, then the object agent will delete the relevant content of the newly added text subject object when performing object description based on the fragment outline data.
[0128] In this way, the review agent specifically evaluates the reliability of new objects based on the second-stage review. For example, in a long story, it can review whether the appearance of a character is necessary, whether the setting is in line with the story background, whether it creates unnecessary conflicts or overlaps with existing characters, and whether the depth of the character description is sufficient. New text objects that fail the review will be removed or modified to ensure the high quality and efficiency of all objects in the text.
[0129] In one example, the instruction text input for instructing the review agent to conduct a second-stage review could be: You are a character design review expert. Your task is to evaluate whether **newly introduced character information** is reliable and reasonable.
[0130] **Current Main Character Profiles:** json {existing_characters} ``` **New characters planned for this chapter:** json {new_characters} ``` **Chapter Scene Summary:** {chapter_plan} **Review Task - Phase Two: Role Information Reliability Check** Please carefully check the following aspects: 1. **Role Necessity**: Is the introduction of the new character necessary? Can an existing character be used as a substitute? 2. **Character Rationality**: Does the new character's design (attributes, personality, motivation) align with the story's background and the current plot requirements? 3. **Character Conflict**: Does the new character conflict with existing characters in terms of settings (e.g., both characters are "the only XX")? 4. **Character Depth**: For new characters marked as `major`, are their descriptions detailed enough to support future development? 5. **Naming Rationality**: Do the character names conform to the world setting (e.g., modern names should not appear in ancient settings)? **Output Format:** Please return a JSON object containing the following fields: json {{ "is_reliable": true / false, "confidence": 0.0-1.0, "character_reviews": [ {{ "character_name": "Character Name", "is_approved": true / false, "issues": [ {{ "type": "Character necessity / Character rationality / Character conflict / Character depth / Naming rationality", "severity": "critical / major / minor", "description": "Detailed problem description", "suggestion": A suggested modification }} ] }} ], "overall_assessment": "Overall evaluation (1-2 sentences)" }} ``` **Judgment Criteria:** - If any new role has a `critical` level issue, `is_reliable` must be `false`. - If more than half of the new roles are not approved (`is_approved: false`), `is_reliable` should be `false`. Now, please begin the review.
[0131] Specifically, after S711, corresponding object configuration data is generated based on the approved object description information, and the planning agent is triggered to revise the fragment outline data. After the updated fragment outline data is approved, the initial configuration data generation and review process is executed again. This cycle continues until all initial description information in the initial configuration data is approved. That is, after both the fragment blueprint data and the object configuration data are approved, the writing agent will intervene, generate the initial text fragment based on the current global summary data and fragment blueprint data, and perform the third stage of writing quality review.
[0132] In summary, by designing a multi-agent architecture based on cognitive hierarchies to simulate the cognitive process of human writing, a key reflection and correction mechanism is introduced. Specifically, a three-stage cascading review and correction mechanism is introduced to simulate the progressively in-depth and interconnected quality control process in human creation, from conception and core object setting to specific writing. This aims to solve the consistency and coherence problems in long text generation and further improve the quality and efficiency of long text generation.
[0133] It should be noted that the technical solution of this application can create high-quality long texts while ensuring rigorous textual logic and factual consistency. It can be widely applied, but is not limited to, the following real-world scenarios: 1. Automated Content Creation: It can be used to automatically generate long texts such as online novels, scripts, and game descriptions. Through a "generate-reflect-revise" cycle, or further combined with a three-stage review mechanism, it ensures that the main storyline is clear, the plot has no logical loopholes, and the characters are consistent, greatly improving the efficiency and quality of content creation.
[0134] 2. Human-AI Collaborative Writing: The framework of this application can also integrate human authors. Human authors can assist the "controlling AI agent" in high-level planning, or provide feedback or correct analysis results in the "reviewing AI agent" stage, working together with AI to complete complex creative tasks.
[0135] 3. Complex Report Generation: This feature can be used to generate long texts requiring high logic and consistency, such as research reports, business analysis reports, and software engineering documents. The system ensures clear report structure, consistent reasoning, and uniform terminology.
[0136] In one embodiment, reference Figure 7Taking a long text as an example of a long story, this paper introduces the three-stage review process for generating each text fragment (chapter) in this application. The main loop for generating each chapter includes: S11, the planning agent generates initial chapter outline data; input: current global summary data, object configuration data (character profile) and narrative instructions, output: structured chapter outline, which can be in JSON format; S12, First Stage Review: Review the consistency of the intelligent agent's execution plan. The dimensions to be checked include, but are not limited to: plot coherence, worldview consistency, timeline rationality, causal relationship, and foreshadowing and echoing. If it passes, proceed to S14; if it fails, proceed to S13. S13, Input the detailed outline feedback data into the planning agent, execute replanning, repeat S11-S12 until approval, and obtain the chapter outline data; S14, The character agent creates or updates object configuration data to create object description information for the new character. Input: new_character_desc (new character information) in the chapter outline data. Output: detailed character profile (object description information). S15, Second Phase Review: Role Reliability Check, the check dimensions include but are not limited to: role necessity, role rationality, role conflict, role depth, naming rationality, etc.; if it passes, proceed to S17, if it fails, proceed to S16; S16, based on the description feedback data, remove or correct the problematic role, triggering a replanning to execute S11; S17, the writing agent generates the initial chapter text. Inputs: chapter outline data, character profiles, and global summary data; it may also include the summary data of the previous chapter. Output: chapter text. S18, Third Stage Review: Writing quality assessment, which may include, but is not limited to: A. Blueprint execution (0-10 points), B. Global consistency (0-10 points), C. Writing quality (0-10 points); If passed, proceed to S20; if failed, proceed to S19. S19, Input the text feedback data into the writing agent, perform chapter correction, and repeat S18; if successful, proceed to S20; if unsuccessful, proceed to S11. S20, Confirm and save chapter: Write the evolution document of the shared memory system, update the global summary data, analyze and update the role profile (object configuration data), and proceed to the next chapter loop.
[0137] The following are embodiments of the apparatus of this application, which can be used to execute embodiments of the method of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method of this application.
[0138] Please refer to Figure 8 The diagram illustrates a block diagram of a long text generation apparatus according to an embodiment of this application, comprising: The summary generation module 10 is used to input the target topic into the master intelligent agent to generate a summary, and obtain architecture outline data and global summary data. The architecture outline data is used to indicate the architecture of the long text and the order of each text segment in the long text. The blueprint generation module 20 is used to generate blueprints based on the collaborative decision-making agent and the current global summary data as context information during the generation of each text segment in the order of segments, so as to obtain the segment blueprint data of the corresponding text segment. The current global summary data of non-first text segments is obtained by updating the global summary data based on the previous text segments. The fragment generation module 30 is used to generate content based on the writing agent, using the current global summary data and the corresponding fragment blueprint data as context information, to obtain the initial text fragment of the corresponding text fragment. The review module 40 is used to perform content quality analysis based on the review agent, using the current global summary data and the corresponding fragment blueprint data as benchmark information, and to obtain the quality analysis results of the corresponding initial text fragment. The determination module 50 is used to determine the initial text fragment indicating that the quality analysis result has passed as the corresponding text fragment of the long text.
[0139] In some embodiments, the quality analysis result indicating failure includes text feedback data of the corresponding initial text segment. The segment generation module 30 is further configured to: if the quality analysis result indicates failure, use the text feedback data as a text revision instruction for the writing agent, perform segment correction on the corresponding initial text segment, and obtain a corrected text segment. The review module 40 is also used to: perform content quality analysis on the corresponding corrected text fragments based on the review agent, using the current global summary data and the corresponding fragment blueprint data as benchmark information, and obtain updated quality analysis results; The determination module 50 is also used to: determine the corrected text fragment indicating that the updated quality analysis result has passed as the corresponding text fragment.
[0140] In some embodiments, the apparatus further includes an iteration module: for repeating the steps of segment correction and content quality analysis if the updated quality analysis result indicates failure, until the corresponding quality analysis result indicates success, thereby obtaining the corresponding text segment; In other embodiments, the blueprint generation module 20 is further configured to, if the updated quality analysis result indicates failure, use the text feedback data carried by the updated quality analysis result as a blueprint revision instruction for the collaborative decision-making agent, and perform blueprint correction on the corresponding fragment blueprint data to obtain updated fragment blueprint data. The iteration module is also used to: repeatedly execute the content generation step and content quality analysis step of the corresponding text fragment based on the updated fragment blueprint data, and obtain the corresponding text fragment if the corresponding quality analysis result indicates that it passes. In some embodiments, the summary generation module 10 is further configured to: After identifying the initial text fragments that have passed the quality analysis as the corresponding text fragments of the long text, the currently generated text fragments are input into the master agent to update the summary content of the current global summary data. The updated global summary data is then used as the context information for the next text fragment generation process.
[0141] In some embodiments, the review module 40 includes: The detection submodule is used to input the current global summary data, fragment blueprint data and initial text fragments into the review agent. Using the current global summary data and fragment blueprint data as the benchmark information, it performs fragment blueprint execution degree detection based on blueprint execution detection instructions, global content consistency detection based on consistency detection instructions, and expression quality detection based on writing quality detection instructions on the initial text fragments, and obtains execution degree results, consistency results and expression quality results respectively. Analysis generation submodule: Used to generate quality analysis results based on execution results, consistency results, and expression quality results.
[0142] In some embodiments, the collaborative decision-making agent includes a planning agent and an object agent, and the blueprint generation module 20 includes: Planning submodule: For each text segment, based on the planning agent, the segment outline is generated using the current global summary data and the object configuration data corresponding to the preceding text segment as context information, to obtain the segment outline data of the corresponding text segment. The object configuration data corresponding to the preceding text segment is obtained by the object agent based on the segment outline data generated by the preceding segment to describe the text object. The object submodule is used to describe text objects based on object agents, using the current global summary data and the fragment outline data of the corresponding text fragment as context information, and to obtain the object configuration data of the corresponding text fragment. The object configuration data of the corresponding text fragment includes the object description information of the text subject objects involved in the previously generated fragment outline data and the currently generated fragment outline data. Blueprint submodule: Used to generate fragment blueprint data for corresponding text fragments based on fragment outline data and corresponding object configuration data.
[0143] In some embodiments, for the first text segment of a long text, the object configuration data corresponding to the preceding text segment is empty, and the current global summary data is the global summary data generated by the main control agent based on the target topic; The detailed outline data of the first text segment is generated using global summary data as contextual information; The object configuration data for the first text fragment includes the object description information of each text subject object corresponding to the first text fragment, generated using global summary data and fragment outline data of the first text fragment as context information.
[0144] In some embodiments, for non-first text segments of a long text, the object configuration data corresponding to the preceding text segments is obtained by updating the object configuration data of the first text segment based on the segment outline data of each preceding non-first text segment; The object configuration data for non-first text segments is obtained by updating the object configuration data of the preceding text segments using the current global summary data and the segment outline data of the corresponding non-first text segments as context information.
[0145] In some embodiments, the planning submodule may be specifically used to: for each text segment, input the current global summary data and the object configuration data corresponding to the preceding text segment into the planning agent to generate a segment outline and obtain initial detailed outline data; The review module 40 can be specifically used to: perform outline quality analysis on the corresponding initial outline data based on the review agent and using the current global summary data as the benchmark information, and obtain the outline analysis results; The planning submodule can be specifically used to: determine the initial outline data indicated by the outline analysis results as the segment outline data of the corresponding text fragments.
[0146] In some embodiments, the outline analysis result indicating failure includes outline feedback data of the corresponding initial outline data. The planning submodule can also be specifically used to: if the outline analysis result indicates failure, use the outline feedback data as the outline revision instruction of the planning agent, perform outline correction on the corresponding initial outline data, and obtain revised outline data. The review module 40 can also be specifically used to: based on the review agent, perform outline quality analysis on the corresponding revised outline data using the current global summary data as the benchmark information, and obtain updated outline analysis results; The planning submodule can be specifically used to: determine the revised outline data indicated by the updated outline analysis results as the fragment outline data of the corresponding text segment.
[0147] In some embodiments, the object submodule can be specifically used to: for each text segment, input the current global summary data and the segment outline data of the corresponding text segment into the object agent to describe the text object, and obtain initial configuration data. The initial configuration data includes the object description information of the historical text subject object corresponding to the previous text segment and the initial description information of the newly added text subject object in the segment outline data of the corresponding text segment. The review module 40 can be specifically used to: based on the review agent, use the current global summary data and the object description information of the historical text subject objects as benchmark information to perform description quality analysis on the initial description information of the newly added text subject objects, and obtain the object analysis results of each initial description information; The object submodule can be specifically used to: determine the object description information of the corresponding newly added text subject object based on the initial description information indicated by the object analysis results.
[0148] In some embodiments, the object analysis result indicating failure includes the description feedback data of the corresponding newly added text subject object. The object submodule can also be specifically used to: if the object analysis result fails, use the description feedback data as the description revision instruction of the object agent, perform description information correction on the corresponding initial description information, and obtain the corrected description information. The review module 40 can also be specifically used to: based on the review agent, use the current global summary data and the object description information of the main objects in the historical text as benchmark information to perform description quality analysis on the corrected description information and obtain updated object analysis results; The object submodule can be specifically used to: determine the corrected description information indicated by the updated object analysis results as the object description information of the corresponding newly added text subject object.
[0149] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0150] Please refer to Figure 9 This diagram illustrates a structural block diagram of a computer device provided in one embodiment of this application, used to perform the aforementioned long text generation method. The computer device may be a server. Specifically: Computer device 1400 includes a central processing unit (CPU) 1401, a system memory 1404 including random access memory (RAM) 1402 and read-only memory (ROM) 1403, and a system bus 1405 connecting the system memory 1404 and the CPU 1401. Computer device 1400 also includes a basic input / output system (I / O system) 1406 that facilitates information transfer between various devices within the computer, and a mass storage device 1407 for storing the operating system 1413, application programs 1414, and other program modules 1415.
[0151] The basic input / output system 1406 includes a display 1408 for displaying information and an input device 1409 for user input, such as a mouse or keyboard. Both the display 1408 and the input device 1409 are connected to the central processing unit 1401 via an input / output controller 1410 connected to the system bus 1405. The basic input / output system 1406 may also include the input / output controller 1410 for receiving and processing input from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 1410 also provides output to a display screen, printer, or other types of output devices.
[0152] Mass storage device 1407 is connected to central processing unit 1401 via a mass storage controller (not shown) connected to system bus 1405. Mass storage device 1407 and its associated computer-readable media provide non-volatile storage for computer device 1400. That is, mass storage device 1407 may include computer-readable media (not shown) such as hard disk or CD-ROM (Compact Disc Read-Only Memory) drive.
[0153] Without loss of generality, computer-readable media can include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes RAM, ROM, EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory or other solid-state storage technologies, CD-ROM, DVD (Digital Video Disc) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that computer storage media are not limited to the above-mentioned types. The system memory 1404 and mass storage device 1407 described above can be collectively referred to as memory.
[0154] According to various embodiments of this application, the computer device 1400 can also be connected to a remote computer on a network, such as the Internet. That is, the computer device 1400 can be connected to the network 1412 via the network interface unit 1411 connected to the system bus 1405, or the network interface unit 1411 can be used to connect to other types of networks or remote computer systems (not shown).
[0155] Figure 10 This is a block diagram of an electronic device according to an exemplary embodiment. The electronic device may be a terminal for executing the long text generation method described above, and its internal structure diagram may be as follows. Figure 10 As shown, the device may include an RF (Radio Frequency) circuit 1510, a memory 1520 including one or more computer-readable storage media, an input unit 1530, a display unit 1540, a sensor 1550, an audio circuit 1560, a WiFi (Wireless Fidelity) module 1570, a processor 1580 including one or more processing cores, and a power supply 1590, among other components. Those skilled in the art will understand that... Figure 10 The terminal structure shown does not constitute a limitation on the terminal and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: RF circuit 1510 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and hands it over to one or more processors 1580 for processing; additionally, it transmits uplink data to the base station. Typically, RF circuit 1510 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, etc. Furthermore, RF circuit 1510 can also communicate wirelessly with networks and other terminals. Wireless communication can use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), etc.
[0156] The memory 1520 can be used to store software programs and modules. The processor 1580 executes various functional applications and data processing by running the software programs and modules stored in the memory 1520. The memory 1520 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for the functions, etc.; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 1520 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 1520 may also include a memory controller to provide access to the memory 1520 for the processor 1580 and the input unit 1530.
[0157] Input unit 1530 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. Specifically, input unit 1530 may include touch-sensitive surface 1531 and other input devices 1532. Touch-sensitive surface 1531, also known as a touch display screen or touchpad, can collect user touch operations on or near it (such as user operations using fingers, styluses, or any suitable object or accessory on or near touch-sensitive surface 1531), and drive corresponding connection devices according to a pre-set program. Optionally, touch-sensitive surface 1531 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to processor 1580, and can receive and execute commands from processor 1580. In addition, the touch-sensitive surface 1531 can be implemented using various methods such as resistive, capacitive, infrared, and surface acoustic wave. Besides the touch-sensitive surface 1531, the input unit 1530 may also include other input devices 1532. Specifically, other input devices 1532 may include, but are not limited to, one or more of the following: a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick. The display unit 1540 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the terminal. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. The display unit 1540 may include a display panel 1541, which may optionally be configured as an LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or similar display panel 1541. Further, a touch-sensitive surface 1531 may cover the display panel 1541. When the touch-sensitive surface 1531 detects a touch operation on or near it, it transmits the information to the processor 1580 to determine the type of touch event. Subsequently, the processor 1580 provides corresponding visual output on the display panel 1541 according to the type of touch event. The touch-sensitive surface 1531 and the display panel 1541 can be two independent components to implement input and output functions. However, in some embodiments, the touch-sensitive surface 1531 and the display panel 1541 can be integrated to achieve both input and output functions.
[0158] The terminal may also include at least one sensor 1550, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1541 according to the ambient light level, and the proximity sensor can turn off the display panel 1541 and / or the backlight when the terminal is moved to the ear. As a type of motion sensor, a gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that identify the terminal's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, tapping), etc. Other sensors that may be configured on the terminal, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0159] Audio circuitry 1560, speaker 1561, and microphone 1562 provide an audio interface between the user and the terminal. Audio circuitry 1560 converts received audio data into electrical signals, which are then transmitted to speaker 1561, where they are converted into sound signals for output. Conversely, microphone 1562 converts collected sound signals into electrical signals, which are received by audio circuitry 1560, converted back into audio data, and then processed by processor 1580 before being transmitted via RF circuitry 1510 to, for example, another terminal, or output to memory 1520 for further processing. Audio circuitry 1560 may also include an earphone jack to facilitate communication between a peripheral headset and the terminal.
[0160] WiFi is a short-range wireless transmission technology. This terminal, through the WiFi module 1570, can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 10 WiFi module 1570 is shown, but it is understood that it is not an essential component of the terminal and can be omitted as needed without changing the nature of the invention.
[0161] The processor 1580 is the control center of the terminal, connecting various parts of the terminal through various interfaces and lines. It executes software programs and / or modules stored in the memory 1520, and calls data stored in the memory 1520 to perform various functions and process data, thereby performing overall detection of the terminal. Optionally, the processor 1580 may include one or more processing cores; preferably, the processor 1580 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interaction area, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1580.
[0162] The terminal also includes a power supply 1590 (such as a battery) to power various components. Preferably, the power supply can be logically connected to the processor 1580 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 1590 may also include one or more DC or AC power supplies, a recharging system, a power fault detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0163] Although not shown, the terminal may also include a camera, Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the display unit of the terminal is a touch screen display, and the terminal also includes a memory and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors of the instructions in the method embodiment of the present invention.
[0164] The aforementioned memory also includes a computer program stored in the memory and configured to be executed by one or more processors to implement the aforementioned long text generation method.
[0165] In an exemplary embodiment, a computer-readable storage medium is also provided, wherein at least one instruction is stored in the storage medium, and the at least one instruction, the at least one program segment, the code set, or the instruction set is executed by a processor to implement the long text generation method.
[0166] Optionally, the computer-readable storage medium may include: ROM (Read Only Memory), RAM (Random Access Memory), SSD (Solid State Drives), or optical disc, etc. The random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0167] In an exemplary embodiment, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the long text generation method described above.
[0168] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.
[0169] In addition, in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0170] The above are merely exemplary embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application shall be included within the protection scope of this application.
Claims
1. A method for generating long text, characterized in that, The method includes: The target topic is input into the master control agent to generate a summary, resulting in architecture outline data and global summary data. The architecture outline data is used to indicate the architecture of the long text and the order of each text segment in the long text. During the generation of each text segment in the order of the segments, a blueprint is generated based on the collaborative decision-making agent using the current global summary data as context information to obtain the segment blueprint data of the corresponding text segment. The current global summary data of non-first text segments is obtained by updating the global summary data based on the preceding text segments. Based on the writing agent, the current global summary data and the corresponding fragment blueprint data are used as context information to generate content and obtain the initial text fragment of the corresponding text fragment. Based on the review agent, the current global summary data and the corresponding fragment blueprint data are used as benchmark information to perform content quality analysis and obtain the quality analysis results of the corresponding initial text fragments. The initial text segment indicated by the quality analysis results is identified as the corresponding text segment of the long text.
2. The method according to claim 1, characterized in that, The quality analysis results indicating failure include text feedback data for the corresponding initial text fragment, and the method further includes: If the quality analysis result indicates failure, the text feedback data is used as the text revision instruction for the writing agent to perform segment correction on the corresponding initial text segment, thereby obtaining the corrected text segment. Based on the review agent, the current global summary data and the corresponding fragment blueprint data are used as benchmark information to perform content quality analysis on the corresponding corrected text fragments, and the updated quality analysis results are obtained. The corrected text fragments indicated by the updated quality analysis results are identified as the corresponding text fragments.
3. The method according to claim 2, characterized in that, The method further includes: If the updated quality analysis result indicates failure, repeat the steps of segment correction and content quality analysis until the corresponding quality analysis result indicates success, and obtain the corresponding text segment. or, If the updated quality analysis result indicates failure, the text feedback data carried by the updated quality analysis result is used as the blueprint revision instruction of the collaborative decision-making agent to correct the corresponding fragment blueprint data and obtain updated fragment blueprint data. Based on the updated fragment blueprint data, the content generation and content quality analysis steps for the corresponding text fragments are repeated, and the corresponding text fragments are obtained when the corresponding quality analysis results indicate that they have passed.
4. The method according to claim 1, characterized in that, After determining the initial text segment indicating the quality analysis result as the corresponding text segment of the long text, the method further includes: The currently generated text fragment is input into the main control agent to update the summary content of the current global summary data, and the updated global summary data is used as the context information for the next text fragment generation process.
5. The method according to claim 1, characterized in that, The content quality analysis based on the review agent, using the current global summary data and corresponding fragment blueprint data as benchmark information, yields the following quality analysis results for the corresponding initial text fragments: The current global summary data, the fragment blueprint data, and the initial text fragment are input into the review agent. Using the current global summary data and the fragment blueprint data as reference information, the initial text fragment is subjected to fragment blueprint execution degree detection based on blueprint execution detection instructions, global content consistency detection based on consistency detection instructions, and expression quality detection based on writing quality detection instructions, respectively, to obtain execution degree results, consistency results, and expression quality results. The quality analysis results are generated based on the execution results, the consistency results, and the expression quality results.
6. The method according to any one of claims 1-5, characterized in that, The collaborative decision-making agent includes a planning agent and an object agent. The blueprint generation based on the collaborative decision-making agent, using the current global summary data as context information, to obtain fragment blueprint data for the corresponding text segments includes: For each text segment, based on the planning agent, a segment outline is generated using the current global summary data and the object configuration data corresponding to the preceding text segment as context information, to obtain the segment outline data of the corresponding text segment. The object configuration data corresponding to the preceding text segment is obtained by the object agent based on the segment outline data generated in the preceding segment to describe the text object. Based on the object agent, the text object is described using the current global summary data and the fragment outline data of the corresponding text fragment as context information, and the object configuration data of the corresponding text fragment is obtained. The object configuration data of the corresponding text fragment includes the object description information of the text subject object involved in the previously generated fragment outline data and the currently generated fragment outline data. Based on the fragment outline data and the corresponding object configuration data, fragment blueprint data for the corresponding text fragments is generated.
7. The method according to claim 6, characterized in that, For the first text segment of the long text, the object configuration data corresponding to the preceding text segment is empty, and the current global summary data is the global summary data generated by the main control agent based on the target topic; The detailed outline data of the first text segment is generated using the global summary data as contextual information; The object configuration data of the first text segment includes the object description information of each text subject object corresponding to the first text segment, and is generated using the global summary data and the segment outline data of the first text segment as context information.
8. The method according to claim 6, characterized in that, For the non-first text segments of the long text, the object configuration data corresponding to the preceding text segments is obtained by updating the object configuration data of the first text segment based on the segment outline data of each preceding non-first text segment; The object configuration data for the non-first text segment is obtained by updating the object configuration data corresponding to the preceding text segment using the current global summary data and the segment outline data of the corresponding non-first text segment as context information.
9. The method according to claim 6, characterized in that, For each text segment, based on the planning agent, a segment outline is generated using the current global summary data and the object configuration data corresponding to the preceding text segment as context information. The resulting detailed segment outline data includes: For each text segment, the current global summary data and the object configuration data corresponding to the previous text segment are input into the planning agent to generate a segment outline and obtain initial detailed outline data; Based on the review agent, the current global summary data is used as the benchmark information to perform outline quality analysis on the corresponding initial outline data, and the outline analysis results are obtained. The initial outline data indicated by the outline analysis results is determined as the segment outline data of the corresponding text segment.
10. The method according to claim 9, characterized in that, The method further includes: outline analysis results indicating failure to pass, which include outline feedback data corresponding to the initial detailed outline data; and the method also includes: If the outline analysis result indicates that it is not approved, the outline feedback data is used as the outline revision instruction of the planning agent, and the corresponding initial outline data is modified to obtain the revised outline data. Based on the review agent, the current global summary data is used as the benchmark information to perform outline quality analysis on the corresponding revised outline data, and the updated outline analysis results are obtained. The updated outline analysis results indicate that the corrected outline data is determined as the fragment outline data of the corresponding text segment.
11. The method according to claim 6, characterized in that, The process of describing the text object based on the object agent, using the current global summary data and the fragment outline data of the corresponding text fragment as context information, and obtaining the object configuration data of the corresponding text fragment includes: For each text segment, the current global summary data and the segment outline data of the corresponding text segment are input into the object agent to describe the text object and obtain initial configuration data. The initial configuration data includes the object description information of the historical text subject object corresponding to the previous text segment and the initial description information of the newly added text subject object in the segment outline data of the corresponding text segment. Based on the review agent, the description quality analysis of the initial description information of the newly added text subject object is performed using the current global summary data and the object description information of the historical text subject object as benchmark information, so as to obtain the object analysis results of each initial description information. The initial description information indicated by the object analysis results is determined as the object description information of the corresponding newly added text subject object.
12. The method according to claim 11, characterized in that, The analysis results for objects that fail to pass include descriptive feedback data for the corresponding newly added text subject objects. The method also includes: If the object analysis result fails, the description feedback data is used as the description revision instruction for the object agent, and the description information is corrected on the corresponding initial description information to obtain the corrected description information. Based on the review agent, the current global summary data and the object description information of the historical text main object are used as benchmark information to perform description quality analysis on the corrected description information, and the updated object analysis results are obtained. The updated object analysis results indicate that the corrected description information is used as the object description information for the corresponding newly added text subject object.
13. A long text generation device, characterized in that, The device includes: The summary generation module is used to input the target topic into the master intelligent agent to generate a summary, and obtain architecture outline data and global summary data. The architecture outline data is used to indicate the architecture of the long text and the order of each text segment in the long text. The blueprint generation module is used to generate blueprints based on the collaborative decision-making agent and the current global summary data as context information during the generation of each text segment in the order of the segments, so as to obtain the segment blueprint data of the corresponding text segment. The current global summary data of non-first text segments is obtained by updating the global summary data based on the preceding text segments. The fragment generation module is used to generate content based on the writing agent, using the current global summary data and the corresponding fragment blueprint data as context information, to obtain the initial text fragment of the corresponding text fragment. The review module is used to perform content quality analysis based on the review agent, using the current global summary data and the corresponding fragment blueprint data as benchmark information, to obtain the quality analysis results of the corresponding initial text fragment. The determination module is used to determine the initial text fragment indicating that the quality analysis result has passed as the corresponding text fragment of the long text.
14. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to implement the method as claimed in any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, which is loaded and executed by a processor to implement the method as described in any one of claims 1 to 12.