Methods, apparatus, devices, and readable storage media for generating structured long text

By generating text outlines and prompt words, and utilizing a large language model to generate structured long text, the problem of insufficient accuracy in existing technologies is solved, and higher generation accuracy is achieved.

CN123115228APending Publication Date: 2026-11-17中国移动通信集团江西有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611018055.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-09
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

The structured long text generated by existing technologies has low accuracy and fails to meet users' structural needs for structured long text.

Method used

By receiving heterogeneous data sent by the user, a text outline is generated, and prompt words are composed based on the outline and data. The text is then input into a large language model to generate text, ensuring that the generated structured long text meets the user's needs.

Benefits of technology

It improves the accuracy of the generated structured long text, meeting users' structural requirements for structured long text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123115228A_ABST
    Figure CN123115228A_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and readable storage medium for generating structured long text. In the field of artificial intelligence technology, the technical solution of this application receives first heterogeneous data sent by a user terminal for generating structured long text, thereby generating a first text outline of the structured long text based on the first heterogeneous data, and forming a first prompt word based on the first heterogeneous data and the first text outline. The first prompt word generated thereby can more accurately reflect the user's structural needs for the structured long text itself. Therefore, the first structured long text generated by the large language model is more in line with the user's needs, thereby improving the accuracy of the generated structured long text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, specifically to a method, apparatus, device, and readable storage medium for generating structured long text. Background Technology

[0002] Structured long text refers to longer text content with a clear organizational format, hierarchical structure, and semantic tags, such as technical documents and contracts. In related technologies, structured long text is generally generated using large language models such as ChatGPT and Claude. However, this generation method only analyzes the user's input data and does not consider the user's structural requirements for the long text itself, thus resulting in low accuracy of the generated structured long text. Summary of the Invention

[0003] This application provides a method, apparatus, device, and readable storage medium for generating structured long text, which solves the problem of low accuracy of structured long text generated in related technologies.

[0004] In a first aspect, embodiments of this application provide a method for generating structured long text, the method comprising:

[0005] Receive the first heterogeneous data sent by the user client to generate structured long text;

[0006] A first text outline is generated based on the first heterogeneous data. The first text outline is used to represent the hierarchical structure and related information of the structured long text. The related information includes the relationship between the chapters included in the structured long text.

[0007] Based on the first heterogeneous data and the first text outline, the first prompt word is formed;

[0008] The first heterogeneous data and the first prompt word are input into a large language model to generate text, resulting in a first structured long text, which is then transmitted to the user terminal.

[0009] Optionally, generating the first text outline based on the first heterogeneous data includes:

[0010] Text extraction is performed on the first heterogeneous data to obtain the target text;

[0011] At least one question is generated based on the target text. The question is a question used to inquire about the structural requirements, audience requirements, and / or type requirements of the structured long text.

[0012] The at least one question message is transmitted to the user terminal, and at least one reply message corresponding to the at least one question message is received from the user terminal;

[0013] Based on the first heterogeneous data and the at least one response information, a first text outline is generated.

[0014] Optionally, the step of composing the first prompt word based on the first heterogeneous data and the first text outline includes:

[0015] Information is extracted from the first text outline to obtain key information, which includes the constraints and setting information of the structured long text. The setting information is used to represent the global setting content of the structured long text.

[0016] First tag data is generated based on the first text, second tag data is generated based on the outline of the first text, and third tag data is generated based on the key information. The first text data is the structured long text that has been generated based on the first heterogeneous data.

[0017] The first tag data, the second tag data, and the third tag data are concatenated to form the first prompt word.

[0018] Optionally, the step of inputting the first heterogeneous data and the first prompt word into a large language model for text generation to obtain the first structured long text includes:

[0019] The first heterogeneous data and the first prompt word are input into a large language model to generate text, thereby obtaining initial text. The initial text includes at least one structured chart placeholder, and the at least one structured chart placeholder corresponds one-to-one with at least one image information.

[0020] The initial text is subjected to factual verification, logical verification, and instruction compliance verification to obtain the verification results;

[0021] If the verification result indicates that the initial text has passed the factual verification, the logical verification, and the instruction compliance verification, the at least one image information is input into the chart generation model to generate a chart, thereby obtaining at least one chart that corresponds one-to-one with the at least one structured chart placeholder.

[0022] The first structured long text is obtained by replacing the structured chart placeholder in the initial text with the chart corresponding to the structured chart placeholder.

[0023] Optionally, replacing the structured chart placeholders in the initial text with the charts corresponding to the structured chart placeholders to obtain the first structured long text includes:

[0024] Upon receiving an outline update request from the user, a second text outline is obtained based on the outline update request, which is used to update the first text outline to the second text outline.

[0025] Calculate the difference value between the first text outline and the second text outline, the difference value being used to represent the degree of impact of updating the first text outline to the second text outline on the initial text;

[0026] The initial text is updated based on the difference value to obtain the target text;

[0027] The first structured long text is obtained by replacing the structured chart placeholder in the target text with the chart corresponding to the structured chart placeholder.

[0028] Optionally, after inputting the first heterogeneous data and the first prompt word into a large language model for text generation to obtain the structured long text, and transmitting the structured long text to the user terminal, the method further includes:

[0029] Every preset period, the first heterogeneous data stored on the user terminal is detected to obtain the detection result;

[0030] If the detection result indicates that the first heterogeneous data stored on the user terminal has been updated to the second heterogeneous data, a third text outline is generated based on the second heterogeneous data;

[0031] Based on the second heterogeneous data and the third text outline, a second prompt word is formed;

[0032] The second heterogeneous data and the second prompt word are input into the large language model to generate text, resulting in a second structured long text. The second structured long text is then transmitted to the user terminal so that the user terminal updates the first structured long text to the second structured long text.

[0033] Secondly, embodiments of this application provide a structured long text generation apparatus, the apparatus comprising:

[0034] The receiving module is used to receive the first heterogeneous data sent by the user terminal for generating structured long text;

[0035] The first generation module is used to generate a first text outline based on the first heterogeneous data. The first text outline is used to represent the hierarchical structure and association information of the structured long text. The association information includes the association relationship between the chapters included in the structured long text.

[0036] The second generation module is used to generate the first prompt word based on the first heterogeneous data and the first text outline;

[0037] The transmission module is used to input the first heterogeneous data and the first prompt word into a large language model to generate text, obtain a first structured long text, and transmit the first structured long text to the user terminal.

[0038] Thirdly, this application also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method described in the first aspect above.

[0039] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described in the first aspect above.

[0040] Fifthly, this application also provides a computer program product, including computer instructions that, when executed by a processor, implement the steps of the method described in the first aspect above.

[0041] This application discloses a method, apparatus, device, and readable storage medium for generating structured long text, belonging to the field of artificial intelligence technology, and applied to the server side. The method includes: receiving first heterogeneous data sent by a user terminal for generating structured long text; generating a first text outline based on the first heterogeneous data, wherein the first text outline is used to represent the hierarchical structure relationship and association information of the structured long text, and the association information includes the association relationship between the chapters included in the structured long text; forming a first prompt word based on the first heterogeneous data and the first text outline; inputting the first heterogeneous data and the first prompt word into a large language model for text generation to obtain a first structured long text, and transmitting the first structured long text to the user terminal. The technical solution of this application receives first heterogeneous data sent by the user terminal for generating structured long text, thereby generating a first text outline of the structured long text based on the first heterogeneous data, and forming a first prompt word based on the first heterogeneous data and the first text outline. The first prompt word generated in this way can more accurately reflect the user's structural needs for the structured long text itself. Therefore, the first structured long text generated by the large language model is more in line with the user's needs, thereby improving the accuracy of the generated structured long text. Attached Figure Description

[0042] Figure 1 A flowchart illustrating a method for generating structured long text provided in an embodiment of this application;

[0043] Figure 2 A schematic diagram illustrating the generation of prompt words provided in an embodiment of this application;

[0044] Figure 3 A flowchart illustrating the modification outline provided for embodiments of this application;

[0045] Figure 4 This is a schematic diagram of the system architecture provided for an embodiment of this application;

[0046] Figure 5 This is a schematic diagram of the core method flow provided in the embodiments of this application;

[0047] Figure 6 A schematic diagram of a structured long text generation device provided in an embodiment of this application;

[0048] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0049] 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, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0050] The terms "first," "second," etc., used in the embodiments of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. 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 device 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. Additionally, the use of "and / or" in this application indicates at least one of the connected objects, such as A and / or B and / or C, representing seven possibilities: including A alone, B alone, C alone, and the presence of both A and B, both B and C, both A and C, and the presence of A, B, and C.

[0051] See Figure 1 This application provides a method for generating structured long text, applied on a server-side, the method comprising:

[0052] Step 101: Receive the first heterogeneous data sent by the user terminal for generating structured long text.

[0053] In this embodiment, the server deploys a pre-trained Large Language Model (LLM). A Large Language Model refers to a deep learning model trained using a large amount of text data, enabling the model to generate natural language text or understand the meaning of language text. The Large Language Model used in this embodiment can be a general-purpose large model such as ChatGPT or Claude.

[0054] Structured long text refers to longer text content with a clear organizational format, hierarchical structure, and semantic tags, such as technical documents, contracts, and papers. Because structured long text has strict formatting requirements, the data provided by the user is also more demanding when generating it. In this embodiment, the data provided by the user for generating structured long text is first heterogeneous data, which may include text data, tabular data, audio, video, etc.

[0055] Step 102: Generate a first text outline based on the first heterogeneous data. The first text outline is used to represent the hierarchical structure and related information of the structured long text. The related information includes the relationship between the chapters included in the structured long text.

[0056] In this embodiment, after receiving the first heterogeneous data sent by the user terminal, a first text outline is generated based on the first heterogeneous data. The first text outline is used to represent the hierarchical structure of the structured long text, such as a JSON-formatted structured outline including hierarchical relationships (chapter, section, subsection), and the first text outline is used as the initial global constraint condition.

[0057] Specifically, the first text outline is continuously updated for different chapters. For example, for the first chapter, the first text outline can be in the format of "The first chapter includes X sections, each section includes Y subsections, and the first chapter is a complete chapter, summarizing the content of subsequent chapters, and including the text content that needs to be generated for the first chapter." When the second chapter needs to be generated later, the first text outline is adaptively adjusted based on the content already generated in the first chapter. For example, "The second chapter includes A sections, each section includes B subsections, the second chapter is a subdivided chapter, providing further analysis of the first chapter, and including the text content that needs to be generated for the second chapter." It should be noted that the first text outline is also used to indicate the relationships between different chapters, thereby determining the relationship between each chapter and other chapters.

[0058] After obtaining the first text outline, it needs to be converted into JSON format to facilitate the generation of prompt words.

[0059] Step 103: Based on the first heterogeneous data and the first text outline, form the first prompt word.

[0060] In this embodiment, after obtaining the first heterogeneous data and the first text outline, a first prompt word corresponding to the large language model is generated. The prompt word is an instruction or input content given to the large language model (such as ChatGPT). The large language model will perform corresponding processing based on the prompt word. The prompt word usually includes roles, formats, tasks, context, background, etc.

[0061] Step 104: Input the first heterogeneous data and the first prompt word into the large language model to generate text, obtain the first structured long text, and transmit the first structured long text to the user terminal.

[0062] In this embodiment, the first heterogeneous data and the first prompt word are simultaneously input into the large language model to generate text, and the complete first structured long text is output. At this time, the first structured long text can better reflect the user's demand for structured long text information and is more in line with the user's demand format. Thus, the generated first structured long text is transmitted to the user terminal.

[0063] In addition, after outputting the first structured long text in this embodiment, the user's personalized writing features (such as average sentence length changes and specific professional term replacement preferences) can be extracted, thereby optimizing and updating the first structured long text.

[0064] It should be noted that after each generation of the first structured long text, a unique genealogical information is recorded for each generated paragraph in a hidden log file (such as .project_log.json) in the project root directory. The recorded metadata fields strictly include: generation timestamp, current chapter ID, the Prompt snapshot used (Hash value), the cited reference sources (specific to filename and page number / URL), model version number, and the review approval status and score.

[0065] The technical solution of this application receives first heterogeneous data sent by the user terminal for generating structured long text, thereby generating a first text outline of the structured long text based on the first heterogeneous data, and forming a first prompt word based on the first heterogeneous data and the first text outline. The first prompt word generated in this way can more accurately reflect the user's structural needs for the structured long text itself. Therefore, the first structured long text generated by the large language model is more in line with the user's needs, thereby improving the accuracy of the generated structured long text.

[0066] In some feasible implementations, optionally, generating the first text outline based on the first heterogeneous data includes:

[0067] Text extraction is performed on the first heterogeneous data to obtain the target text;

[0068] At least one question is generated based on the target text. The question is a question used to inquire about the structural requirements, audience requirements, and / or type requirements of the structured long text.

[0069] The at least one question message is transmitted to the user terminal, and at least one reply message corresponding to the at least one question message is received from the user terminal;

[0070] Based on the first heterogeneous data and the at least one response information, a first text outline is generated.

[0071] In this embodiment, after receiving the first heterogeneous data sent by the user terminal, the plain text of the first heterogeneous data is extracted and vectorized and indexed, and a project reference knowledge base is established, thereby obtaining the target text in plain text format.

[0072] After generating the target text, at least one question is generated based on it. This question inquires about the structural requirements, audience needs, and / or genre requirements of the structured long text, thus supplementing the first heterogeneous data. Specifically, the server does not directly output the final outline but instead acts as a co-pilot in brainstorming mode. After analyzing the user's initial instructions, the system proactively asks clarifying questions, such as, "Does Chapter 3 need to include a competitor comparison?" and "Is the core audience technical personnel or executives?" It also provides multiple outline branch options for the user to choose from.

[0073] After receiving at least one question, the user can answer the question according to the actual situation and generate at least one reply corresponding to the question. The reply can be something like "Chapter 3 needs to be supplemented with a competitor comparison" or "The core audience is technical personnel".

[0074] Thus, after multiple rounds of dialogue and divergence, the system, based on the user's final confirmation, converges to generate a JSON-formatted structured outline containing hierarchical relationships (chapter, section, subsection), and uses it as the initial global constraint condition to finally generate the first text outline.

[0075] This embodiment perfectly maps text logic to visual planning by outputting high-quality Prompt placeholders, ensuring a close correspondence between text and images while giving users the flexibility to freely choose image-generating tools later.

[0076] Optionally, the step of composing the first prompt word based on the first heterogeneous data and the first text outline includes:

[0077] Information is extracted from the first text outline to obtain key information, which includes the constraints and setting information of the structured long text. The setting information is used to represent the global setting content of the structured long text.

[0078] First tag data is generated based on the first text, second tag data is generated based on the outline of the first text, and third tag data is generated based on the key information. The first text data is the structured long text that has been generated based on the first heterogeneous data.

[0079] The first tag data, the second tag data, and the third tag data are concatenated to form the first prompt word.

[0080] In this embodiment, after obtaining the first text outline, information can be extracted from the first text outline to obtain key information. Specifically, key information that absolutely cannot be missed (such as global settings, foreshadowing in the previous text, and hard constraints) is extracted from the first text outline to form the core file.

[0081] The server directly reads the existing official document from the local disk and extracts the complete, uncompressed original text from Chapter 1 to Chapter N-1 as the first text. This completely abandons the traditional "summary compression" mechanism and avoids the loss of details.

[0082] Specifically, a first tag is generated based on the first text, a second tag is generated based on the outline of the first text, and a third tag is generated based on key information. These three tag data are then concatenated to obtain the first prompt word. In this embodiment, the prompt word is a sandwich prompt word. To overcome the "middle forgetting effect" when large models process long texts, the system employs a specific XML tag isolation and sequential arrangement strategy to assemble the Prompt: top-level injection.<Core_Anchors> (Core anchor point), mid-layer injection<Full_Previous_Text> (Full text snapshot) and<Reference_Materials> Low-level injection<Current_Task> (Outline requirements for the current Chapter N). Specifically, the first tag data provided in this embodiment corresponds to the full previous snapshot and is placed in the second layer of the sandwich prompt; the second tag data corresponds to the outline requirements for the current Chapter N and is placed in the third layer of the sandwich prompt; the third tag data corresponds to the core anchor point and is placed in the first layer of the sandwich prompt.

[0083] like Figure 2 As shown, Figure 2 This diagram illustrates the generation of prompts in this embodiment, showing the conversion process from unstructured data to structured instructions. The input sources on the left are distributed and, after passing through a sandwich assembler, are strictly encapsulated within XML tags (forming a high-weighted attention distribution). The output of the large model on the right is designed as a "demultiplexer," splitting a single Prompt request into two parallel output streams: one is plain text, and the other is a JSON-formatted chart placeholder containing three metadata fields.

[0084] This embodiment ensures that the logic of the entire original text is rigorous and seamlessly connected before and after each generation by injecting the full original text before each generation and forcibly waking up the core anchor point at the top level of the Prompt.

[0085] Optionally, the step of inputting the first heterogeneous data and the first prompt word into a large language model for text generation to obtain the first structured long text includes:

[0086] The first heterogeneous data and the first prompt word are input into a large language model to generate text, thereby obtaining initial text. The initial text includes at least one structured chart placeholder, and the at least one structured chart placeholder corresponds one-to-one with at least one image information.

[0087] The initial text is subjected to factual verification, logical verification, and instruction compliance verification to obtain the verification results;

[0088] If the verification result indicates that the initial text has passed the factual verification, the logical verification, and the instruction compliance verification, the at least one image information is input into the chart generation model to generate a chart, thereby obtaining at least one chart that corresponds one-to-one with the at least one structured chart placeholder.

[0089] The first structured long text is obtained by replacing the structured chart placeholder in the initial text with the chart corresponding to the structured chart placeholder.

[0090] In this embodiment, during the generation of the first structured long text, the first heterogeneous data and the first prompt words are first input into the large language model for text generation, resulting in an initial text representation. This initial text includes at least one structured chart placeholder, with each placeholder corresponding to at least one image. That is, while the large model generates the main text, the background performs chart intent recognition in parallel. When the current text is detected to involve complex processes, architectural layers, or data comparisons, the system automatically generates a structured chart placeholder (FigureBlock) at the suggested image insertion location. This placeholder does not contain a black-box entity image but contains the following machine-readable and human-readable metadata: Chart type determination: automatically mapped to flowcharts, architecture diagrams, comparison diagrams, etc., and provides the determination reason and confidence level. Core content planning: extracting key nodes from the text and planning the chart's regional layout (e.g., left-side pain points, middle engine, right-side effects). AI-generated image prompt words: automatically generating accurate prompt words to drive downstream text-to-image models (e.g., Midjourney / StableDiffusion), including positive prompt words, negative prompt words, and parameter suggestions.

[0091] After obtaining the initial text, factual verification, logical verification, and instruction compliance verification are performed on the initial text to obtain the verification results. Factual verification includes extracting key claims from the initial draft and cross-referencing them with the project's reference knowledge base; claims without supporting evidence are deemed misleading. Logical verification includes checking whether the initial draft contains logical contradictions with core anchor points or the entire preceding text. Instruction compliance verification verifies whether the initial draft meets word count limits and formatting specifications. If chart placeholders are generated, the AI-generated image prompts from the placeholders are extracted and cross-referenced with the main text of the current paragraph. Special attention is paid to verifying whether the key indicators or core modules to be highlighted in the prompts actually exist in the main text, preventing chart prompts from creating the illusion of being detached from the text (e.g., if the main text describes three modules, but the prompts only plan two, it is considered inconsistent). Finally, a comprehensive score is calculated. If any verification (including consistency between text and images) fails the threshold, the system outputs a FAIL signal and specific modification suggestions (in JSON format), and automatically rolls back to regeneration with the suggestions (with a maximum number of retries K set); if it passes, it outputs a PASS signal.

[0092] If the verification results indicate that the initial text has passed factual verification, logical verification, and instruction compliance verification, a chart generation model is used to generate at least one chart corresponding to at least one structured chart placeholder. The structured chart placeholders in the initial text are then replaced with the charts corresponding to the structured chart placeholders to obtain the first structured long text.

[0093] This embodiment ensures that only content that passes the consistency check of facts, logic, and graphics can be written into the file, making it particularly suitable for academic, patent, and legal document writing where accuracy is extremely important.

[0094] Optionally, replacing the structured chart placeholders in the initial text with the charts corresponding to the structured chart placeholders to obtain the first structured long text includes:

[0095] Upon receiving an outline update request from the user, a second text outline is obtained based on the outline update request, which is used to update the first text outline to the second text outline.

[0096] Calculate the difference value between the first text outline and the second text outline, the difference value being used to represent the degree of impact of updating the first text outline to the second text outline on the initial text;

[0097] The initial text is updated based on the difference value to obtain the target text;

[0098] The first structured long text is obtained by replacing the structured chart placeholder in the target text with the chart corresponding to the structured chart placeholder.

[0099] In this embodiment, upon receiving an outline update request from the user, for example, during the generation of a long text (e.g., after generating up to Chapter N), if the user manually modifies the JSON structured outline (e.g., adds a chapter or modifies the core arguments), an updated second text outline is obtained.

[0100] like Figure 3 As shown, Figure 3 This is a flowchart illustrating the outline modification process in this embodiment. By calculating the difference between the first and second text outlines—that is, by comparing the JSON trees of the old and new outlines in real time—the system extracts the changed outline nodes and their corresponding core constraint changes. The system automatically scans the physical files of chapters 1 to N-1 already generated on the local disk, using a large model to assess whether the outline changes cause logical conflicts or missing content with the generated preceding text. For preceding text paragraphs assessed as affected, the system automatically generates modification suggestions in the background and calls the generation mechanism to "partially rewrite" these specific paragraphs. Review and Silent Synchronization: The rewritten preceding text paragraphs must also undergo a multi-dimensional real-time review. After the review is passed, the local physical files are silently updated via an incremental file synchronizer. When the user continues to generate chapter N+1, the full physical state snapshot will automatically read the latest preceding text after cascading updates, ensuring absolute self-consistency of the global logic.

[0101] The initial text is updated based on the difference value to obtain the target text. The structured chart placeholders in the target text are then replaced with the charts corresponding to the structured chart placeholders, resulting in the output of the first structured long text.

[0102] This implementation allows users to adjust the outline at any stage, and the system can automatically locate the affected preceding text and make reverse corrections. This closely resembles the natural spiral-like writing habit of humans, greatly reducing the cost of reworking lengthy works.

[0103] Optionally, after inputting the first heterogeneous data and the first prompt word into a large language model for text generation to obtain the structured long text, and transmitting the structured long text to the user terminal, the method further includes:

[0104] Every preset period, the first heterogeneous data stored on the user terminal is detected to obtain the detection result;

[0105] If the detection result indicates that the first heterogeneous data stored on the user terminal has been updated to the second heterogeneous data, a third text outline is generated based on the second heterogeneous data;

[0106] Based on the second heterogeneous data and the third text outline, a second prompt word is formed;

[0107] The second heterogeneous data and the second prompt word are input into the large language model to generate text, resulting in a second structured long text. The second structured long text is then transmitted to the user terminal so that the user terminal updates the first structured long text to the second structured long text.

[0108] In this embodiment, the first heterogeneous data stored on the user terminal is detected at preset intervals. The preset interval can be 1 second, 10 seconds, etc. That is, when the user manually modifies the first heterogeneous data stored locally on the user terminal, the first heterogeneous data is detected and a detection result is obtained. If the detection result indicates that the first heterogeneous data stored on the user terminal has been updated to second heterogeneous data, a third text outline is generated based on the second heterogeneous data, and a second prompt word is formed based on the third text outline. Thus, in the same way as the previous steps, the second heterogeneous data and the second prompt word are input into the large language model to generate text, resulting in a second structured long text, and the second structured long text is transmitted to the user terminal so that the user terminal updates the first structured long text to the second structured long text.

[0109] Specifically, the reviewed text and chart placeholders are appended to a specified location in the local physical document in a streaming or block manner. The system monitors local document modification events in real time through filesystem hooks at the operating system level. If the system detects that the user has manually modified the previous text in an external editor, it directly marks the current context state in memory as invalidated. When the user requests generation again, a full physical state snapshot is forcibly retried. This ensures that the AI ​​always continues writing based on the latest real state modified by the user, achieving true two-state synchronization.

[0110] The user manually rewrote the text. This step focuses not on factual error correction, but on the user's consistent preference for "how to express themselves." Therefore, the core task is to extract the differences before and after the revision and transform these differences into style guidance constraints for subsequent generation. Specifically, the system compares the machine-generated initial draft and the user-revised draft of the same content, identifies repetitive adjustment patterns in vocabulary selection, sentence structure, paragraph development, and emphasis, filters out one-off or accidental changes, and distills these into reusable style rules, updating the prompt constraints for subsequent generation. Through this mechanism, the system can gradually approach the user's writing habits without changing the technical facts and logical boundaries, reducing the repetitive work of "rewriting the tone of every paragraph," and making the subsequent output more natural and consistent in style.

[0111] This embodiment allows users to manually modify documents locally at any time. The system can instantly sense changes in physical state and align the context, achieving a WYSIWYG (What You See Is What You Get) effect.

[0112] After extracting structured long text data, the system records key operation logs in a unified format, forming a replayable process trail. Each log entry includes at least the operation time, corresponding chapter or paragraph identifier, trigger source, key input constraints, execution result and status flag, and is associated with necessary information such as reference source and model version. Through this end-to-end logging mechanism, any piece of text can be traced back to "under what conditions it was generated, what checks it underwent, what corrections it underwent, and why it was ultimately written," which facilitates later problem localization and quality review, and also meets the requirements of compliance audit scenarios that require process evidence.

[0113] like Figure 4 As shown, Figure 4 This is a schematic diagram of the system architecture in this embodiment, including: A multimodal intent parsing module: responsible for parsing and vectorizing the heterogeneous knowledge base, as well as multi-round human-machine collaborative brainstorming and outline generation (leading step S1). A dynamic context-aware engine: the core brain of the system, responsible for executing context assembly and chart placement planning using "full snapshot + core anchor points" (leading step S2); it is also responsible for performing difference calculation, impact assessment, and triggering reverse rewriting when the outline changes (the core logic of leading step S5). A multidimensional review agent (ReviewAgent): an independent AI quality inspector, responsible for performing four-dimensional interception and scoring of the initial draft and the content after reverse rewriting based on facts, logic, instructions, and consistency of text and graphics (leading step S3, and cooperating in the rewriting review of S5). An incremental file synchronizer: responsible for bidirectional millisecond-level synchronization (dual-state synchronization) between memory and local disk, streaming to disk, and silent updates after outline changes (leading step S4, and cooperating in the silent synchronization of S5). Adaptive Learning Module: Responsible for comparing the differences between human and machine modifications and dynamically extracting user writing features to evolve system prompt words (leading step S6). Full-Process Source Tracking Recorder: Responsible for recording a full-process genealogy log including metadata such as Prompt snapshots and reference source hashes (leading step S7).

[0114] like Figure 5 As shown, Figure 5The core method flow diagram in this embodiment includes: Step S1: Intent understanding and dynamic outline generation based on multi-round human-machine collaborative brainstorming; Step S2: Collaborative generation of hybrid context and multimodal charts based on "full snapshot + core anchor points"; Step S3: Multi-dimensional real-time review gate (interception before writing); Step S4: Incremental writing and dual-state synchronization (human-machine collaborative closed loop); Step S5: Bypass triggering mechanism - dynamic change of outline and cascading reconstruction (reverse correction); Step S6: Adaptive style evolution (personalized learning); Step S7: Full-process traceability and archiving (compliance and auditing).

[0115] The technical solution of this application receives first heterogeneous data sent by the user terminal for generating structured long text, thereby generating a first text outline of the structured long text based on the first heterogeneous data, and forming a first prompt word based on the first heterogeneous data and the first text outline. The first prompt word generated in this way can more accurately reflect the user's structural needs for the structured long text itself. Therefore, the first structured long text generated by the large language model is more in line with the user's needs, thereby improving the accuracy of the generated structured long text.

[0116] like Figure 6 As shown, Figure 6 This is a structural diagram of the structured long text generation apparatus provided in an embodiment of this application. For example... Figure 6 As shown, the structured long text generation device 600 includes:

[0117] The receiving module 610 is used to receive the first heterogeneous data sent by the user terminal for generating structured long text;

[0118] The first generation module 620 is used to generate a first text outline based on the first heterogeneous data. The first text outline is used to represent the hierarchical structure and association information of the structured long text. The association information includes the association relationship between the chapters included in the structured long text.

[0119] The second generation module 630 is used to generate a first prompt word based on the first heterogeneous data and the first text outline;

[0120] The transmission module 640 is used to input the first heterogeneous data and the first prompt word into a large language model to generate text, obtain a first structured long text, and transmit the first structured long text to the user terminal.

[0121] Optionally, the first generation module 620 includes:

[0122] The first extraction submodule is used to extract text from the first heterogeneous data to obtain the target text.

[0123] The first generation submodule is used to generate at least one question information based on the target text. The question information is question information used to inquire about the structural needs, audience needs, and / or type needs of the structured long text.

[0124] A receiving submodule is used to transmit the at least one question information to the user terminal, and to receive at least one reply information sent by the user terminal that corresponds one-to-one with the at least one question information;

[0125] The second generation submodule is used to generate a first text outline based on the first heterogeneous data and the at least one response information.

[0126] Optionally, the second generation module 630 includes:

[0127] The second extraction submodule is used to extract information from the first text outline to obtain key information. The key information includes the constraints and setting information of the structured long text. The setting information is used to represent the global setting content of the structured long text.

[0128] The third generation submodule is used to generate first tag data based on the first text, generate second tag data based on the outline of the first text, and generate third tag data based on the key information. The first text data is the text generated by the structured long text based on the first heterogeneous data.

[0129] The splicing submodule is used to splice the first tag data, the second tag data, and the third tag data to form the first prompt word.

[0130] Optionally, the transmission module 640 includes:

[0131] The fourth generation submodule is used to input the first heterogeneous data and the first prompt word into the large language model to generate text and obtain initial text, wherein the initial text includes at least one structured chart placeholder, and the at least one structured chart placeholder corresponds one-to-one with at least one image information.

[0132] The verification submodule is used to perform factual verification, logical verification, and instruction compliance verification on the initial text to obtain the verification results.

[0133] The fifth generation submodule is used to input the at least one image information into the chart generation model to generate a chart when the verification result indicates that the initial text has passed the factual verification, the logical verification and the instruction compliance verification, so as to obtain at least one chart that corresponds one-to-one with the at least one structured chart placeholder.

[0134] The replacement submodule is used to replace the structured chart placeholders in the initial text with the charts corresponding to the structured chart placeholders, thereby obtaining the first structured long text.

[0135] Optionally, the replacement submodules include:

[0136] The acquisition unit is configured to acquire a second text outline based on the outline update request sent by the user terminal when receiving the outline update request, wherein the outline update request is used to update the first text outline to the second text outline;

[0137] A calculation unit is used to calculate the difference value between the first text outline and the second text outline, wherein the difference value is used to represent the degree of influence of updating the first text outline to the second text outline on the initial text;

[0138] An update unit is used to update the initial text based on the difference value to obtain the target text;

[0139] The replacement unit is used to replace the structured chart placeholder in the target text with the chart corresponding to the structured chart placeholder, thereby obtaining the first structured long text.

[0140] Optional, also includes:

[0141] The detection module is used to detect the first heterogeneous data stored on the user terminal at preset intervals and obtain the detection results.

[0142] The third generation module is used to generate a third text outline based on the second heterogeneous data when the detection result indicates that the first heterogeneous data stored in the user terminal has been updated to the second heterogeneous data.

[0143] The fourth generation module is used to compose a second prompt word based on the second heterogeneous data and the third text outline;

[0144] The fifth generation module is used to input the second heterogeneous data and the second prompt word into the large language model to generate text, obtain the second structured long text, and transmit the second structured long text to the user terminal so that the user terminal updates the first structured long text to the second structured long text.

[0145] The technical solution of this application receives first heterogeneous data sent by the user terminal for generating structured long text, thereby generating a first text outline of the structured long text based on the first heterogeneous data, and forming a first prompt word based on the first heterogeneous data and the first text outline. The first prompt word generated in this way can more accurately reflect the user's structural needs for the structured long text itself. Therefore, the first structured long text generated by the large language model is more in line with the user's needs, thereby improving the accuracy of the generated structured long text.

[0146] This application also provides an electronic device. Please refer to [link to relevant documentation]. Figure 7 The electronic device may include a processor 701, a memory 702, and a program 7021 stored in the memory 702 and capable of running on the processor 701.

[0147] When program 7021 is executed by processor 701, it can achieve the following: Figure 1 Any step in the corresponding method embodiment:

[0148] Receive the first heterogeneous data sent by the user client to generate structured long text;

[0149] A first text outline is generated based on the first heterogeneous data. The first text outline is used to represent the hierarchical structure and related information of the structured long text. The related information includes the relationship between the chapters included in the structured long text.

[0150] Based on the first heterogeneous data and the first text outline, the first prompt word is formed;

[0151] The first heterogeneous data and the first prompt word are input into a large language model to generate text, resulting in a first structured long text, which is then transmitted to the user terminal.

[0152] Optionally, generating the first text outline based on the first heterogeneous data includes:

[0153] Text extraction is performed on the first heterogeneous data to obtain the target text;

[0154] At least one question is generated based on the target text. The question is a question used to inquire about the structural requirements, audience requirements, and / or type requirements of the structured long text.

[0155] The at least one question message is transmitted to the user terminal, and at least one reply message corresponding to the at least one question message is received from the user terminal;

[0156] Based on the first heterogeneous data and the at least one response information, a first text outline is generated.

[0157] Optionally, the step of composing the first prompt word based on the first heterogeneous data and the first text outline includes:

[0158] Information is extracted from the first text outline to obtain key information, which includes the constraints and setting information of the structured long text. The setting information is used to represent the global setting content of the structured long text.

[0159] First tag data is generated based on the first text, second tag data is generated based on the outline of the first text, and third tag data is generated based on the key information. The first text data is the structured long text that has been generated based on the first heterogeneous data.

[0160] The first tag data, the second tag data, and the third tag data are concatenated to form the first prompt word.

[0161] Optionally, the step of inputting the first heterogeneous data and the first prompt word into a large language model for text generation to obtain the first structured long text includes:

[0162] The first heterogeneous data and the first prompt word are input into a large language model to generate text, thereby obtaining initial text. The initial text includes at least one structured chart placeholder, and the at least one structured chart placeholder corresponds one-to-one with at least one image information.

[0163] The initial text is subjected to factual verification, logical verification, and instruction compliance verification to obtain the verification results;

[0164] If the verification result indicates that the initial text has passed the factual verification, the logical verification, and the instruction compliance verification, the at least one image information is input into the chart generation model to generate a chart, thereby obtaining at least one chart that corresponds one-to-one with the at least one structured chart placeholder.

[0165] The first structured long text is obtained by replacing the structured chart placeholder in the initial text with the chart corresponding to the structured chart placeholder.

[0166] Optionally, replacing the structured chart placeholders in the initial text with the charts corresponding to the structured chart placeholders to obtain the first structured long text includes:

[0167] Upon receiving an outline update request from the user, a second text outline is obtained based on the outline update request, which is used to update the first text outline to the second text outline.

[0168] Calculate the difference value between the first text outline and the second text outline, the difference value being used to represent the degree of impact of updating the first text outline to the second text outline on the initial text;

[0169] The initial text is updated based on the difference value to obtain the target text;

[0170] The first structured long text is obtained by replacing the structured chart placeholder in the target text with the chart corresponding to the structured chart placeholder.

[0171] Optionally, after inputting the first heterogeneous data and the first prompt word into a large language model for text generation to obtain the structured long text, and transmitting the structured long text to the user terminal, the method further includes:

[0172] Every preset period, the first heterogeneous data stored on the user terminal is detected to obtain the detection result;

[0173] If the detection result indicates that the first heterogeneous data stored on the user terminal has been updated to the second heterogeneous data, a third text outline is generated based on the second heterogeneous data;

[0174] Based on the second heterogeneous data and the third text outline, a second prompt word is formed;

[0175] The second heterogeneous data and the second prompt word are input into the large language model to generate text, resulting in a second structured long text. The second structured long text is then transmitted to the user terminal so that the user terminal updates the first structured long text to the second structured long text.

[0176] The user terminal updates the first structured long text to the second structured long text.

[0177] The technical solution of this application receives first heterogeneous data sent by the user terminal for generating structured long text, thereby generating a first text outline of the structured long text based on the first heterogeneous data, and forming a first prompt word based on the first heterogeneous data and the first text outline. The first prompt word generated in this way can more accurately reflect the user's structural needs for the structured long text itself. Therefore, the first structured long text generated by the large language model is more in line with the user's needs, thereby improving the accuracy of the generated structured long text.

[0178] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the above-described structured long text generation embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0179] This application also provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described method for generating structured long text, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0180] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0181] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a communication device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0182] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method for generating structured long text, characterized in that, Applied to the server side, the method includes: Receive the first heterogeneous data sent by the user client to generate structured long text; A first text outline is generated based on the first heterogeneous data. The first text outline is used to represent the hierarchical structure and related information of the structured long text. The related information includes the relationship between the chapters included in the structured long text. Based on the first heterogeneous data and the first text outline, the first prompt word is formed; The first heterogeneous data and the first prompt word are input into a large language model to generate text, resulting in a first structured long text, which is then transmitted to the user terminal.

2. The method according to claim 1, characterized in that, The process of generating a first text outline based on the first heterogeneous data includes: Text extraction is performed on the first heterogeneous data to obtain the target text; At least one question is generated based on the target text. The question is a question used to inquire about the structural requirements, audience requirements, and / or type requirements of the structured long text. The at least one question message is transmitted to the user terminal, and at least one reply message corresponding to the at least one question message is received from the user terminal; Based on the first heterogeneous data and the at least one response information, a first text outline is generated.

3. The method according to claim 2, characterized in that, The process of composing the first prompt word based on the first heterogeneous data and the first text outline includes: Information is extracted from the first text outline to obtain key information, which includes the constraints and setting information of the structured long text. The setting information is used to represent the global setting content of the structured long text. First tag data is generated based on the first text, second tag data is generated based on the outline of the first text, and third tag data is generated based on the key information. The first text data is the structured long text that has been generated based on the first heterogeneous data. The first tag data, the second tag data, and the third tag data are concatenated to form the first prompt word.

4. The method according to any one of claims 1-3, characterized in that, The step of inputting the first heterogeneous data and the first prompt word into a large language model for text generation to obtain the first structured long text includes: The first heterogeneous data and the first prompt word are input into a large language model to generate text, thereby obtaining initial text. The initial text includes at least one structured chart placeholder, and the at least one structured chart placeholder corresponds one-to-one with at least one image information. The initial text is subjected to factual verification, logical verification, and instruction compliance verification to obtain the verification results; If the verification result indicates that the initial text has passed the factual verification, the logical verification, and the instruction compliance verification, the at least one image information is input into the chart generation model to generate a chart, thereby obtaining at least one chart that corresponds one-to-one with the at least one structured chart placeholder. The first structured long text is obtained by replacing the structured chart placeholder in the initial text with the chart corresponding to the structured chart placeholder.

5. The method according to claim 4, characterized in that, The step of replacing the structured chart placeholders in the initial text with the charts corresponding to the structured chart placeholders to obtain the first structured long text includes: Upon receiving an outline update request from the user, a second text outline is obtained based on the outline update request, which is used to update the first text outline to the second text outline. Calculate the difference value between the first text outline and the second text outline, the difference value being used to represent the degree of impact of updating the first text outline to the second text outline on the initial text; The initial text is updated based on the difference value to obtain the target text; The first structured long text is obtained by replacing the structured chart placeholder in the target text with the chart corresponding to the structured chart placeholder.

6. The method according to claim 1, characterized in that, After inputting the first heterogeneous data and the first prompt word into a large language model to generate text, obtaining the structured long text, and transmitting the structured long text to the user terminal, the method further includes: Every preset period, the first heterogeneous data stored on the user terminal is detected to obtain the detection result; If the detection result indicates that the first heterogeneous data stored on the user terminal has been updated to the second heterogeneous data, a third text outline is generated based on the second heterogeneous data; Based on the second heterogeneous data and the third text outline, a second prompt word is formed; The second heterogeneous data and the second prompt word are input into the large language model to generate text, resulting in a second structured long text. The second structured long text is then transmitted to the user terminal so that the user terminal updates the first structured long text to the second structured long text.

7. A structured long text generation apparatus, characterized in that, Applied to the server side, the device includes: The receiving module is used to receive the first heterogeneous data sent by the user terminal for generating structured long text; The first generation module is used to generate a first text outline based on the first heterogeneous data. The first text outline is used to represent the hierarchical structure and association information of the structured long text. The association information includes the association relationship between the chapters included in the structured long text. The second generation module is used to generate the first prompt word based on the first heterogeneous data and the first text outline; The transmission module is used to input the first heterogeneous data and the first prompt word into a large language model to generate text, obtain a first structured long text, and transmit the first structured long text to the user terminal.

8. An electronic device, characterized in that, include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, Includes computer instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1 to 6.